chrome automatic history clear code example
Example: how to clear browser history
ChromeDriver chromeDriver = new ChromeDriver();
chromeDriver.manage().deleteAllCookies();
chromeDriver.get("chrome://settings/clearBrowserData");
chromeDriver.findElementByXPath("//settings-ui").sendKeys(Keys.ENTER);
return chromeDriver;