Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Selenium允许站点保存文件_C#_Selenium_Selenium Chromedriver - Fatal编程技术网

C# Selenium允许站点保存文件

C# Selenium允许站点保存文件,c#,selenium,selenium-chromedriver,C#,Selenium,Selenium Chromedriver,我有这个弹出窗口 我试图用ChromeDriver让它要么允许,要么拒绝 翻译为:secure.runescape.com需要以下内容 在此设备上保存文件(允许和拒绝作为选项) 尝试: ChromeOptions chrome_options = new ChromeOptions(); chrome_options.AddArguments("--disable-notifications"); 这仍然显示在弹出窗口中 IAlert simpleAlert

我有这个弹出窗口

我试图用ChromeDriver让它要么允许,要么拒绝

翻译为:secure.runescape.com需要以下内容

在此设备上保存文件(允许和拒绝作为选项)

尝试:

 ChromeOptions chrome_options = new ChromeOptions();
                chrome_options.AddArguments("--disable-notifications");
这仍然显示在弹出窗口中

IAlert simpleAlert = driver.SwitchTo().Alert();
                simpleAlert.Accept();

这会导致没有警报的错误。

您可以禁用通知,代码属于java。你可以把它换成C

ChromeOptions chrome_options = new ChromeOptions();
chrome_options.addArguments("--disable-notifications");
System.setProperty("webdriver.chrome.driver","path of chromedriver.exe);
WebDriver driver =new ChromeDriver(chrome_options);

的可能重复项必须尝试使用Action类,如下所示:IAlert simpleAlert=driver.SwitchTo().Alert();simplelert.Accept()@KyllianLissens弹出窗口是关于什么的?你能用简单的英语翻译给我们吗?@PixelEinstein已经在那里尝试了解决方案,不是吗work@DebanjanB检查编辑他想知道如何从通知中选择选项,而不是禁用通知。