python - Firefox sees element where PhantomJS does not when using Selenium-Webdriver -
i have been looking around quite long time find solution problem, hope here can think of help.
i have working selenium script (in python) working firefox driver connect on website. when using phantomjs driver, doesn't work anymore.
the form generated javascript , on https website. here code of user input :
<script language="javascript1.2"> document.writeln("<input class=\"textform\" type=\"text\" id=\"user\" name=\"user\" size=\"" + size + "\" tabindex=1 onfocus=\"hadfocus(true)\">"); </script>
here part of script looking : (working on firefox not phantomjs)
from selenium import webdriver selenium.webdriver.common.keys import keys selenium.webdriver.common.by import selenium.webdriver.support.ui import webdriverwait selenium.webdriver.support import expected_conditions ec import time driver = webdriver.firefox() driver.get([my url]) print driver.page_source driver.find_element_by_id("user").clear() driver.find_element_by_id("user").send_keys([my user id]) driver.find_element_by_id("pass").clear() driver.find_element_by_id("pass").send_keys([my pass]) driver.find_element_by_name("login_btn").click() html_source = driver.page_source print html_source driver.close()
and here error :
selenium.common.exceptions.nosuchelementexception
if print page_source
after reaching page, firefox shows right source code, phantomjs has : <html><head></head><body></body></html>
do think of cause of ?
i have solved problem artjom b. answer :
just change in code :
driver = webdriver.phantomjs(service_args=['--ignore-ssl-errors=true'])
it due ssl certificate guess.
Comments
Post a Comment