How to disable cookies in firefox | Selenium Forum
R
ramu.gande Posted on 13/12/2019

In Cnn.com, getting Accept Cookies .how to disable cookies please

 

thank you


R
ramu.gande Replied on 13/12/2019


System.setProperty(FirefoxDriver.SystemProperty.BROWSER_LOGFILE, "null");
FirefoxOptions ops=new FirefoxOptions();
FirefoxProfile profile=new FirefoxProfile();
profile.setPreference("network.cookie.cookieBehavior", 2);
ops.setProfile(profile);

WebDriver driver=new FirefoxDriver(ops);
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
driver.manage().window().maximize();
driver.get("http://cnn.com");


R
ramu.gande Replied on 13/12/2019

Above code is not workin


A
Ashish Thakur Replied on 13/12/2019

profile.setPreference("network.cookie.cookieBehavior",2);
will disbable cookies

CNN is asking as its a website functionality. You cant stop them from asking you


R
ramu.gande Replied on 18/12/2019

is there any solution to accept cookies browser setting?


A
Ashish Thakur Replied on 22/12/2019

click on yes button using selenium