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

driver.get(url)如何在 for 循环中保持呢?

  •  
  •   jahan · 2017-12-02 17:02:46 +08:00 · 1834 次点击
    这是一个创建于 2342 天前的主题,其中的信息可能已经有所发展或是发生改变。
    代码块 1
    driver.get(url)
    wait
    for~~~~~:
    ~~~~~
    ele = find_elements_by_path
    ~~~~~~~~
    try:
    ~~####
    except e:
    #####


    代码块 2
    for ~~~~:
    driver.get(url)
    wait
    ele =find_elements_by_path
    ~~~~~~~~
    try:
    ~~####
    except e:
    #####


    代码块 1 在第一遍循环中是正常的,ele 能够返回列表;第二遍循环就会报错 out of index range,ele 返回空列表,
    代码块 2 属于正常的满足,功能,可是每次 driver.get(url)然后 wait,真的开销很大,有没有好的办法解决呢?
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   971 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 23:22 · PVG 07:22 · LAX 16:22 · JFK 19:22
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.