I just want to wrote a simple log in code for one website, however, i think the log in page was wrote in JS code, It's really hard to locate the elements with selenium. The web page I am going to play with is: "http://ift.tt/1XlCWM1" This is how the page looks like and how the inspect element page look like
I was trying to locate the element by following code:
from selenium import webdriver from selenium.webdriver.common.keys
import Keys import time driver = webdriver.Firefox() driver.get("http://ift.tt/1XlCxcv? returnUrl=%2Fthread%2Fe9680e08e7e3cd76b8832684037a58a369cad5ed") time.sleep(5) driver.switch_to.frame(driver.find_element_by_tag_name("iframe")) elem =driver.find_element_by_xpath("//*[@id='ce3feab5-6156-441a-970e-23544473a623']") elem.send_keys("pycon") elem.send_keys(Keys.RETURN) driver.close()
This code return the error that the element could not find by "[@id='ce3feab5-6156-441a-970e-23544473a623'".
I tried playing with frames, it seems does not work. If I went to "view web source" page, it is full of JS code.
Is there a good way to play with such a web page with selenium ?
Appreciate your help.
Aucun commentaire:
Enregistrer un commentaire