Navigation after click not working regardless of actions I take
See original GitHub issueSteps to reproduce
Tell us about your environment:
- Puppeteer version: 1.11
- Platform / OS version: WSL (openSUSE on Windows)
- URLs (if applicable): -
- Node.js version: 10
What steps will reproduce the problem?
So in pure text what I am trying:
- Click a button.
- Wait until navigation loads. Or simply put - link changes.
- Fetch url.
- In different incognito browser go to the link and do other actions.
Unfortunately, because I need to fetch the link I can’t use waitForSelector. So I am stuck with navigation and the headache all of that causes. Url is a casual link with dynamically generated ID that I can’t access otherwise.
Code:
await helpers.click(mainUserPage, '#RematchButton');
await mainUserPage.waitForNavigation({waitUntil: "networkidle0"});
let gameUri = mainUserPage.url();
await weakerUserPage.goto(gameUri, {
waitUntil: ['load']
});
helpers.click:
async function click(page, button) {
try {
await page.waitForSelector(button, {visible: true});
await page.click(button);
} catch (e) {
console.log(e);
}
}
I tried Promise.all([]) - didn’t help at all. So really I don’t know what to do with that. I am sure navigation causes the headache as without the line button is clicked and navigation is done, just wrong url is fetched.
What is the expected result? Navigation
What happens instead? Blockage
Issue Analytics
- State:
- Created 5 years ago
- Comments:15 (4 by maintainers)
Top Results From Across the Web
javascript - How do I handle a click anywhere in the page ...
One possible solution is to handle the mouseup event instead, since event order for clicks is: mousedown; mouseup; click. If you can be...
Read more >Navigate to a destination - Android Developers
Navigating to a destination is done using a NavController , an object that manages app navigation within a NavHost .
Read more >Back and Navigate functions in Power Apps - Microsoft Learn
Use the Back and Navigate function to change which screen is displayed. For example, set the OnSelect property of a button to a...
Read more >How To Fix Google Maps Not Working - Alphr
Google Maps has become a powerful means for navigation. Hence, when the app isn't working, it can cause many issues or even crash...
Read more >Building Accessible Menu Systems - Smashing Magazine
You should only change this state on click, not on focus. ... Navigation submenus (or "dropdowns" to some) work well with a mouse...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Alright another update. After changing navigation lines to:
and using it instead of built-in click method surprisingly the code works 100% and never stops at navigation. Otherwise when there’s a conflict between click redirect & navigation there are ALWAYS problems.
Overall puppeteer is a great library but page.click is one huge headache. Even the method itself sometimes works, sometimes it doesn’t… really weird thing.