简体   繁体   中英

How to handle Ad On's in selenium with C#

Whenever I am running my automation test script using Spec-flow & Selenium with C# , there is a ad on popup on GoogleChrome whose screenshot I am attaching below, I want dismiss the pop up and make sure it doesn't show up during execution.

How Can I do that.? Please explain detail

HTTPS

To dismiss this popup, you should add arguments as --disable-extensions in your ChromeOptions during initialization of ChromeDriver as below :-

ChromeOptions options = new ChromeOptions();
options.AddArguments("--disable-extensions");
IWebDriver driver = new ChromeDriver(options);

To dismiss the pop up, you can do something as simple as clicking on the body of the page, when running your tests.

If you don't want to see it at all during test execution, then perhaps you should follow the posted answer about disabling extensions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM