推荐学习书目
› 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
wq2016
V2EX  ›  Python

Selenium 当页面 JS 触发之后,页面加载了新的内容, driver 如何获取?

  •  1
     
  •   wq2016 · Feb 21, 2016 · 4682 views
    This topic created in 3871 days ago, the information mentioned may be changed or developed.

    当我执行一个 click 动作之后,页面加载了更多的内容,这个时候, driver 应该如何做才能获取新的内容呢?

    4 replies  •  2016-02-22 23:23:37 +08:00
    hantsy
        1
    hantsy  
       Feb 21, 2016
    页面 End 2 End 测试用高级一点 Geb/Spock 更简单一些, JS 交互也不会有问题。
    wq2016
        2
    wq2016  
    OP
       Feb 22, 2016
    @hantsy 用的 Python , Spock 是 JAVA 平台的吧?
    finfou
        3
    finfou  
       Feb 22, 2016
    selenium 操作的是当前浏览器显示的内容, driver 获取的就是最新的内容,只是通常要确保页面加载完成,比如  selenium.webdriver.support.ui.WebDriverWait
    wq2016
        4
    wq2016  
    OP
       Feb 22, 2016
    @finfou 对的,现在已经解决了,在 StackOverFlow 上问了~
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   950 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 18:17 · PVG 02:17 · LAX 11:17 · JFK 14:17
    ♥ Do have faith in what you're doing.