lundi 2 mai 2016

Selenium - how to reliably click on text?

I am trying to click on text links and that does not work:

from selenium import webdriver
driver = webdriver.Firefox()
driver.get("http://ift.tt/1qdaSGF")
driver.find_element_by_name("username").send_keys(email)
driver.find_element_by_id("existingUser").click()
driver.find_element_by_id("fld-password").send_keys(password)
driver.find_element_by_xpath("//*[contains(text(), 'Continue')]").click() # works

driver.get("http://ift.tt/1sQlGuQ")
driver.find_element_by_xpath("//*[contains(@span,'For Sale']").click()  # contains(text() does not work either
driver.find_element_by_xpath("//*[contains(@span,'Appliances']").click() # does not work
driver.find_element_by_xpath("//*[contains(@span,'Home Appliances']").click()
driver.find_element_by_xpath("//*[contains(@span,'Other Home Appliances']").click()

What do I do wrong?




Aucun commentaire:

Enregistrer un commentaire