How to deal with popup/overlays on websites?



  • I'm trying to automate stuff on a website, but they'll randomly open up an overlay asking for me to signup for an email newsletter, and then I continue with the script without closing it. Other than attempting to check for the overlay popup every other action so I can close it, how do I deal with this?





  • I don't want to restrict all popups, just specific ones. I know I can restrict by URL, but I'm not sure how that's helpful if I only want to restrict one kind of popup on that website.



  • @Rae

    If it’s a specific url / css property you should be able to just “move and click” on window to accept or deny message

    Might have to put delays before the action to give the pop up time to appear.



  • @boozer That's what I'm currently doing, created a function with short time outs and constantly call it between actions. It's particularly annoying because the popup might not appear, appear instantly, or take 2 minutes. Although maybe I should create a function that tries to close the popups constantly and call it asynchronously.



  • Use is_exist function with IF logic. If popup shows up then close it, if not move on and continue loop


Log in to reply