Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I'm trying to automate the download process on this page: https://cdr.ffiec.gov/public/PWS/DownloadBulkData.aspx

In particular, I want to be able to select any option in the "Reporting Period End Date" dropdown.

<select name="ctl00$MainContentHolder$DatesDropDownList" onchange="javascript:setTimeout(&#39;__doPostBack(\&#39;ctl00$MainContentHolder$DatesDropDownList\&#39;,\&#39;\&#39;)&#39;, 0)" id="DatesDropDownList" class="valuelabel">
        <option selected="selected" value="81">12/31/2014</option>
        <option value="80">09/30/2014</option>
        <option value="79">06/30/2014</option>
        <option value="78">03/31/2014</option>
        <option value="76">12/31/2013</option>
                ...
</select>

I tried the following in Selenium, but it returns an empty list:

url = 'https://cdr.ffiec.gov/public/PWS/DownloadBulkData.aspx'
driver = webdriver.Firefox()
driver.get(url)
date_field = driver.find_element_by_id("DatesDropDownList")
Select(date_field).options

I think the issue is the javascript in the select. What's the right way to do this?

share|improve this question
    
Did the given solution work for you ? –  Dharam Mar 19 at 12:30
    
yes, thank you! –  sirallen Mar 19 at 13:08

1 Answer 1

up vote 1 down vote accepted

Your page functionality expects you to select a value from the first listbox :)

So select a value from "Available Products", then the date dropdown gets populated.

browser = webdriver.Firefox()
browser.get('https://cdr.ffiec.gov/public/PWS/DownloadBulkData.aspx')

list1 = Select(browser.find_element_by_id("ListBox1"))
list1.select_by_visible_text("Call Reports -- Single Period")

date_field = Select(browser.find_element_by_id("DatesDropDownList"))
date_field.select_by_visible_text("03/31/2014")
share|improve this answer
    
That gives a NoSuchElementException. –  sirallen Mar 19 at 7:20
    
Check updated answer –  Dharam Mar 19 at 7:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.