用webdriver做UI自动化,运行到点击搜索时报错,检查不出问题,大家看一下,遇到过...
用webdriver做UI自动化,运行到点击搜索时报错,检查不出问题,大家看一下,遇到过这种情况怎么解决错误信息:selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":""}(Session info: chrome=89.0.4389.90)程序:driver.find_element_by_id("searchBtn").click() 点击搜索 --------报错行----------sleep(3)
driver.quit()
报错信息:
Traceback (most recent call last):
File "D:/软件安装/pycharm/和包2.0/UI/demo1.py", line 26, in
driver.find_element_by_id("searchBtn").click()
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":""}
(Session info: chrome=89.0.4389.90)
搜索的定位不准,脚本未找到该元素,重新定下位 搜索按钮重新定位下 重新定位下 检查下按钮的定位是否唯一 定位不到,再试试
页:
[1]