FirefoxDriverService cService = FirefoxDriverService.CreateDefaultService(".", "geckodriver.exe");
cService.HideCommandPromptWindow = true;
FirefoxOptions options = new FirefoxOptions();
options.AddArgument("ignore-certificate-errors");
options.AddArgument("--user-data-dir=" + FolderPathToStoreSession);
options.AddArgument("--disable-notifications");
options.AddArguments("Firefox.switches", "--disable-extensions");
//options.AddArguments ("profile.default_content_setting_values.cookies", "1");
options.SetPreference("network.cookie.cookieBehavior", "0");
options.SetPreference("profile.default_content_setting_values.cookies", "1");
我也尝试警报:
var alert = driver_Ref.SwitchTo().Alert();
alert.Accept();
但是不行,看来是这个不警觉,
如何在弹出窗口中单击允许,或自动允许