Disable Edge Translation Popups in Puppeteer
In this article
This guide shows you how to stop Microsoft Edge from showing translation popups when automating with Puppeteer. By disabling these popups, your scripts run smoother without unexpected UI interruptions, especially when navigating non-English pages. You'll need a basic Puppeteer setup with Edge (or Chromium) and a Node.js environment.
What You'll Need
- Node.js installed (v12 or later)
- Puppeteer installed in your project (
npm install puppeteer) - Microsoft Edge (or Chromium) – Puppeteer can launch Edge with
puppeteer.launch({ executablePath: 'path/to/msedge' })
Step-by-Step
- Launch Edge with the correct flags. In your Puppeteer script, when calling
puppeteer.launch(), add the argument--disable-features=Translateto theargsarray. This disables the built-in translation feature entirely. - Set the locale to a single language. Add
--lang=en-US(or your preferred locale) to the sameargsarray. This prevents Edge from detecting a different language and offering translation. - Use a custom user data directory. Create a fresh profile by passing
userDataDir: './tmp-profile'in the launch options. This avoids any saved preferences that might re-enable the popup. - Override the Accept-Language header. Use
page.setExtraHTTPHeaders({ 'Accept-Language': 'en-US' })after creating a page. This tells the server you want English, reducing the chance of a translation prompt. - Block translation-related URLs (optional). If popups still appear, intercept requests to known translation endpoints. Add a
request interceptionin Puppeteer to abort requests containingtranslate.googleapis.comoredge.microsoft.com/translate. - Test your setup. Navigate to a non-English page, like
https://fr.wikipedia.org, and verify no popup appears.
Common Mistakes
- Forgetting the
--disable-features=Translateflag: This is the primary switch; without it, the translation feature remains active. - Using an existing user data directory: If you reuse a profile where translation was previously enabled, the popup may still appear. Always use a fresh directory.
- Not setting the language header: Even with the feature disabled, some sites may trigger a popup based on the request headers.
- Overlooking the
--langflag: Without it, Edge may default to a system locale that triggers translation.
Tips
- Combine all the flags in a single
argsarray for clarity. - If you're using Puppeteer with Chromium, the same flags work—just note that Edge is Chromium-based, so the behavior is identical.
- For a more robust solution, you can also disable the popup via Edge's preferences file in the user data directory, but the flags are simpler and more reliable.
- If your script runs in a CI environment, ensure the
--no-sandboxflag is added if needed, but that's unrelated to translation.
Troubleshooting
Popup still appears after following steps: First, verify that you're using the correct executable path for Edge. In some setups, Puppeteer might launch Chromium instead. Check the executablePath in your launch options. Also, ensure you're not using an existing profile that has translation enabled—delete the userDataDir folder and try again.
Edge doesn't launch with the flags: Some flags are only supported in certain versions. Update Edge and Puppeteer to the latest versions. Also, double-check the syntax of the args array—each flag should be a separate string.
Request interception doesn't block the popup: The popup might be generated client-side without a network request. In that case, rely on the --disable-features=Translate flag and the locale settings. If all else fails, you can use page.evaluate to click the 'Never translate' button if it appears, but that's a last resort.
Frequently Asked Questions
Does this work with Puppeteer's default Chromium?
Yes, the same flags work with Chromium. The translation feature is part of Chromium, so disabling it via flags works across both.
Will this affect other browser features?
No, disabling translation only removes the translation popup and the underlying translation service. Other browsing features remain unaffected.
Can I re-enable translation later in the same script?
No, the flags are set at launch time and cannot be changed during the session. If you need translation, launch a separate browser instance with different flags.
What if the popup appears on a specific site only?
That might be due to the site's own language detection. The --lang flag and Accept-Language header should help, but if it persists, try blocking the site's translation script via request interception.
Is there a way to disable the popup without launching Edge?
No, the flags must be passed at launch. However, you can set the user data directory to a pre-configured profile where translation is disabled, but that's more complex.
Does this work with Puppeteer's connect method?
No, connect attaches to an existing browser, so you cannot pass launch flags. You'd need to launch the browser externally with the flags and then connect.