Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 3 down vote accepted

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.

share|improve this answer

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.