Selenium 禁用恢复页面弹出

del*_*lex 7 c# selenium google-chrome selenium-chromedriver

我正在使用 selenium C#,我正在尝试禁用“崩溃”chrome 的弹出窗口: https://i.stack.imgur.com/xudon.png

我尝试设置配置文件首选项,但似乎它根本没有改变,代码:

        ChromeOptions options = new ChromeOptions();
        options.AddUserProfilePreference("exit_type", "Normal");
        options.AddUserProfilePreference("exited_cleanly", "true");
        IWebDriver driver = new ChromeDriver(options);
Run Code Online (Sandbox Code Playgroud)

我尝试将退出类型的值更改为“none”和“None”,但在首选项文档中没有任何更改。

小智 0

使用下面的代码来处理这个弹出窗口:

ChromeOptions options = new ChromeOptions();
options.AddArguments("--disable-extensions");
options.AddArguments("--disable-application-cache");
driver = new ChromeDriver(options);
Run Code Online (Sandbox Code Playgroud)

  • 不幸的是,这并没有解决我的问题,此外我还尝试使用这两个命令。 (2认同)