page.url() does not reflect pushstate-driven updates...
See original GitHub issueSteps to reproduce
Tell us about your environment:
- Puppeteer version: 0.13.0
- Platform / OS version: macOS 10.13.2
- Node.js version: 8.9.4
What steps will reproduce the problem?
i’ve tried a couple of approaches:
await Promise.all([
page.waitForNavigation(), // also w/ the { waitUntil: 'networkidle2' } option
page.click(<anchor tag selector>)
]);
// alternately, i've tried:
// await page.click(<anchor tag selector>);
// await page.waitFor(3000);
expect(page.url()).toBe(<expected url>); // fails w/ old url - as though the page never navigated
when i use puppeteer.launch({ headless: false, slowMo: 1000 });
to debug things, i’m able to observe the navigation happening so the page.click()
bit seems to be working.
What is the expected result?
assertion shown above succeeds
What happens instead?
assertion shown above fails w/ old url as though the page never navigated
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
page.url() does not reflect pushstate-driven updates... #1736
i suppose a related but slightly off-topic question is: does page.waitForNavigation() handle pushstate-driven (history api) navigation changes?
Read more >history.pushState does not update url for "share ..." button on ...
button on the Chrome menu, the old URL (before calling history.pushState) is shared instead. Am I missing anything and how can I fix...
Read more >history.replaceState() does not refresh :target in Internet Explorer
pushState() in Internet Explorer, the URL gets updated correctly but the actual screen does not get updated to reflect the new URL.
Read more >Manually setting history state - Hotwire Discussion
Hey! I have an index page which is filterable by typing into a search input. 500ms after the user stopped typing, the app...
Read more >How to update the browser URL without refreshing the page ...
pushState() method can be used to push a new entry into the browser's history—and as a result, update the displayed URL—without refreshing ...
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
@busticated yes, the same root issue: Devtools protocol operates in terms of browser navigations and doesn’t take history API into account.
@aslushnikov ok but what about
page.url()
? that was the main point with this issue - it seems to always return whatever the original url was. is this also related to the spotty history api support?