from selenium import webdriver
from selenium.webdriver.common.keys import Keys
chromedriver = 'C:\\chromedriver.exe'
browser = webdriver.Chrome(chromedriver)
browser.get('http://www.example.com')
username = browser.find_element_by_id('username')
password = browser.find_element_by_id('password')
username.send_keys('username')
password.send_keys('password')
browser.find_element_by_id('submit').click()
I want to click on the download button (lower right second one).
Please help me!! The following code did not work:
browser.find_elements_by_id('//input[@value="EE"]').click()
asked Jan 18, 2014 at 3:46
1 Answer 1
depend of how many similar links you have on that page try:
browser.find_element_by_partial_link_text(
'https://earthexplorer.usgs.gov/download/').click()
for more locating options see the docs
also, note that you'll have to add the chrome equivalent of Access to file download dialog in Firefox to avoid a download dialog
answered Jan 18, 2014 at 4:36
2 Comments
2964502
your code does not work anymore, can you provide working code? @Guy
Guy Gavriely
sorry, it's hard to tell without the real html, use print statements to debug the html element you are locating, you'll have to somehow find the relevant
a
link and click on it...lang-py
browser.find_element_by_id('originator_node').click()
work?find_elementS
and then callingclick
. You probably don't want that.<input type="hidden">
is not a clickable. The button you want is some other element. It's probably inside the table somewhere.<input type="hidden">
that happens to be in the same form is not going to accomplish anything.