有没有一种方法可以使用Selenium WebDriver而不通知文档它是由WebDriver控制的? [英] Is there a way to use Selenium WebDriver without informing the document that it is controlled by WebDriver?

查看:123
本文介绍了有没有一种方法可以使用Selenium WebDriver而不通知文档它是由WebDriver控制的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在自动执行一个调用CAPTCHA来验证登录名的网页,但是我注意到该页面仅在使用自动化测试代码时才请求此CAPTCHA,而当我手动执行时则不请求. 我要求开发人员团队在质量检查环境中将其禁用,但是通过安全代码是不可能的.

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 do it manually it don't request. I asked to developer team to disable it on the QA environment, but it's not possible by a security code.

我需要知道是否有一种方法可以对浏览器说我正在使用此页面上的自动测试.

I need to know if there is a way to don't say to browser that I'm using automated test on this page.

可以帮我吗?

推荐答案

,无法隐瞒您正在运行自动化测试.

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

使用 WebDriver界面 时,由于用户代理受远程控制,因此将webdriver-active标志设置为true.最初是错误的.

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;

请注意,NavigatorAutomationInformation界面不应在WorkerNavigator上公开.

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

WebIDL

interface mixin NavigatorAutomationInformation {
    readonly attribute boolean webdriver;
};

webdriver

  • 如果设置了webdriver-active标志,则返回true,否则返回false.

示例

  • 对于网络作者:

  • 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:

  • 用户代理可以依靠命令行标志或配置选项来测试是否启用WebDriver,或者通过特权内容文档或控制小部件使用户代理启动或确认连接,以防万一.用户代理不会直接实现HTTP端点.

  • 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.

强烈建议用户代理要求用户采取明确的措施来启用WebDriver,并且在用户使用的公共版本中,WebDriver保持禁用状态.

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.

还建议用户代理努力从视觉上区分WebDriver控制下的用户代理会话和用于正常浏览会话的用户代理会话.可以通过浏览器的chrome元素(例如门衣架,操作系统窗口的彩色装饰或该窗口中普遍使用的某些小部件元素)来完成此操作,以便轻松识别自动化窗口.

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.

您可以在以下位置找到一些详细的讨论:

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

这篇关于有没有一种方法可以使用Selenium WebDriver而不通知文档它是由WebDriver控制的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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