Skip to content

Instantly share code, notes, and snippets.

@dwillis
Last active August 29, 2015 14:12
Show Gist options
  • Select an option

  • Save dwillis/2550e5c3e52883c0269a to your computer and use it in GitHub Desktop.

Select an option

Save dwillis/2550e5c3e52883c0269a to your computer and use it in GitHub Desktop.
from selenium import webdriver
from selenium.webdriver.support.ui import Select
election = {"year": "2012", "type": "primary", "id": "16", "datestring":"20120712"}
jurisdiction = {'slug': "carson_city", "id": "4", 'name':'Carson City'}
driver = webdriver.Firefox()
driver.get('http://www.nvsos.gov/electionresults/PrecinctReport.aspx')
election_select = Select(driver.find_element_by_name('ddlElections'))
election_select.select_by_value(election['id'])
driver.implicitly_wait(10)
jurisdiction_select = Select(driver.find_element_by_name('ddlAgencies'))
jurisdiction_select.select_by_value(jurisdiction['id'])
driver.find_element_by_name('btnElectionSearch').click()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment