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.

can't set webdriver

See original GitHub issue

my environment:

  • Puppeteer version: 5.5.0
  • Platform / OS version: win10 x64
  • URLs (if applicable):
  • Node.js version: v14.15.0

What steps will reproduce the problem?

let browser = await puppeteer.launch({
    ignoreDefaultArgs: ['--enable-automation']
});
let page = (await browser.pages())[0];
await page .evaluateOnNewDocument(() => {
        Object.defineProperty(window.navigator, 'webdriver', {
          get: () => false,
        });
      });
await this.currentPage.goto('https://www.baidu.com');

When I execute the above code, I get the following error

VM50:6 Uncaught TypeError: Cannot redefine property: webdriver
    at Function.defineProperty (<anonymous>)
    at <anonymous>:6:28
    at <anonymous>:10:19
(anonymous) @ VM50:6
(anonymous) @ VM50:10

I don’t know what caused it

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:6
  • Comments:10

github_iconTop GitHub Comments

14reactions
vabalycommented, Jan 31, 2021

You can try to add argument --disable-blink-features=AutomationControlled when launch the browser:

const browser = await launch({
    // ...
    ignoreDefaultArgs: ['--enable-automation'],
    args: ['--disable-blink-features=AutomationControlled'],
    // ...
 })

It works to me

2reactions
qujinqiangcommented, Jan 28, 2021

same to me, chrome version 88.0.4324.96

Read more comments on GitHub >

github_iconTop Results From Across the Web

chrome Webdriver can't be resolved to a type error eclipse ...
chrome Webdriver can't be resolved to a type error eclipse and java:- ... Right click on Project>Buildpath>configure build path ...
Read more >
How to solve "Webdriver cannot be resolved to a type" Error in ...
In this video it shows how one can resolve the " Webdriver cannot be resolved to a type" error while working with selenium...
Read more >
Fixing Selenium WebDriver Executable Path Error - Baeldung
1. Overview ... In this tutorial, we'll take a look at the common Selenium error: “The path to the driver executable must be...
Read more >
Install browser drivers - Selenium
Through WebDriver, Selenium supports all major browsers on the market such as Chrome/Chromium, Firefox, Internet Explorer, Edge, and Safari.
Read more >
Chrome doesn't start or crashes immediately - ChromeDriver
While it is possible to work around this issue by passing '--no-sandbox' flag when creating your WebDriver session, such a configuration is unsupported...
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