When using geckodriver "navigator.webdriver" returns "false"
Categories
(Remote Protocol :: Marionette, defect, P1)
Tracking
(firefox-esr68 unaffected, firefox75 wontfix, firefox76 fixed, firefox77 fixed)
Tracking | Status | |
---|---|---|
firefox-esr68 | --- | unaffected |
firefox75 | --- | wontfix |
firefox76 | --- | fixed |
firefox77 | --- | fixed |
People
(Reporter: jacktheripper1990, Assigned: whimboo)
References
(Regression)
Details
(Keywords: regression)
Attachments
(3 files)
6.39 KB,
text/plain
|
Details | |
47 bytes,
text/x-phabricator-request
|
RyanVM
:
approval-mozilla-beta+
|
Details | Review |
47 bytes,
text/x-phabricator-request
|
RyanVM
:
approval-mozilla-beta+
|
Details | Review |
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.113 Safari/537.36
Steps to reproduce:
Opened a page using Selenium via Python binding
Actual results:
navigator.webdriver returns false
Expected results:
navigator.webdriver should true
Assignee | ||
Comment 1•3 years ago
|
||
As filed this lacks various information:
- Which version of Firefox, geckodriver and Selenium has been used?
- A minimized Selenium script
- A trace log
Reporter | ||
Comment 2•3 years ago
|
||
Run on MacOS Catalina 10.15.4 - Firefox: 75.0 (64-bit) - geckodriver 0.26.0 - Selenium: pip package, version 3.141.0 - Script: ```python from selenium import webdriver profile = webdriver.FirefoxProfile() profile.set_preference("devtools.console.stdout.content", True) profile.update_preferences() driver = webdriver.Firefox(firefox_profile=profile) driver.get("https://example.com") driver.execute_script("console.warn(\"Webdriver value: \" + navigator.webdriver)") ``` Trace log ``` in geckodriver.log: `console.log: "Webdriver value: false"`
Reporter | ||
Comment 3•3 years ago
|
||
Run on MacOS Catalina 10.15.4
- Firefox: 75.0 (64-bit)
- geckodriver 0.26.0
- Selenium: pip package, version 3.141.0
- Script:
from selenium import webdriver
profile = webdriver.FirefoxProfile()
profile.set_preference("devtools.console.stdout.content", True)
profile.update_preferences()
driver = webdriver.Firefox(firefox_profile=profile)
driver.get("https://example.com")
driver.execute_script("console.warn(\"Webdriver value: \" + navigator.webdriver)")
in geckodriver.log: console.log: "Webdriver value: false"
Trace log attached.
Assignee | ||
Comment 4•3 years ago
|
||
Thanks. I can actually confirm that behavior with geckodriver, but using Marionette directly seems to work:
1587668131698 Marionette DEBUG 3 -> [0,3,"WebDriver:ExecuteScript",{"script":"return navigator.webdriver","newSandbox":true,"args":[],"filename":"_a/test_minimized.py","sandbox":"default","line":51}]
1587668131707 Marionette DEBUG 3 <- [1,3,null,{"value":true}]
With geckodriver the invocation of the command looks like:
1587667905065 Marionette DEBUG 0 -> [0,3,"WebDriver:ExecuteScript",{"args":[],"script":"return navigator.webdriver"}]
1587667905082 Marionette DEBUG 0 <- [1,3,null,{"value":false}]
Using new_sandbox
or sandbox
as arguments doesn't matter. There is something else which prevents it from returning true
.
Assignee | ||
Comment 5•3 years ago
|
||
Actually it regressed by bug 1622012 for Firefox 75. Lets get if we can get this fix into 76, and create a webdriver test for it.
Assignee | ||
Comment 6•3 years ago
|
||
Specifically the change in https://hg.mozilla.org/mozilla-central/rev/0656956fe08b caused it. I'll check that tomorrow.
Assignee | ||
Updated•3 years ago
|
Assignee | ||
Comment 7•3 years ago
|
||
Workaround for now is to set the marionette.enabled
preference to True
. I still wonder why the marionette client itself is not affected by that.
Assignee | ||
Comment 8•3 years ago
|
||
Now that we read the pref only once and then determine the enabled state of Marionette based on the environment variable or command line argument, we do not write the marionette.enabled
pref anymore. As such the following code fails:
I would suggest that we get an instance of the marionette component and retrieve the actual enabled state.
Assignee | ||
Comment 9•3 years ago
|
||
(In reply to Henrik Skupin (:whimboo) [⌚️UTC+2] from comment #8)
I would suggest that we get an instance of the marionette component and retrieve the actual enabled state.
For a short-term fix lets get the preference updated, and fix it properly by removing it completely as stated above. I filed bug 1632821 as follow-up.
Assignee | ||
Comment 10•3 years ago
|
||
Assignee | ||
Comment 11•3 years ago
|
||
Comment 12•3 years ago
|
||
Pushed by hskupin@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/14f317d6d48d [marionette] "navigator.webdriver" has to reflect the enabled state of Marionette. r=marionette-reviewers,maja_zf https://hg.mozilla.org/integration/autoland/rev/2e8129581f3f [wdspec] Added webdriver test for navigator.webdriver being enabled. r=maja_zf
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/23236 for changes under testing/web-platform/tests
Upstream web-platform-tests status checks passed, PR will merge once commit reaches central.
Upstream PR merged by moz-wptsync-bot
Comment 16•3 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/14f317d6d48d
https://hg.mozilla.org/mozilla-central/rev/2e8129581f3f
Assignee | ||
Comment 18•3 years ago
|
||
Comment on attachment 9143085 [details]
Bug 1632556 - [marionette] "navigator.webdriver" has to reflect the enabled state of Marionette.
Beta/Release Uplift Approval Request
- User impact if declined: User agents under control by WebDriver have to inform the document that it is under automation. This broke with bug 1622012 and always returns
false
since Firefox 75. - Is this code covered by automated tests?: Yes
- Has the fix been verified in Nightly?: Yes
- Needs manual test from QE?: No
- If yes, steps to reproduce:
- List of other uplifts needed: None
- Risk to taking this patch: Low
- Why is the change risky/not risky? (and alternatives if risky): The check depends on the
marionette.enabled
preference, which we forgot to set by the changes on bug 1622012. This patch simply re-adds that setting. A patch to get rid of the preference will be followed upon by bug 1632821. - String changes made/needed: none
Assignee | ||
Updated•3 years ago
|
Comment 19•3 years ago
|
||
Comment on attachment 9143085 [details]
Bug 1632556 - [marionette] "navigator.webdriver" has to reflect the enabled state of Marionette.
Re-adds a preference check which was erroneously removed. Approved for 76.0rc1.
Updated•3 years ago
|
Comment 20•3 years ago
|
||
bugherder uplift |
Updated•3 years ago
|
Updated•4 months ago
|
Description
•