Exposing navigator.webdriver

Implementations are currently meant to expose the navigator.webdriver
WebIDL attribute only when WebDriver is being used to control the
UA.  There is a proposal in [1] to make this unconditional so that
the attribute is always exposed.

To borrow Geoffrey’s example, making the attribute selectively
present doesn’t itself have any benefit apart from causing web
author confusion when for example a document needs to trigger an
alternate code path during automation:

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

Whereas with almost all other web platform features, one could:

 var underAutomation = navigator.webdriver;

Brian commented in [2] that Safari always exposes the attribute,
provided WebKit is built with WebDriver support.  This seems
reasonable to me and avoids web author confusion.  I’m inclined to
do the same for Gecko, for which I have a tentative implementation
[3].

Before shipping this in Firefox I’d like feedback from Microsoft
and Google.

  [1] https://github.com/w3c/webdriver/issues/1214
  [2] https://github.com/w3c/webdriver/issues/1214#issuecomment-361318854
  [3] https://bugzilla.mozilla.org/show_bug.cgi?id=1169290

Received on Friday, 2 February 2018 15:05:58 UTC