How can I retain my Firefox profile's cache with Geckodriver?

后端 未结 2 905
情话喂你
情话喂你 2021-01-15 00:56

I need to retain my cache with Selenium and Geckodriver. I have a Firefox profile and I load it upon startup of Geckodriver:

Profil         


        
2条回答
  •  梦毁少年i
    2021-01-15 01:16

    I'm using existing custom Firefox profile with this code (to be complete):

    FirefoxOptions options = new FirefoxOptions();
    
    ProfilesIni allProfiles = new ProfilesIni();         
    FirefoxProfile selenium_profile = allProfiles.getProfile("selenium_profile");
    options.setProfile(selenium_profile);
    
    options.setBinary("C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe");
    System.setProperty("webdriver.gecko.driver", "C:\\Users\\pburgr\\Desktop\\geckodriver-v0.20.0-win64\\geckodriver.exe");
    driver = new FirefoxDriver(options);
    driver.manage().window().maximize();
    

    and my cache "grows" normaly.

    If zero cache persists, check the setting of the Firefox profile (delete cache when closing).

提交回复
热议问题