Hello
I need to clean the cookies and cache from browser once the user closes the window. I'm trying code like this
//objects is a parameter, the method is called via browser.execute like this
// browser.execute("cookieCallback(document.cookie);");
Arrays.asList(objects[0].toString().split(";")).stream().forEach(cookieObj -> {
String cookie = cookieObj + "";
cookie = cookie.substring(0, cookie.indexOf("=") + 1);
if (cookie.length() > 0)
{
cookieList.add(cookie.replace("=", "").replace(" ", ""));
}
});
cookieList.stream().forEach(cookieName -> {
Browser.setCookie(cookieName + "=; " + expires, browser.getUrl());
});
Browser.clearSessions();
The behavior is:
I log into any website (e.g. hotmail) and I click on the remember me checkbox, close the window (the above code is executed), but when I reopen the browser the session is still open.
Does any one know how I an avoid that behavior?