0
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()
2964502
  • 4,301
  • 12
  • 35
  • 55

1 Answers1

2

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

Community
  • 1
  • 1
Guy Gavriely
  • 11,228
  • 6
  • 27
  • 42
  • your code does not work anymore, can you provide working code? @Guy – 2964502 Jan 18 '14 at 06:17
  • 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... – Guy Gavriely Jan 18 '14 at 06:22