简体   繁体   中英

How to open specified profile Firefox with Selenium 2 Webdriver?

When I use default profile starts without problem. But when i starts with custom profile, firefox starts but stays "blocked". The process remains active consuming 31MB of RAM, but never start. Only start if I killed the process, then starts and works fine with selenium.

I use Windows 7, Firefox 25.0.1 and selenium-server-standalone-2.38.0.jar ¿Maybe problems with compatibility of versions?

This is the code to open the profile:

FirefoxProfile profile = new FirefoxProfile(new File("C:/Users/UserTest/AppData/Roaming/Mozilla/Firefox/Profiles/tydtn9km.testprofile"));                  
WebDriver driver = new FirefoxDriver(profile);

Edit: This is my actual code

package org.openqa.selenium.example;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.firefox.internal.ProfilesIni;

public class Main  {
    public static void main(String[] args) {
        ProfilesIni profile = new ProfilesIni();
        FirefoxProfile ffprofile = profile.getProfile("Other");
        WebDriver driver = new FirefoxDriver(ffprofile);
        driver.get("http://google.com");
    }
}

Edit 2: Resolved The problem ocurred because my Firefox profile is located in another partition, and Firefox in the other partition.

I have been using it like this:

First, create a Firefox profile and name it somehow you know. Eg SELENIUM

Then initialize your profile:

ProfilesIni profile = new ProfilesIni();
FirefoxProfile ffprofile = profile.getProfile("SELENIUM");
WebDriver driver = new FirefoxDriver(ffprofile);

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