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

求助:使用 pyppeteer 执行 JS 仍然被检测到 WebDriver

  •  
  •   KevinBu · Jun 12, 2019 · 3830 views
    This topic created in 2544 days ago, the information mentioned may be changed or developed.

    执行的 JS:

    js1 = '''() =>{ Object.defineProperties(navigator,{ webdriver:{ get: () => false } }) }'''

    js2 = '''() => { alert ( window.navigator.webdriver ) }'''

    弹出的结果的确为 false

    可是在登陆时仍然被网站检测到了,验证码一直无法通过,正常浏览器访问则可以通过

    用检测工具也的确检测到了 WebDriver: 1560308022(1).png

    我在网上搜到的资料,别人貌似都成功了,请问我该如何做?

    4 replies    2019-07-30 09:23:09 +08:00
    KevinBu
        1
    KevinBu  
    OP
       Jun 12, 2019
    刚刚解决了😂

    因为有页面的跳转,我将执行 JS 的语句放到页面跳转后执行就可以了

    所以要记得如果有页面跳转的话之前执行的 JS 就不生效了😂
    yejianmail
        2
    yejianmail  
       Jun 12, 2019 via Android
    加个 page 回调就可以了
    Memento
        3
    Memento  
       Jul 29, 2019
    @KevinBu 是放在 goto 之后执行吗? 我的还是被检测到了, 你用的 chrome/driver 是什么版本的呀?
    KevinBu
        4
    KevinBu  
    OP
       Jul 30, 2019
    @Memento 是在 goto 后执行

    75.0.3770.142/75.0.3770.140
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2629 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 10:29 · PVG 18:29 · LAX 03:29 · JFK 06:29
    ♥ Do have faith in what you're doing.