How to Disable Both Password Manager and Info Header in Puppeteer

When using Puppeteer to automate browser tasks, you may encounter a need to disable both the password manager popup and the “Chrome is being controlled by automated test software” info header. Achieving this can be a bit tricky since the solutions for each issue might interfere with one another. Here’s how you can disable both effectively.

Understanding the Problem

Password Manager Popup: This popup appears when Chrome prompts you to save passwords. Disabling it can be achieved using the --password_manager_enabled=false argument.

Info Header: This message appears at the top of the browser window indicating that the browser is being controlled by automated test software. This can be disabled using the ignoreDefaultArgs option with the --enable-automation flag.

Combined Solution

To disable both the password manager popup and the info header, you need to combine the appropriate settings. Here’s how you can do it:

Step-by-Step Solution

  1. Install Puppeteer: First, ensure that Puppeteer is installed in your project. If not, install it using npm:
    bash
    npm install puppeteer
  2. Launch Puppeteer with Combined Settings: You need to use both args and ignoreDefaultArgs options in puppeteer.launch. Here’s the code to achieve both:
    javascript
    const puppeteer = require('puppeteer');
    
    (async () => {
      const browser = await puppeteer.launch({
        args: [
          '--password_manager_enabled=false',
          '--no-sandbox',  // Optional: Other arguments you might need
          '--disable-setuid-sandbox'
        ],
        ignoreDefaultArgs: ['--enable-automation']
      });
    
      const page = await browser.newPage();
      await page.goto('https://example.com');  // Replace with your target URL
    
      // Perform your automation tasks here
    
      await browser.close();
    })();
    

Explanation

  • args: This array includes --password_manager_enabled=false to disable the password manager popup.
  • ignoreDefaultArgs: This array includes --enable-automation to remove the “Chrome is being controlled by automated test software” message.

Additional Tips

  • Ensure Compatibility: Some versions of Puppeteer and Chrome might handle these flags differently. Always check the Puppeteer documentation for updates.
  • Test Thoroughly: After setting up, thoroughly test your automation script to ensure both the password manager popup and info header are disabled as expected.

By combining these settings, you can achieve a clean, distraction-free browser automation experience with Puppeteer. This approach allows you to maintain control over the browser without unnecessary prompts or messages interfering with your tasks.

Reference

https://pptr.dev/api/puppeteer.launchoptions

How can I get rid of this change password warning (It's on a private site that can't be reached without private key/password)
byu/jm0112358 inchrome


https://stackoverflow.com/questions/72878107/in-the-website-login-chrome-found-the-password-you-just-used-in-a-data-breach