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

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

  •  
  •   KevinBu · 2019-06-12 10:57:23 +08:00 · 2928 次点击
    这是一个创建于 1752 天前的主题,其中的信息可能已经有所发展或是发生改变。

    执行的 JS:

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

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

    弹出的结果的确为 false

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

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

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

    4 条回复    2019-07-30 09:23:09 +08:00
    KevinBu
        1
    KevinBu  
    OP
       2019-06-12 11:10:52 +08:00
    刚刚解决了😂

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

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

    75.0.3770.142/75.0.3770.140
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5405 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 08:39 · PVG 16:39 · LAX 01:39 · JFK 04:39
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.