fix: Robust Cloudflare detection to prevent Playwright frame crashes
- src/cloudflare.js: Add try-catch around each locator operation in isCloudflareChallenge - src/cloudflare.js: Add waitForLoadState before checking for Cloudflare - src/cloudflare.js: Remove redundant outer try-catch (unreachable code) - epic-claimer-new.js: Add delay after page.goto before checking Cloudflare - epic-claimer-new.js: Wrap isChallenge() call in try-catch Fixes: TypeError: Cannot read properties of undefined (reading 'childFrames')
This commit is contained in:
parent
23ca522094
commit
f1d647bcb2
2 changed files with 37 additions and 14 deletions
|
|
@ -183,16 +183,24 @@ const ensureLoggedIn = async (page, context) => {
|
|||
if (!cfg.debug) context.setDefaultTimeout(cfg.login_timeout);
|
||||
await page.goto(URL_CLAIM, { waitUntil: 'domcontentloaded' });
|
||||
|
||||
if (await isChallenge()) {
|
||||
console.warn('Cloudflare challenge detected. Attempting to solve with FlareSolverr...');
|
||||
const solved = await solveCloudflareChallenge();
|
||||
if (solved) {
|
||||
await page.goto(URL_CLAIM, { waitUntil: 'domcontentloaded' });
|
||||
// Small delay to let page stabilize before checking for Cloudflare
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
try {
|
||||
if (await isChallenge()) {
|
||||
console.warn('Cloudflare challenge detected. Attempting to solve with FlareSolverr...');
|
||||
const solved = await solveCloudflareChallenge();
|
||||
if (solved) {
|
||||
await page.goto(URL_CLAIM, { waitUntil: 'domcontentloaded' });
|
||||
continue;
|
||||
}
|
||||
await notify('epic-games (new): Cloudflare challenge, please solve manually in browser.');
|
||||
await page.waitForTimeout(cfg.login_timeout);
|
||||
continue;
|
||||
}
|
||||
await notify('epic-games (new): Cloudflare challenge, please solve manually in browser.');
|
||||
await page.waitForTimeout(cfg.login_timeout);
|
||||
continue;
|
||||
} catch (err) {
|
||||
console.warn('Error checking Cloudflare challenge:', err.message);
|
||||
// Continue with login attempt anyway
|
||||
}
|
||||
|
||||
const logged = await attemptAutoLogin();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue