Search code examples
seleniumfirefoxfirefox-addongeckodriver

Change Mozilla readonly attribute


Is it possible to change Mozilla's readonly attributes: Specifically changing:

navigator.webdriver = false;
//changing it from true to false;

I know changing the dom.webdriver.enabled value in the about config removes the navigator.webdriver variable, however I would like for the following outcome to be true

navigator.webdriver === false;
//should return true

It's worth mentioning that by default the value is always false, but when running Firefox with Selenium the value changes to true I am open for any methods, since I have full control of both the browser:Mozilla and the browser profile. Hopefully I won't need to recompile Firefox.


Solution

  • run Object.defineProperty(navigator, "webdriver", {value: false}) in the page's context.