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

selenium 点击的问题.请各位大佬指教一下.

  •  
  •   old18 · 2019-04-25 15:29:49 +08:00 · 1769 次点击
    这是一个创建于 1820 天前的主题,其中的信息可能已经有所发展或是发生改变。
    "<div>
    <p>
    我已阅读并同意
    <a href="javascript:void(0)">xxx 协议</a>
    </p>
    </div>"

    click()和鼠标点击都用了
    点了就直接跳进协议里了. 然后前面小方框没有勾选上

    求各位大佬给个思路
    3 条回复    2019-04-30 11:30:36 +08:00
    testlover
        1
    testlover  
       2019-04-25 16:30:43 +08:00
    checkbox 和 a 标签这是俩控件啊 你得操作前面的 checkbox 不能操作 a 标签啊
    crazypig14
        2
    crazypig14  
       2019-04-25 16:33:33 +08:00
    从 console 代码里用 js 实现点击,再把 js 搬到 python 里
    ccdrea
        3
    ccdrea  
       2019-04-30 11:30:36 +08:00
    self.broswer.execute_script("arguments[0].click();",checkbox )
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1502 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 17:10 · PVG 01:10 · LAX 10:10 · JFK 13:10
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.