You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We need to automate a site which puts up a dialog box sort of randomly, so not when ou arrive at the site or after a given action but at some point of the usage. It's an ad for a new feature they have. We need to dismiss it to continue, but it's a hassle to check for it all the time plus your auto-wait-before-click feature breaks. Instead we could have an .on(... style event handler that somehow catches dom changes (a selector appearing) between retries of click actions. So you would try to find that button to click but in the meantime let the on ... handler take care of the dialog box. Thanks.
The text was updated successfully, but these errors were encountered:
It would tricky for us to implement this feature because we wouldn't be able to block on async actions you take when the event fires. But if you are careful with what you do something like this could work.
Warning: Untested code
// do not await this(async()=>{letloop=true;page.on('close',()=>loop=false);while(loop){constpopup=awaitpage.waitForSelector('.the-popup',{timeout: 0}).catch(()=>null);if(!popup)continue;// close the popupawaitpopup.click();}})();// the rest of your test goes here
We need to automate a site which puts up a dialog box sort of randomly, so not when ou arrive at the site or after a given action but at some point of the usage. It's an ad for a new feature they have. We need to dismiss it to continue, but it's a hassle to check for it all the time plus your auto-wait-before-click feature breaks. Instead we could have an .on(... style event handler that somehow catches dom changes (a selector appearing) between retries of click actions. So you would try to find that button to click but in the meantime let the on ... handler take care of the dialog box. Thanks.
The text was updated successfully, but these errors were encountered: