title: Selenium webdriver: Modifying navigator.webdriver flag to prevent selenium detection
body: <p>I'm trying to automate a very basic task in a website using selenium and chrome but somehow the website detects when chrome is driven by selenium and blocks every request. I suspect that the website is relying on an exposed DOM variable like this one <a href="https://stackoverflow.com/a/41904453/648236">https://stackoverflow.com/a/41904453/648236</a> to detect selenium driven browser. </p>
  
  <p>My question is, is there a way I can make the navigator.webdriver flag false? I am willing to go so far as to try and recompile the selenium source after making modifications, but I cannot seem to find the NavigatorAutomationInformation source anywhere in the repository <a href="https://github.com/SeleniumHQ/selenium" rel="noreferrer">https://github.com/SeleniumHQ/selenium</a></p>
  
  <p>Any help is much appreciated</p>
  
  <p>P.S: I also tried the following from <a href="https://w3c.github.io/webdriver/#interface" rel="noreferrer">https://w3c.github.io/webdriver/#interface</a></p>
  
  <pre><code>Object.defineProperty(navigator, 'webdriver', {
      get: () =&gt; false,
    });
  </code></pre>
  
  <p>But it only updates the property after the initial page load. I think the site detects the variable before my script is executed.</p>