-
Notifications
You must be signed in to change notification settings - Fork 9k
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
[Bug]: waitForNavigation does not complete navigation when used with click #9924
Comments
The issue has been labeled as confirmed by the automatic analyser. |
Add await page.screenshot({ path: import puppeteer from 'puppeteer'
;(async () => {
const browser = await puppeteer.launch()
const page = await browser.newPage()
await page.setViewport({ width: 1280, height: 1024 })
await page.goto('https://github.com/coder-hxl/x-crawl/releases')
const navHandles = await page.$$('div[role="navigation"] [aria-label]')
for (let i = 1; i <= navHandles.length; i++) {
await page.screenshot({ path: `./upload/${i}-page.jpg` })
const tagContents = await page.$$eval(
'section .Box-body .wb-break-word a',
(aEls) => aEls.map((item) => item.innerHTML)
)
console.log(tagContents)
if (i < navHandles.length) {
await Promise.all([
page.waitForNavigation(),
page.click('div[role="navigation"] .next_page')
])
}
}
await browser.close();
})() |
I am unable to reproduce. All navigations happen without problem for me (the code was missing the browser.close() to exit):
|
@OrKoN After executing the navigation to the second page, I still get the content of the first page |
This might be due to the fact that GitHub does not always trigger a navigation and loads the page via SPA? You need to wait for the new page content instead of the navigation then. E.g.,
|
@OrKoN Appreciate your reply. |
Bug expectation
After executing the navigation to the second page, I still get the content of the first page,
Bug behavior
Minimal, reproducible example
Error string
no error
Puppeteer configuration
No response
Puppeteer version
v19.8.0
Node version
v19.0.0
Package manager
pnpm
Package manager version
v7.14.2
Operating system
Windows
The text was updated successfully, but these errors were encountered: