Skip to content

Instantly share code, notes, and snippets.

@arecker
Last active January 12, 2016 12:33
Show Gist options
  • Save arecker/1ac69f8b74c3c20a5b70 to your computer and use it in GitHub Desktop.
Save arecker/1ac69f8b74c3c20a5b70 to your computer and use it in GitHub Desktop.
busbot - 5
fields = {'name': 'Alex Recker',
'Address': '123 Sesame St',
'City': 'Madison',
'State': 'WI',
'Zip': '53704',
'email': '[email protected]'}
for name, value in fields.items():
elem = driver.find_element_by_name(name)
if name == 'State': # State Dropdown
for option in elem.find_elements_by_tag_name('option'):
if option.get_attribute('value') == value:
option.click()
break
else:
elem.send_keys(value)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment