I'm trying to launch a specific profile in Selenium v4 and Java using the following code:
System.setProperty("webdriver.gecko.driver", path_to_geckdriver);
File firefoxProfileFile = new File(path_to_file);
FirefoxProfile firefoxProfile = new FirefoxProfile(firefoxProfileFile);
FirefoxOptions firefoxOptions = new FirefoxOptions();
firefoxOptions.setProfile(firefoxProfile);
It took 411 seconds (almost 7 minutes) to load said profile.
When debugging above, I noticed that the folder: \MyProfile\cache2\entries\
has 28,000 items in it totaling 1+ GB of data. I deleted all of the items and ran above code again and this time it took (only?) 69 seconds to load said profile.
My question is:
What process is populating this folder with so many garbage entries? How can I prevent FF from populating
\MyProfile\cache2\entries\
with so many entries in the future?While the load time is now much better, is 60 second load time really the fastest I can achieve?
P.S: I am not creating a temporary FF profile, rather I'm loading existing profile from file.
When you initiate a firefox Browsing Context using Selenium from an existing FirefoxProfile the following settings/configurations:
are copied from the actual profile directory into a temporary rust_mozprofile as follows:
Naturally, the more the settings/configurations to be copied the more time is required for the I/O to complete.
However, to reduce the amount of the leftovers from the executions you should always invoke
driver.quit()
withintearDown(){}
method to close & destroy the WebDriver and Web Client instances gracefully.