Puppeteer Chrome is being controlled by automated test software

Viewed 3493

I tried a lot of answer about this question, some of that are deprecated. I want to remove "Puppeteer Chrome is being controlled by automated test software" advice.

My configuration is:

const args = [
        '--no-sandbox',
        '--enable-logging',
        '--disable-infobar',
        '--excludeSwitches',
        '--useAutomationExtension',
        '--enable-automation',
        ' --v=1',
        '--disable-gpu',
        '--disable-extension',
        '--disable-setuid-sandbox',
        '--disable-infobars',
        '--window-position=0,0',
        '--ignore-certifcate-errors',
        '--ignore-certifcate-errors-spki-list',
        '--no-default-browser-check',
        '--user-agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3312.0 Safari/537.36"',
        '--window-size="1200,880"'
    ];


    const options = {
        args,
        headless: false, // default is true
        excludeSwitches: 'enable-automation',
        userDataDir: "./user_data",
        defaultViewport: null,
        devtools: true,
        ignoreHTTPSErrors: true,
    };

But the advise is still on my browser. I'd like to know if this kind of advice can be displayed form the owner of the website, with some tools like hotjar (even the mouse movement)

1 Answers

There are some conflicting args between your args object and the options that you've set, make sure there are no unwanted ones listed.

The main reason it doesn't hide it: instead of excludeSwitches you should give an array of not desired switches in ignoreDefaultArgs:

Doesn't hide: ❌

const options = {
  args,
  headless: false, // default is true
  excludeSwitches: 'enable-automation',
  userDataDir: "./user_data",
  defaultViewport: null,
  devtools: true,
  ignoreHTTPSErrors: true,
};

Hides: ✔️

const options = {
  args,
  headless: false, // default is true
  ignoreDefaultArgs: ["--enable-automation"],
  userDataDir: "./user_data",
  defaultViewport: null,
  devtools: true,
  ignoreHTTPSErrors: true,
};

About your second question: no it is not depending on the owner of the actually visited site.

Note: it is not advised to hide this message as it is an important message for witnesses of the actual browser automation, so they won't log in to their bank account etc. with that browser instance.

Related