FireFox Profiles

Oct 26, 2012 at 2:19 PM

I needed to be able to specify a FireFox profile when running Start-SeFirefox with the current architecture I didn't see a way to do this, or to modify the current source.   If there is a better supported method for this, please let me know.

My workaround:

$ProfileFolder = "$($Home)\AppData\Roaming\Mozilla\Firefox\Profiles\m0u7svad.default" 


$profile = new-object OpenQA.Selenium.Firefox.FirefoxProfile($ProfileFolder)




$FF = new-object OpenQA.Selenium.Firefox.FirefoxDriver($profile)


Oct 26, 2012 at 3:53 PM

Hello Jmiller76,

as I understand you need something like (this is a simplified code) this:

$ffprofile = New-SeFirefoxProfile;
# set some properties (they're browser-specific, so that I wonder if somebody needs cmdlets for setting properties)
# on the other hand, cmdlets are being tested as a suite and powershellers need to test less code...
# here, opinions would be valuable
$ffprofile. ...
Start-SeFirefox -Profile $ffprofile

If this way to start a Firefox instance is what you want, I could upload this on Monday or Tuesday.

In case you need more cmdlets for setting up the profile, or more parameters for Start-Se[browser] cmdlets, please share your ideas in this thread.

I'm also thinking about New-SeProxySettings or Set-SeProxySetting cmdlet...

Oct 26, 2012 at 4:55 PM

Yes that is the general idea.  The profile needs to be created via either a profile name or path.  I think the $ffprofile class should be workable on its own without a cmdlet to assist.    One to assit with creating the profile is probably helpful.  At the minimum adding the argument and setting the arguments Help to include a reference to the namespace to create the profile itself is needed.  In general I only create cmdlets for abstracting New-Object if it inlcudes more than just the New-Object, such as adding members or creating prereequisit class like office (outlook, excel, word) application types.

  1. I think setting an existing profile is an edge case in QA (at least from feedback I have seen in forums discussing Selenium).
  2. Anyone needing to do more then setting to an existing profile is going to need to work with the class.  Abstracting these functions to cmdlets could be a module voume of developement alone.

I am still in the evaluation stages of using Selenium.  We had started using WATIN, but that seems to be a bit abandoned especially for cross browser work.  If you didn't have this PS module going, I would have been substantially slowed down.

As we explore functionality, I will make sure to send you any feedback we have.

I don't know if you have this, but this is how I have seen to open a FF profile by name.  I have actually not had proper luck opening default profiles, but I have not had an opertunity to dig into it.  As is we made a non-default for the automation account and this seems to work.

$profileManager = new-object OpenQA.Selenium.Firefox.FirefoxProfileManager
$profile = $profileManager.GetProfile('default')


- Josh

Oct 26, 2012 at 7:09 PM

Actually, the confirmation I heard that the above code worked seems to have been confused as they are unable to repeat for me to see.  So something is still not right with this.  

Oct 26, 2012 at 7:21 PM

I actually just need to use the origional cookie container database.  So if you know a way to modify the profile preferences to point to a single SQL, then that would be good to.



Oct 26, 2012 at 8:31 PM
$ProfileFolder = "$($Home)\AppData\Roaming\Mozilla\Firefox\Profiles\m0u7svad.default"
$profile = new-object OpenQA.Selenium.Firefox.FirefoxProfile($ProfileFolder ) 
$T = new-object OpenQA.Selenium.Firefox.FirefoxDriver($profile)

This seems to work.  Thank you.