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 still can be detected

See original GitHub issue
const puppeteer = require('puppeteer-extra')
const StealthPlugin = require('puppeteer-extra-plugin-stealth')
puppeteer.use(StealthPlugin())

puppeteer.launch({ headless: true }).then(async browser => {
    const page = await browser.newPage()
    page.on('console', msg => console.log(msg.text()))
    await page.goto('https://bot.sannysoft.com')
    await page.evaluate(async () => {
        console.log('webdriver' in navigator ? 'detected': 'not detected')
        console.log(navigator.webdriver === undefined ? 'not detected': 'detected')
        // but!
        console.log(Object.getOwnPropertyDescriptor(navigator.__proto__, 'webdriver') === undefined ? 'not detected': 'detected once')
        for (let prop in navigator) {
            if (prop === 'webdriver') {
                console.log('detected twice')
            }
        }
    });

    await browser.close()
})
const newProto = navigator.__proto__;
delete newProto.webdriver;
navigator.__proto__ = newProto

was more correct way to remove webdriver from navigator.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:19 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
Niekcommented, Jun 11, 2020

There is no way __proto__ will get deleted from Chrome anytime soon, it will break too many sites. But in case it will, this works as well:

delete Object.getPrototypeOf(navigator).webdriver;
0reactions
codeexcommented, Jan 4, 2021

very good! delete navigator.__proto__.webdriver;

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 >
Navigator.webdriver - Web APIs | MDN
The webdriver read-only property of the navigator interface indicates whether the user agent is controlled by automation.
Read more >
Preventing Selenium from being detected - LinkedIn
I've been testing Selenium with Chromedriver and discovered that some pages may identify that you're using Selenium even if there is no ...
Read more >
Detecting Selenium Chrome - Security Boulevard
A straightforward and well-known approach to detecting Selenium is to test if navigator.webdriver is equal to true. However, while navigator.
Read more >
Detecting Selenium Chrome - DataDome
webdriver is equal to true. However, while navigator.webdriver = true indicates the presence of a bot, it will also catch bots instrumented with ......
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