|
目前使用python2.7版本,是什么原因,感觉自己写的脚本没问题,但总是报错,脚本改了各种方式,其他正常find_element_by_id啊等都能用。就path用不了。请大家帮忙看下。
脚本:
dingdan = driver.find_element_by_xpath("//div[@id='erpHeaderMenus']/div[2]")
ActionChains(driver).move_to_element(dingdan).perform()
报错如下:
Traceback (most recent call last):
File "C:\Python27\test1.py", line 22, in <module>
dingdan = driver.find_element_by_xpath("//*[@id='erpHeaderMenus']/div[2]")
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 394, in find_element_by_xpath
return self.find_element(by=By.XPATH, value=xpath)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 978, in find_element
'value': value})['value']
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
NoSuchElementException: Message: Unable to locate element: //*[@id='erpHeaderMenus']/div[2] |
|