[英]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. 每当我使用Spec-flow& Selenium
和C#
运行自动化测试脚本时, GoogleChrome
上的弹出窗口上都会有一个广告,下面附有我的屏幕快照,我希望关闭该弹出窗口并确保其在执行期间不会显示。
How Can I do that.? 我怎样才能做到这一点。? Please explain detail 请详细说明
To dismiss this popup, you should add arguments as --disable-extensions
in your ChromeOptions
during initialization of ChromeDriver
as below :- 要关闭这个弹出,你应该补充论据--disable-extensions
在ChromeOptions
的初始化期间ChromeDriver
如下: -
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. 如果您根本不想在测试执行过程中看到它,那么您应该遵循发布的有关禁用扩展的答案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.