how to disable cookies using webdriver for Chrome and FireFox JAVA

0
0

I want launch browsers(FF, CHROME) for test with disabled cookies, I tried this:

           service =
new ChromeDriverService.Builder()
.usingDriverExecutable(new File("src/test/resources/chromedriver"))
.usingAnyFreePort().build();
try {
service.start();
} catch (IOException e1) {
e1.printStackTrace();
}
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability("disable-restore-session-state", true);
driver = new ChromeDriver(service, capabilities);

but it’s not work…

  • You must to post comments
0
0

I’ve just get solution for Firefox:

FirefoxProfile profile = new ProfilesIni().getProfile("default");
profile.setPreference("network.cookie.cookieBehavior", 2);
driver = new FirefoxDriver(profile);

but I don’t know how to manage it with Chrome.

  • You must to post comments
Showing 1 result
Your Answer
Post as a guest by filling out the fields below or if you already have an account.
Name*
E-mail*
Website