Skip to content
Advertisement

handle popups in selenium python

I am currently working on a project where I am automating whatsapp messages through url. like this https://wa.me/number_here

whenever i do it normally everything goes fine, but when I try to automate this a whatsapp popup box appears and blocks everything, I mean everything, no right-click no developer options, that is why i cant get the x path of the button on that popup. i have tried (driver.shift_to,alert.close)but it says that there is no such alert. i have tried to find the button by contains(text) method but also did not work. here is my code.

JavaScript

enter image description here

please help me how to bypass this popup. thanks

Advertisement

Answer

I think, this link can be helpful for you: https://stackoverflow.com/a/19019311/12000849

What I do is to set a conditional delay with WebDriverWait just before the point I expect to see the alert, then switch to it, like this:

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement