Disable Chrome Spell Check in Puppeteer: Step-by-Step
In this article
This guide explains how to disable Chrome's built-in spell check when using Puppeteer for browser automation. You'll learn both the standard Puppeteer launch flag method and the enterprise-level approach using Chrome policies, which is useful for managed environments or when you need consistent settings across many instances. No prior knowledge of Chrome policies is required, but you should be comfortable editing JSON and JavaScript files.
What You'll Need
- Node.js and npm installed on your machine
- A project with Puppeteer installed (npm install puppeteer)
- Access to a text editor or IDE
- For enterprise methods: ability to edit Chrome policy files (on Windows, macOS, or Linux)
Step-by-Step
Method 1: Using Puppeteer Launch Arguments (Per-Instance)
- Open your Puppeteer script where you launch the browser (e.g.,
puppeteer.launch()). - Add the
--disable-spell-checkingflag to theargsarray in the launch options. Example:const browser = await puppeteer.launch({ args: ['--disable-spell-checking'] }); - Also add
--disable-features=Spellcheck(optional but recommended for some Chrome versions). This disables the underlying spellcheck feature entirely. - Save and run your script. The spell check should be off for all pages opened by this browser instance.
Method 2: Using Chrome Policies (Enterprise-Wide)
- Identify your operating system and locate the Chrome policy directory:
- Windows:
HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Chrome(orHKEY_CURRENT_USERfor user-level) - macOS:
/Library/Managed Preferences/com.google.Chrome.plist(system) or~/Library/Preferences/com.google.Chrome.plist(user) - Linux:
/etc/opt/chrome/policies/managed/(system) or~/.config/chrome/policies/managed/(user)
- Windows:
- Create or edit a policy file with the key
SpellcheckEnabledset tofalse. For JSON-based policies (Linux and Windows via registry), the structure is:{ "SpellcheckEnabled": false } - Apply the policy by restarting Chrome. For Puppeteer, ensure it launches with the same user profile that has the policy applied. You can specify a user-data-dir that already has the policy, or use the system-wide policy.
- Launch Puppeteer with the policy in place. If you're using a custom profile, copy the policy files into the profile's
Preferencesfile or use the system policy. For testing, you can set the--user-data-dirto a directory where you've manually placed the policy.
Method 3: Using Puppeteer's userDataDir with a Preconfigured Profile
- Create a Chrome profile manually by launching Chrome with a temporary user-data-dir, disabling spell check via settings (Settings > Languages > Spell check), and closing Chrome.
- Use that profile in Puppeteer by setting
userDataDirin launch options:const browser = await puppeteer.launch({ userDataDir: '/path/to/your/profile' }); - Verify spell check is off by typing in a text field on a test page.
Common Mistakes
- Forgetting to include the flag in the correct place: The
argsarray must be passed tolaunch(), not topage.goto()or other methods. - Using a flag that doesn't exist: Some flags are version-specific.
--disable-spell-checkingworks in most modern Chrome versions, but if it doesn't, try--disable-features=Spellcheck. - Policy not taking effect: Chrome policies sometimes require a full restart of the browser, not just a new tab. Also, ensure the policy is in the correct location and has the right file permissions.
- Mixing user-level and system-level policies: If both exist, the more restrictive one wins. Make sure you're editing the one that applies to your Puppeteer instance.
Tips
- Test with a simple page: Create an HTML file with a textarea and check if the red squiggly lines appear when typing misspelled words.
- Combine methods: For maximum reliability, use both the launch flag and a policy, especially in enterprise environments.
- Keep a list of flags: If you need other Chrome flags, maintain a central config file in your project.
- Use
headless: falsefor debugging: See the browser window to visually confirm spell check is off.
Troubleshooting
Spell check still appears: If the red squiggles persist, try these steps in order:
- Check that you're using the latest Puppeteer and Chrome versions.
- Add both flags:
--disable-spell-checkingand--disable-features=Spellcheck. - Verify the policy is loaded by navigating to
chrome://policyin the browser (if you can open it manually). - Clear the user-data-dir and start fresh, as old profile settings may override.
Chrome won't start with the flag: Some flags conflict with others. Remove any other custom args and test one by one.
Policy file not recognized: Ensure the file is named correctly (e.g., spellcheck.json on Linux) and has proper JSON syntax. On Windows, the registry key must be a DWORD value.
Frequently Asked Questions
Does disabling spell check affect other features?
No, it only disables the spell check underline and suggestions. Other text features like autocorrect (if enabled) are separate.
Can I disable spell check for only certain pages?
No, the launch flag or policy applies to the entire browser instance. To have different settings, you'd need separate browser instances.
Will this work with Puppeteer's stealth plugin?
Yes, the flags are passed at the browser level and do not interfere with stealth plugins.
Is there a way to disable spell check via the DevTools protocol?
Not directly. The DevTools protocol does not expose a spell check toggle. You must use launch flags or policies.
How do I know if the policy is applied?
Open chrome://policy in a manual Chrome session with the same profile and check for the SpellcheckEnabled policy.
What if I'm using Puppeteer in a Docker container?
Pass the same launch flags inside the container. For policies, mount a volume with the policy file into the container's Chrome policy directory.