Selenium Python No Name or ID

Viewed 39

How do I submit the postcode eg. "3000" and click submit Selenium (Python) when I can't search by the name or ID.

Here is the HTML

    <div class="container-fluid" id="basicpage">
      <div class="container">
        <div class="row">
    
    <div id=right_col class="col-xs-12 col-md-9">  

          
        

        
        <div class=nothingwrapper>
        </div>
        <div class=nothingwrapper>
          <h1>Postcode Snapshot </h1>
                              <p> Please type in the postcode for which you would like to download a postcode snapshot:</p>
          <form action="postcodesnapshotchoosepostcode.php" method="post">
                    <input name=sub value=1 type=hidden>
                    <p><input type=text name=postcode size=5></p><p><input type=submit value='Continue' /></p>
          </form>
          <p>&nbsp;</p>
        </div>

Here is what I have tried

# Select the by name
postcode_box = driver.find_element(By.NAME, "postcode")
# Send information
postcode_box.send_keys('3000')


driver.find_element(By.NAME("sub")).submit()
1 Answers
//input[@value='Continue'] 

If you need an xpath for an attribute you can do it like so

Related