Is it possible to block dynamic advertisement pop up in Selenium?

16 Views Asked by At

For an interview ,I've received demo site :https://automationexercise.com/ to create an automation framework in Selenium for add to cart functionality. But on running the automation code , I'm getting a dynamic advertisement which I need to close manually to proceed with the code. Is it possible to block the advertisement using Selenium?

Attached is the screenshot of advertisement pop up displaying

I've tried adding the code to close the pop up when it is displaying , but I'm not sure what should be the condition here because the advertisement is showing sometimes , and also in different pages.

0

There are 0 best solutions below