question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

navigator.webdriver cannot modify

See original GitHub issue

Steps to reproduce

Tell us about your environment:

  • Puppeteer version: 1.9.0
  • Platform / OS version: macOS High Sierra
  • URLs (if applicable):
  • Node.js version: 10.0.0

What steps will reproduce the problem?

Please include code that reproduces the issue.

1.create a new page

const page = await browser.newPage()

2.modify navigator webfriver value

const modifyWebdriver = () => {
    Object.defineProperty(navigator, 'webdriver', {
      get: function() {
        return false
      },
    })
  }

await page.evaluate(modifyWebdriver)

3.console .log(navigator.webdriver)

console.log(await page.evaluate('navigator.webdriver'))  // false

4.goto a website

await page.goto('https://www.google.com', {
    waitUntil: 'networkidle2',
    timeout: 3000000,
  })

5.console.log(navigator.webdrive)

console.log(await page.evaluate('navigator.webdriver'))  // true

What is the expected result? console.log(await page.evaluate(‘navigator.webdriver’)) // false

What happens instead? console.log(await page.evaluate(‘navigator.webdriver’)) // true

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5

github_iconTop GitHub Comments

20reactions
rockswangcommented, Jun 20, 2019

Simpler approch: const browser = await puppeteer.launch({ignoreDefaultArgs: [“–enable-automation”]});

12reactions
tzbocommented, Nov 6, 2018
await this.page.evaluateOnNewDocument(() => {
         Object.defineProperty(navigator, 'webdriver', {
         get: () => undefined,
    });
 }
Read more comments on GitHub >

github_iconTop Results From Across the Web

Selenium webdriver: Modifying navigator.webdriver flag to ...
First the update 1. execute_cdp_cmd() : With the availability of execute_cdp_cmd(cmd, cmd_args) command now you can easily execute ...
Read more >
Modifying navigator.webdriver flag to prevent selenium detection
I'm trying to automate a very basic task in a website using selenium and chrome but somehow the website detects when chrome is...
Read more >
Navigator.webdriver - Web APIs | MDN
Navigator.webdriver. The webdriver read-only property of the navigator interface indicates whether the user agent is controlled by automation.
Read more >
Make `navigator.webdriver === false` when automation is not ...
Currently, `navigator.webdriver === undefined` when automation is not enabled. In other browsers, it's `false` (and this matches the spec).
Read more >
Avoid bot detection not working with Selenium - Edureka
Hi, thank you for your answer. · All you have to do is open binary(chromedriver.exe) in hex editor, change string starting with $cdc...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found