Firefox profile selection with Webdriver

63 views
Skip to first unread message

Santiago Hernández

unread,
May 13, 2013, 9:44:26 PM5/13/13
to selenium-...@googlegroups.com
Hi all,

I know that this is not the place to ask this questions, so, first of all, I am sorry, but on Selenium User group I had not a reply.
Is a simple issue I have, but I have been working all day on this with no solution to select a custom profile form firefox at the starting of my tests.

I tried it on different vms and firefox versions (From 12 to 20) and also with different webdriver versions, from 2.27 to 2.32

My code is the following:

public WebDriver setFirefoxDriver() {
        ProfilesIni allProfiles = new ProfilesIni();
        FirefoxProfile profile = allProfiles.getProfile("someName");
        FirefoxDriver driver = new FirefoxDriver(profile);
        return driver;
    }

Where someName is setted in a xml file (testng suite) and loaded in my framework, I debugged it and is perfectly setted, the profile is created on firefox but Webdriver is always opening an annonymous profile.

Can you see if I am missing something?

Regards,

Mike Riley

unread,
May 14, 2013, 12:58:52 PM5/14/13
to selenium-...@googlegroups.com
Try asking on the Web Driver group.  Most people in the Selenium Users group are working with the Selenium API or the IDE, so it is better to ask questions in the group dedicated to Web Driver.

https://groups.google.com/forum/#!forum/webdriver

I can tell you that you have to create the profiles manually to have them to load.  You did not say if you did that here.  I create one for each version of Firefox, since the information will change from version to version.  Here is the code I use to load a profile:
                org.openqa.selenium.remote.DesiredCapabilities capability = null;
                FirefoxProfile ffProfile;
.
.
.
                capability = DesiredCapabilities.firefox();
                str = "Firefox" + browserVersion + ".profile";
                ffProfile = new FirefoxProfile(new File(str));
                capability.setCapability(FirefoxDriver.PROFILE, ffProfile);
.
.
.
                driver = new FirefoxDriver(capability);


Mike

Santiago Hernández

unread,
May 14, 2013, 2:05:07 PM5/14/13
to selenium-...@googlegroups.com
Thanks Mike,

I will ask on that forum.
I created the profiles manually using firefox.exe -p option, I can see the profiles created if I go to profile manager.

Regards,

Santiago
Reply all
Reply to author
Forward
0 new messages