OiO.lk Blog C++ click allow cookies popup on firefox selenium c#
C++

click allow cookies popup on firefox selenium c#


I want to click on allow option which is coming out from a pop up of a website ,I want to do on firefox to allow cookies:

i try this code but not work :

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");
          

also i try alert :

   var alert = driver_Ref.SwitchTo().Alert();
   
alert.Accept();

but not work, it seems to be this is not alert,
how to click allow in popup, or allow it automatically



You need to sign in to view this answers

Exit mobile version