Python Selenium Webpage Scraping Selecting Drop Down and entering text in html form
<p>I have a problem scraping data from the following site: <a href="https://arcc.sdcounty.ca.gov/Pages/Assessors-Roll-Tax.aspx" rel="nofollow">https://arcc.sdcounty.ca.gov/Pages/Assessors-Roll-Tax.aspx</a>. </p>

<p>I have to do these steps in order:</p>

<ol>
<li><p>Select a drop down option "Street Address'</p></li>
<li><p>Enter a street address into a text field (ie 43 Hadar Dr)</p></li>
<li><p>Click the 'Submit' button. </p></li>
</ol>

<p>After clicking submit, I should be directed to a page that has the APN number for a given address.</p>

<p><strong>The problem:</strong>
I am able to do the above steps. However, when I select a drop down option and input address in the textbox, it fails as the textbox input address for some reason is cleared before clicking 'submit' ONLY when I have selected a drop down option. </p>

<p>I have tried using Selenium's Expected Conditions to trigger the input in the text box after a drop down option has been selected, but did nothing. I am looking for any help on identifying the why there is this problem as well as any advice on solutions. </p>

<p>Thanks.Much appreciated.</p>

<p><strong>My code:</strong></p>

<pre><code>    driver = webdriver.Chrome()
    driver.get('https://arcc.sdcounty.ca.gov/Pages/Assessors-Roll-Tax.aspx')
    #Selects drop down option ('Street Address')
    mySelect =        Select(driver.find_element_by_id("ctl00_ctl43_g_d30f33ca_a5a7_4f69_bb21_cd4abc25  ea12_ctl00_ddlSearch"))
    my=mySelect.select_by_value('0')  
    wait = WebDriverWait(driver,300)
    #Enter address in text box to left of drop down
   driver.find_element_by_id("ctl00_ctl43_g_d30f33ca_a5a7_4f69_bb21_cd4abc25ea12_ct    l00_txtSearch").send_keys("11493 hadar dr")
    #Click 'Submit' button to return API numbers associated with address
    driver.find_element_by_id("ctl00_ctl43_g_d30f33ca_a5a7_4f69_bb21_cd4abc25ea12_ctl00_btnSearch").click()
    driver.quit()
</code></pre>

<p>Not sure if this is your situation. But one thing that jumped out from your question is the text box input... Often, when filling in a website text box, even though the text is clearly visible, the text is not actually read by the text-box method until after the focus (cursor) is clicked or tabbed out and away from the text box. </p>

<p>Tabbing the text cursor out of the text entry box first, before 'clicking submit', will often solve this issue.</p>

python html selenium selenium-webdriver