page.waitForSelector timeout & ExecutionContext.evaluateHandle hanging
See original GitHub issue- Puppeteer version: 1.11.0
- Platform / OS version: 10.14.3
- Node.js version: 11.6.0
when it appear
I have some operations like pagination retrieval that take a long time, page.waitForSelector will throw “timeout error” event if there is element on the page, it seem like the session is closed or connection is closed but no any reject error tell.
What is the expected result?
Here is an example:
async function click(selector, page) {
try {
await page.waitForSelector(selector , {
timeout: 1000
})
await page.click(selector)
} catch (err) {
throw err
}
}
async function recordPrice(id, page) {
try {
await click(`.search_Table .bgcolor:nth-child(${id + 1}) .link`, page)
await Promise.all([
page.waitForSelector('.aui_state_focus', {
timeout: 6000
}),
page.waitForSelector('.aui_dialog .table_list tbody tr:nth-child(2)', {
timeout: 6000
})
])
} catch (err) {
if (err.message.includes('No node found for selector') || err.message.includes('.search_Table')) {
return false
}
throw err
}
}
// ...
let prices = [];
for (let id = 0; id < feeLength; id++) {
prices.push(await recordPrice(id, page))
}
// ...
the click function inside recordPrice should not throw any error
What happens instead?
after recordPrice called multiple times, page.waitForSelector(.search_Table .bgcolor:nth-child(${id + 1}) .link
) will throw timeout error, but I can get response from the console of headless chrome, so the element is exists actually.
another, if i comment this lines of click function:
await page.waitForSelector(selector , {
timeout: 1000
})
the browser pages will be hanging and not end, its confused for me. so, how to fix this so i don’t have to restart pages again ? thanks!
Issue Analytics
- State:
- Created 5 years ago
- Reactions:8
- Comments:23 (2 by maintainers)
Top GitHub Comments
same problem on latest version
seeing same onlatest