Reputation: 101
I use Selenium WebDriver with firefox. Every time selenium generates new anoniumus profile for firefox in temp folder and after exit, removes it. I need this profile. How can I get it? F.e. profile stored in
C:\Documents and Settings\Developer\Local Settings\Temp\anonymous5583304190515426768webdriver-profile
After shutting down WebDriver with
driver.quit();
profile will be removed, but it is already logged and I want to use it in next iteration, by initing WebDriver with it:
FirefoxDriver driver = new FirefoxDriver(new FirefoxProfile(profileFolder));
Is it possible to save profile without dirty hacks like coping whole folder while driver works (I'm not sure even it works, because in windows, folder is locked while firefox launched)? Maybe exists some API in Selenium for it?
Upvotes: 5
Views: 6720
Reputation: 14738
Why dont you just change approach?
SELENIUM
When initializing the Webdriver:
ProfilesIni allProfiles = new ProfilesIni();
FirefoxProfile desiredProfile = allProfiles.getProfile("SELENIUM");
WebDriver driver = new FirefoxDriver(desiredProfile);
That way, you assure that this profile will be used anytime you do the tests...
Upvotes: 3