selenium 定位错误

2018-07-19 19:27:05 +08:00
 bestehen

Traceback (most recent call last): File "qimingpian.py", line 126, in <module> qimingpian().get_content() File "qimingpian.py", line 112, in get_content element.find_element_by_xpath('//*[@class="btn-next"]').click() File "/usr/lib/python3.4/site-packages/selenium/webdriver/remote/webelement.py", line 80, in click self._execute(Command.CLICK_ELEMENT) File "/usr/lib/python3.4/site-packages/selenium/webdriver/remote/webelement.py", line 628, in _execute return self._parent.execute(command, params) File "/usr/lib/python3.4/site-packages/selenium/webdriver/remote/webdriver.py", line 314, in execute self.error_handler.check_response(response) File "/usr/lib/python3.4/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: unknown error: Element is not clickable at point (771, 571). Other element would receive the click: ... (Session info: headless chrome=66.0.3359.181) (Driver info: chromedriver=2.38.552522 (437e6fbedfa8762dec75e2c5b3ddb86763dc9dcb),platform=Linux 3.10.0-514.26.2.el7.x86_64 x86_64)

设置如下还是没有反应 element = WebDriverWait(self.driver, 10).until(EC.presence_of_element_located((By.XPATH, '//[@class="btn-next"]'))) element.find_element_by_xpath('//[@class="btn-next"]').click()

1937 次点击
所在节点    Python
3 条回复
xuegj1010
2018-07-19 20:34:03 +08:00
换成 enter 试试看呢?
bestehen
2018-07-19 22:28:12 +08:00
@xuegj1010 具体怎么写?
nature91
2018-07-20 10:42:30 +08:00
is not clickable 这玩意可点击? 能不用 xpath 少用 xpath ID NAME 之类的直接用

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/472448

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX