Skip to main content

Clear cache Selenium




    /*
     * // clear cache
     *
     * public static void clearCache() throws InterruptedException {
     *
     * String chromedriverPath = System.getProperty("user.dir") +
     * "\\src\\test\\resources\\executable\\chromedriver.exe";
     *
     * System.setProperty("webdriver.chrome.driver", chromedriverPath);
     * ChromeOptions chromeoptions = new ChromeOptions();
     *
     *
     * // chromeoptions.addArguments("--headless");
     * chromeoptions.addArguments("start-maximized");
     *
     * chromeoptions.addArguments("disable-extensions");
     *
     * chromeoptions.addArguments("--disable-popup-blocking");
     *
     * chromeoptions.addArguments("--diable-infobars");
     *
     * driver = new ChromeDriver(chromeoptions);
     *
     * driver.get("chrome://settings/clearBrowserData"); Thread.sleep(5000);
     *
     * driver.switchTo().activeElement();
     *
     * driver.findElement(By.cssSelector("* /deep/ #clearBrowsingDataConfirm")).
     * click();
     *
     * Thread.sleep(5000);
     *
     * }
     *
     *
     *
     * //launch with cache disabled
     *
     * @SuppressWarnings("deprecation") public static void launchWithoutCache() {
     *
     *
     * String chromedriverPath = System.getProperty("user.dir") +
     * "\\src\\test\\resources\\executable\\chromedriver.exe";
     *
     * System.setProperty("webdriver.chrome.driver", chromedriverPath);
     * DesiredCapabilities cap=DesiredCapabilities.chrome();
     * cap.setCapability("applicationCacheEsnabled", false); driver=new
     * ChromeDriver(cap);
     *
     * }
     *
     */

Comments