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()
asked Jan 18, 2014 at 3:46
12
  • Does browser.find_element_by_id('originator_node').click() work? Commented Jan 18, 2014 at 3:50
  • Also: you're calling find_elementS and then calling click. You probably don't want that. Commented Jan 18, 2014 at 3:51
  • @l19 that also does not work. actually when i click over that it should start downloading .tar.gz file Commented Jan 18, 2014 at 3:54
  • An <input type="hidden"> is not a clickable. The button you want is some other element. It's probably inside the table somewhere. Commented Jan 18, 2014 at 3:54
  • 1
    I don't know how to tell you to generate the event you want, because you have shown us the wrong part of the document. Messing around with a random <input type="hidden"> that happens to be in the same form is not going to accomplish anything. Commented Jan 18, 2014 at 4:04

1 Answer 1

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

answered Jan 18, 2014 at 4:36

2 Comments

your code does not work anymore, can you provide working code? @Guy
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...

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.