NoSuchElementException selenium phantomjs python

时间:2017-09-11 09:53:19

标签: python selenium phantomjs

我正在使用selenium与python和phantomjs安排工作。

  • 硒3.4.3
  • 蟒-3.3
  • phantomjs-2.1.1

使用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-

0 个答案:

没有答案