I try to find the best way to "wait until the complete website is loaded". And this seems to be a tricky thing. I was googleing alot and saw that there are 2 ways: waitForSelector and SetTimout.
My problem is, even if I wait for the Selector #CheckSelectAll to check this Checkbox it seems it's always too early. So I had to add a delay of 2 seconds. And this looks very unprofessional for me. I want to use the best practice for this.
This should be an issue everybody always needs when using puppeteer with different pages and forms.
Is it possible that this waitForSelector doesn't work when the selector is inside an iFrame?
Thanks for any advice and help!
function delay(time) {
return new Promise(function(resolve) {
setTimeout(resolve, time)
});
await page.waitForSelector('#CheckSelectAll');
await delay(2000);
await page.click('#CheckSelectAll');
Aucun commentaire:
Enregistrer un commentaire