How To Handle Annoying Random Popup / Alerts in selenium | Selenium Training|Java|WebDriver|TestNG|Frameworks|Videos

How To Handle Annoying Random Popup / Alerts in selenium

R
Ramakrishna Ravipati Post on 26/11/2019

how to handle the POP ups in selenium . we are geetig the pop ups in different pages but we do not know which page will get the pop up next time . how to handle this ?

S

Instructor

Support Team Reply on 27/11/2019

You can check the presence of popup

driver.getWidowHandles().size() will give you total number of popups

You can check from this if popup is present

We can also make a custom function for this which checks if popup is present

R
Ramakrishna Ravipati Reply on 04/12/2019

am currently working on Automation project for E-commerce site. In some pages unexpected popup's(ex:ad's) are displaying. Because of that my script was failing by throwing exceptions like ElementNotFoundException and currently Element is not Interactable etc.. . Here these ad's are not specific to particular page. It may come at any page.

Please let me know, Is there any way to handle these type of scenario?

S

Instructor

Support Team Reply on 04/12/2019

ElementNotFoundException -  If element is not present then it comes

Element is not Interactable -  Sometimes element is not page view or is invisible. Make sure thats its visible and is in page view. Sometimes you have to scroll to the element and this becomes Ok then