我正在使用selenium与python和phantomjs安排工作。
使用chrome,selenium和python时代码运行正常phantomjs
失败。
显示以下错误 -
File "C:\Users\Rahul Mukherjee\Desktop\phantom-js selenium\mysql.py", line
76, in <module>
username = driver.find_element_by_xpath("//*[@name='j_username' and
@id='username']")
File "C:\Users\Rahul Mukherjee\AppData\Local\Programs\Python\Python36-
32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 313, in
find_element_by_xpath
return self.find_element(by=By.XPATH, value=xpath)
File "C:\Users\Rahul Mukherjee\AppData\Local\Programs\Python\Python36-
32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 791, in
find_element
'value': value})['value']
File "C:\Users\Rahul Mukherjee\AppData\Local\Programs\Python\Python36-
32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 256, in
execute
self.error_handler.check_response(response)
File "C:\Users\Rahul Mukherjee\AppData\Local\Programs\Python\Python36-
32\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 194,
in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message:
{"errorMessage":"Unable to find element with xpath '//*[@name='j_username'
and @id='username']'",
'","request":{"headers":{"Accept":"application/json","Accept-