I’m running into a problem when trying to use Chrome’s built-in translation feature through Puppeteer while connected to a proxy that requires authentication. The browser keeps showing an error message saying the page cannot be translated.
Here’s my current setup:
const puppeteer = require('puppeteer');
const proxyConfig = {}; // proxy configuration object
const browserInstance = await puppeteer.launch({
headless: false,
ignoreDefaultArgs: true,
args: [
...puppeteer.defaultArgs({ headless: false }).map(argument => {
if (argument.startsWith('--disable-features')) {
return argument.replace('Translate,', '');
}
return argument;
}),
`--proxy-server=${proxyConfig.host}:${proxyConfig.port}`
]
});
browserInstance.on('targetcreated', async (newTarget) => {
if (newTarget.type() === 'page') {
const pageInstance = await newTarget.page();
await pageInstance.authenticate({
username: proxyConfig.user,
password: proxyConfig.pass,
});
}
});
The translation feature tries to activate but fails every time. Are there specific Chrome flags or Puppeteer settings I should add to make the translation service work correctly with proxy authentication?