Open serzz1990 opened 2 years ago
@serzz1990 which proxy provider did you used? and proxy.host it's a real IP or a server hostname?
(node:2568) UnhandledPromiseRejectionWarning: Error: net::ERR_TOO_MANY_REDIRECTS at https://mail.google.com/mail/u/1/?tab=wm#inbox
Node Version: 14.15.2 OS: Windows 10 x64
Sample Code:
// cjs
const {FakeBrowser} = require('fakebrowser');
// esm
// import {FakeBrowser} from 'fakebrowser';
// import {createRequire} from 'module';
// const require = createRequire(import.meta.url);
const path = require('path')
const userDataDir = path.resolve(__dirname, './fakeBrowserUserData')
!(async () => {
// [Optional]: Select a fake device description
const windowsDD = require('./node_modules/fakebrowser/device-hub-demo/Windows.json');
const builder = new FakeBrowser.Builder()
// [Optional]: Set the fake device description
.deviceDescriptor(windowsDD)
// [Optional]: Show user action layers
// .displayUserActionLayer(true)
// [Optional]: Set startup options (https://pptr.dev/#?product=Puppeteer&show=api-puppeteerlaunchoptions)
.vanillaLaunchOptions({
headless: false,
// executablePath: '/Applications/Google Chrome 93.0.4577.82.app/Contents/MacOS/Google Chrome',
userDataDir,
})
// Must be set: path to save user data
// We will create a fake device description (fake browser fingerprint) and save the browser's user cache information to this folder.
// Note: Once the fake browser fingerprint is created, it will not change, just like a normal user using the browser.
// If you want to get a different browser fingerprint, see demo2.
.userDataDir(userDataDir);
const fakeBrowser = await builder.launch();
// vanillaBrowser is a puppeteer.Browser object
const page = await fakeBrowser.vanillaBrowser.newPage();
await page.goto('https://mail.google.com/mail/u/1/?tab=wm#inbox', {waitUntil: 'networkidle0'});
// ***** Do something automatic *****
// Don't forget to close your browser to release resources
await fakeBrowser.shutdown();
})();
As my experiences with puppeteer and this repository this problem appears when switching user agent too mobile and using regular sock5 ipv4 proxy. I think this problem not releated with this repo
ERR_TOO_MANY_REDIRECTS error occurs when opening google.com or youtube.com with a proxy. The problem is not observed when using the original puppeteer and puppeteer-extra, also when using fakebrowser without a proxy.