python - Select radio button with Selenium -


i'm trying select radio button 'government & military' on this page using selenium.

the code below tries 2 different methods, neither working:

from selenium import webdriver browser = webdriver.chrome('/users/joe/python/chromedriver')  browser.find_element_by_xpath('//*[@id="propertygov"]').click() browser.find_elements_by_xpath('.//*[@id="propertygov"]')[0].click() 

edit:

here full code. initial interaction date form keeping me selecting radio select:

from selenium import webdriver  browser = webdriver.chrome('/users/joe/python/chromedriver') browser.get("http://www.marriott.com/search/default.mi")  browser.find_element_by_id('editsearch-location').send_keys('atlanta, ga') browser.find_element_by_xpath('//*[@id="hotel-fromdate"]').click()  browser.find_element_by_xpath('//*[@id="hotel-fromdate_table"]/tbody/tr[2]/td[2]/div').click() browser.find_element_by_xpath('//*[@id="hotel-fromdate_table"]/tbody/tr[2]/td[3]/div').click()  browser.find_element_by_id('propertygov').click() 

browser.get("http://www.marriott.com/search/default.mi") browser.find_element_by_id('propertygov').click() 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -