Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

page.waitForURL: Navigation failed because page was closed! #58

Closed
sealldeveloper opened this issue Feb 13, 2023 · 4 comments
Closed

page.waitForURL: Navigation failed because page was closed! #58

sealldeveloper opened this issue Feb 13, 2023 · 4 comments

Comments

@sealldeveloper
Copy link

When logging into prime gaming I get this error:

page.waitForURL: Navigation failed because page was closed!
=========================== logs ===========================
waiting for navigation to "https://gaming.amazon.com/home?signedIn=true" until "load"
============================================================
    at file:///.../free-games-claimer/prime-gaming.js:83:16

No idea why.

@vogler
Copy link
Owner

vogler commented Feb 13, 2023

Can you provide more context?
Did you sign in via the terminal or browser or not at all?
This line should just wait until you're logged in.

await page.waitForURL('https://gaming.amazon.com/home?signedIn=true');

Did you close the page or kill the script? Then this is normal.

@sealldeveloper
Copy link
Author

Can you provide more context?
Did you sign in via the terminal or browser or not at all?
This line should just wait until you're logged in.

await page.waitForURL('https://gaming.amazon.com/home?signedIn=true');

Did you close the page or kill the script? Then this is normal.

I entered correct account details, I entered the details in the terminal email and password sections. I did not use browser mode as headless mode isn't being used and adding the show parameter after didn't change the result either. I didn't close the page or kill the script.

The script fails once I enter the details.

No clue...

@sealldeveloper
Copy link
Author

Here is a complete (censored) output:

2023-02-14 01:40:47.537 started checking prime-gaming
Not signed in anymore.
Press ESC to skip if you want to login in the browser (not possible in default headless mode).
√ Enter email ... example@example.com
√ Enter password ... ***







page.waitForURL: Navigation failed because page was closed!
=========================== logs ===========================
waiting for navigation to "https://gaming.amazon.com/home?signedIn=true" until "load"
============================================================
    at file:///.../free-games-claimer/prime-gaming.js:83:16

Pressing ESC to go to the browser has this result (with the command node prime-gaming show):

2023-02-14 01:42:10.298 started checking prime-gaming
Not signed in anymore.
Press ESC to skip if you want to login in the browser (not possible in default headless mode).
× Enter email ...
Waiting for you to login in the browser.
Please run `node prime-gaming show` to login in the opened browser.

as default headless mode is what is currently running.

@vogler vogler closed this as completed in acbfa91 Feb 14, 2023
@vogler
Copy link
Owner

vogler commented Feb 14, 2023

page.waitForURL('**/ap/signin**').then(async () => { // check for wrong credentials
const error = await page.locator('.a-alert-content').first().innerText();
if (!error.trim.length) return;
console.error('Login error:', error);

This got an empty text even for successful logins which made it quit. Should be fixed now.

Also updated the outdated text - to show the browser it's now SHOW=1 node prime-gaming.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants