V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
bestehen
V2EX  ›  Python

selenium 定位错误

  •  
  •   bestehen · 2018-07-19 19:27:05 +08:00 · 1941 次点击
    这是一个创建于 2356 天前的主题,其中的信息可能已经有所发展或是发生改变。

    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()

    xuegj1010
        1
    xuegj1010  
       2018-07-19 20:34:03 +08:00
    换成 enter 试试看呢?
    bestehen
        2
    bestehen  
    OP
       2018-07-19 22:28:12 +08:00
    @xuegj1010 具体怎么写?
    nature91
        3
    nature91  
       2018-07-20 10:42:30 +08:00
    is not clickable 这玩意可点击? 能不用 xpath 少用 xpath ID NAME 之类的直接用
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1214 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 23:34 · PVG 07:34 · LAX 15:34 · JFK 18:34
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.