5

So right now to run my Selenium 1 tests I use a custom Firefox Profile that sets when I launch my Selenium Server.

Is there a way to properly set this profile to run in Selenium 2? I've tried setting the FF profile using new FirefoxProfile("path"); however that doesnt seem to work. What it DOES to is delete everything in that path folder(weird, I know). Can I use the Selenium Server to tell Selenium 2 what to use? Or does this just not work in Selenium 2b3 yet?

asked May 10, 2011 at 21:10

2 Answers 2

4

The preferred method in selenium 2 is to programmatically build your profile.

For example, like this:

private static FirefoxProfile CreateProfile()
{
 var profile = new FirefoxProfile();
 profile.EnableNativeEvents = false;
 profile.SetPreference("browser.download.dir", Configuration.TemporaryTestDataShare);
 profile.SetPreference("browser.download.folderList", 2);
 profile.SetPreference("browser.helperApps.neverAsk.saveToDisk", "application/pdf;application/msword;text/plain;application/octet");
 return profile;
}

Next you can assign the created profile to the FirefoxDriver:

new FirefoxDriver(profile)

The great benefit of this method is that you won't need to have a selenium profile in some place on your disk. When you use grid 2.0 later on to do distributed testing, this will make things a lot easier.

answered May 11, 2011 at 16:15
1

Right now this is how selenium works. It creates profiles on each and every run. Every run means a new, blank profile. This is done so that nothing can interfere with previous test runs.

That being said... You can cheat it to handle profiles and not delete them by starting selenium server with the parameter:

-firefoxProfileTemplate "C:\Documents and Settings[your login name]\Application Data\Mozilla\Firefox\Profiles\selenium.default"

So the server will start with this parameter and will use the setting in this profile and will never ever delete them. Everything you set there by hand will be there when you run an automated test.

Hope that helped..

Cheers, Skarlso

answered May 10, 2011 at 21:35

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.