Is there a way to use Selenium WebDriver without informing the document that it is controlled by WebDriver?

后端 未结 1 1929
轻奢々
轻奢々 2020-11-30 15:49

I\'m automating an Web page who call a CAPTCHA to validate the login, but I noticed that this page only request this CAPTCHA when I\'m using my automatized test code, when I

相关标签:
1条回答
  • 2020-11-30 16:19

    No, there is no way to conceal that you are runing automated test.

    WebDriver Interface

    When using the WebDriver interface the webdriver-active flag is set to true as the user agent is under remote control. It is initially false.

    WebIDL

    Navigator includes NavigatorAutomationInformation;
    

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

    WebIDL

    interface mixin NavigatorAutomationInformation {
        readonly attribute boolean webdriver;
    };
    

    webdriver

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

    Example

    • For web authors :

      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.
      

    The above mentioned implementation is based on a couple of Security Considerations as follows:

    • A user agent can rely on a command-line flag or a configuration option to test whether to enable WebDriver, or alternatively make the user agent initiate or confirm the connection through a privileged content document or control widget, in case the user agent does not directly implement the HTTP endpoints.

    • It is strongly suggested that user agents require users to take explicit action to enable WebDriver, and that WebDriver remains disabled in publicly consumed versions of the user agent.

    • It is also suggested that user agents make an effort to visually distinguish a user agent session that is under control of WebDriver from those used for normal browsing sessions. This can be done through a browser chrome element such as a door hanger, colorful decoration of the OS window, or some widget element that is prevalent in the window so that it easy to identify automation windows.


    Reference

    You can find a couple of detailed discussion in:

    • Distil detects WebDriver driven Chrome Browsing Context
    • Selenium webdriver: Modifying navigator.webdriver flag to prevent selenium detection
    • Akamai Bot Manager detects WebDriver driven Chrome Browsing Context
    0 讨论(0)
提交回复
热议问题