如何通过Python使用GeckoDriver和Firefox使Selenium脚本无法检测? [英] How to make Selenium script undetectable using GeckoDriver and Firefox through Python?

查看:195
本文介绍了如何通过Python使用GeckoDriver和Firefox使Selenium脚本无法检测?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法可以使用 geckodriver

使selenium脚本在python中无法检测到

我用硒刮.我们需要使用任何保护措施以使网站无法检测到硒吗?

解决方案

检测到硒驱动的 Firefox / GeckoDriver 的事实没有得到" t取决于任何特定的 GeckoDriver Firefox 版本. 网站本身可以检测网络流量,并且可以将浏览器客户端 Web浏览器标识为 WebDriver控制. /p>

根据最新编辑器中 WebDriver Interface 的文档 WebDriver-W3C Living Document 的草案, webdriver-active 最初设置为 false flag ,当用户代理受远程控制(即通过视口.

  • 如果您需要向网站发送多个请求,则需要继续更改每个请求的用户代理.在这里,您可以找到有关方法的详细讨论.更改Selenium中的Google Chrome用户代理?
  • 要模拟类似的行为,您甚至可能需要降低脚本执行速度,甚至超出如何休眠Webdriver的详细讨论python中的毫秒数
  • Is there any way to make your selenium script undetectable in python using geckodriver

    I'm using selenium for scraping. Is there any protections we need to use so websites can't detect selenium?

    解决方案

    The fact that selenium driven Firefox / GeckoDriver gets detected doesn't depends on any specific GeckoDriver or Firefox version. The Websites themselves can detect the network traffic and can identify the Browser Client i.e. Web Browser as WebDriver controled.

    As per the documentation of the WebDriver Interface in the latest editor's draft of WebDriver - W3C Living Document the webdriver-active flag which is initially set as false, is set to true when the user agent is under remote control i.e. when controlled through Selenium.

    Now that the NavigatorAutomationInformation interface should not be exposed on WorkerNavigator.

    So,

    webdriver
        Returns true if webdriver-active flag is set, false otherwise.
    

    where as,

    navigator.webdriver
        Defines a standard way for co-operating user agents to inform the document that it is controlled by WebDriver, for example so that alternate code paths can be triggered during automation.
    

    So, the bottom line is:

    Selenium identifies itself


    However some generic approaches to avoid getting detected while web-scraping are as follows:

    这篇关于如何通过Python使用GeckoDriver和Firefox使Selenium脚本无法检测?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    相关文章
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆