简体   繁体   中英

Selenium WebDriver can't open Firefox profile

I tried with 32 version and the last version of Firefox, but Selenium doesn't open Firefox Profile. It's always temporary profile.

ProfilesIni profile = new ProfilesIni();
    FirefoxProfile myprofile = profile.getProfile("Selenium");
    protected WebDriver driver = new FirefoxDriver(myprofile);

When I open using Selenium, just to be make sure which version, I go to "about:support" -> Profile Folder. The path is always: | ......Temp\\anonymousXXXXXXXXXXXXXXXXXwebdriver-profile'.

Must be: Profiles\\oadeqq6x.Selenium

Why Selenium doesn't load my profile?

Actually Selenium WebDriver never open a specified profile directly from that place. Rather it copy to a temporary location and then opens it.

The reason is to support the use case of running multiple independent simultaneous instances of Firefox. At one time, when Firefox launched, it would drop a sentinel or lock file in the profile directory, and would detect that file if the user attempted to start a new instance of Firefox, preventing them from doing so. The Selenium project's solution to that issue with WebDriver, when a user wants to use a specific profile, is to copy the contents of that profile to a new directory, and launch Firefox pointing to the copy.

For more details check this answer --> https://stackoverflow.com/a/40521731/ That answer is given by JimEvans who is core contributor of Selenium.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM