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
shiyuu
V2EX  ›  Python

webdriver 自动化循环问题,当翻页检测到某个元素就重新执行

  •  
  •   shiyuu · 2021-12-24 11:15:47 +08:00 · 1436 次点击
    这是一个创建于 857 天前的主题,其中的信息可能已经有所发展或是发生改变。

    函数封装一个动作 url 固定,点击的标签从 1 顺序开始能进入到内容后开始翻页 现在当翻页到无法翻页时会出现元素 driver.find_element(By.XPATH,'//div[@class="over"]') 想要当出现这个元素的时候,重新执行访问 url ,接着点击标签 2 ,这样当找到结束元素时返回开头再循环顺序点 3 、4 、5 那我每点击一次翻页都查询一次 driver.find_element(By.XPATH,'//div[@class="over"]')是否存在 如果存在就重新执行这个函数

    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5767 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 02:51 · PVG 10:51 · LAX 19:51 · JFK 22:51
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.