Skip to content
Browse files

interface: expose navigator.webdriver unconditionally

The navigator.webdriver WebIDL attribute is currently only meant
to be exposed when the webdriver-active flag is true.  Safari and
Edge expose the attribute unconditionally, and Gecko plans to follow

Making the attribute selectively present, which is unlike any other
web features are implemented, forces web authors to detect automation
in the following way:

	var underAutomation = ("webdriver" in navigator) ? navigator.webdriver : false;

Following this patch, web authors can do this:

	var underAutomation = navigator.webdriver;

Fixes: #1214
  • Loading branch information...
andreastt authored and AutomatedTester committed Feb 2, 2018
1 parent 320745c commit a224627dcea6448367523bf0420de3d547946300
Showing with 32 additions and 16 deletions.
  1. +32 −16 webdriver-spec.html
@@ -768,32 +768,48 @@ <h2>Terminology</h2>
</section> <!-- /Terminology -->


<h2 data-dfn-for="NavigatorAutomationInformation">Interface</h2>

<p>If the <dfn>webdriver-active flag</dfn> is true,
the user agent must support <dfn>NavigatorAutomationInformation</dfn> interface:
The <dfn>webdriver-active flag</dfn>
is set to true when the user agent is under remote control.
It is initially false.

<pre class=idl>
Navigator includes NavigatorAutomationInformation;
<pre class=idl>
<a>Navigator</a> includes <a>NavigatorAutomationInformation</a>;

Note that the <a><code>NavigatorAutomationInformation</code></a> interface
should not be exposed on <a><code>WorkerNavigator</code></a>.

<pre class=idl>
interface mixin NavigatorAutomationInformation {
readonly attribute boolean webdriver; // always returns true
interface mixin <dfn>NavigatorAutomationInformation</dfn> {
readonly attribute boolean <a>webdriver</a>;

<p data-dfn-for="NavigatorAutomationInformation">Note that the <dfn>webdriver</dfn>
property should not be exposed on <code><a>WorkerNavigator</a></code>, and it must be
a getter that always returns true.
<dt><dfn data-lt=navigator-webdriver><code>webdriver</code></dfn>
<dd><p>Returns true if <a>webdriver-active flag</a> is true,
false otherwise.

<p>This property defines a standard way for a co-operating user agent to inform a website
that it is controlled by WebDriver.
<aside class=example>
For web authors (non-normative):

<p class="note" style="display: none">It is acknowledged that this is
complementary to the Evil Bit [[!RFC3514]].
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.

<p style="display: none">
It is acknowledged that this is complementary to the Evil Bit [[!RFC3514]].


0 comments on commit a224627

Please sign in to comment.
You can’t perform that action at this time.