Skip to content

Commit 4e787f8

Browse files
committed
Implemented a fix for puppeteer-extra plugins not working when using a proxy.
1 parent 1b0851d commit 4e787f8

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

lib/cjs/module/pageController.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,6 @@ function getRandomInt(min, max) {
1010

1111
async function pageController({ browser, page, proxy, turnstile, xvfbsession, pid, plugins, killProcess = false, chrome }) {
1212

13-
if (plugins.length > 0) {
14-
for (const plugin of plugins) {
15-
plugin.onPageCreated(page)
16-
}
17-
}
18-
1913
let solveStatus = turnstile
2014

2115
page.on('close', () => {
@@ -44,6 +38,12 @@ async function pageController({ browser, page, proxy, turnstile, xvfbsession, pi
4438

4539
if (proxy.username && proxy.password) await page.authenticate({ username: proxy.username, password: proxy.password });
4640

41+
if (plugins.length > 0) {
42+
for (const plugin of plugins) {
43+
plugin.onPageCreated(page)
44+
}
45+
}
46+
4747
await page.evaluateOnNewDocument(() => {
4848
Object.defineProperty(MouseEvent.prototype, 'screenX', {
4949
get: function () {

lib/esm/module/pageController.mjs

+6-6
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,6 @@ function getRandomInt(min, max) {
1010

1111
export async function pageController({ browser, page, proxy, turnstile, xvfbsession, pid, plugins, killProcess = false, chrome }) {
1212

13-
if (plugins.length > 0) {
14-
for (const plugin of plugins) {
15-
plugin.onPageCreated(page)
16-
}
17-
}
18-
1913
let solveStatus = turnstile
2014

2115
page.on('close', () => {
@@ -44,6 +38,12 @@ export async function pageController({ browser, page, proxy, turnstile, xvfbsess
4438

4539
if (proxy.username && proxy.password) await page.authenticate({ username: proxy.username, password: proxy.password });
4640

41+
if (plugins.length > 0) {
42+
for (const plugin of plugins) {
43+
plugin.onPageCreated(page)
44+
}
45+
}
46+
4747
await page.evaluateOnNewDocument(() => {
4848
Object.defineProperty(MouseEvent.prototype, 'screenX', {
4949
get: function () {

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "puppeteer-real-browser",
3-
"version": "1.3.11",
3+
"version": "1.3.12",
44
"description": "This package is designed to bypass puppeteer's bot-detecting captchas such as Cloudflare. It acts like a real browser and can be managed with puppeteer.",
55
"main": "lib/cjs/index.js",
66
"module": "lib/esm/index.mjs",

0 commit comments

Comments
 (0)