推荐学习书目
› 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 · Jul 19, 2018 · 2607 views
    This topic created in 2990 days ago, the information mentioned may be changed or developed.

    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  
       Jul 19, 2018
    换成 enter 试试看呢?
    bestehen
        2
    bestehen  
    OP
       Jul 19, 2018
    @xuegj1010 具体怎么写?
    nature91
        3
    nature91  
       Jul 20, 2018
    is not clickable 这玩意可点击? 能不用 xpath 少用 xpath ID NAME 之类的直接用
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2692 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 13:46 · PVG 21:46 · LAX 06:46 · JFK 09:46
    ♥ Do have faith in what you're doing.