出于某种原因,当我没有无头时,我可以登录http://www.neighborhoodscout.com。然而,当我运行无头PhantomJS时,我无法登录,它无法找到登录成功时返回的元素。
Phantom JS 1.9.8版
driver = webdriver.PhantomJS()
driver.set_window_size(1124, 850)
driver.get(url)
time.sleep(2)
driver.find_element_by_id("login").click()
time.sleep(2)
driver.find_element_by_id("user_email").send_keys(username)
driver.find_element_by_id("user_password").send_keys(password)
time.sleep(4)
driver.find_element_by_id("login-button").click()
为什么它对无头无效而不适用于phantomjs?
没有回溯错误,因某些原因无法登录?
我正在寻找一个特定的元素:
ele_found=EC.presence_of_element_located(driver.find_element_by_id('flash_notice')) is not None