How to create a blank Firefox profile?

67 views
Skip to first unread message

Stéphane

unread,
Sep 30, 2011, 5:47:39 AM9/30/11
to Selenium Users
Not sure this has already been mentioned here, but is it possible to
let Selenium create a blank Firefox profile without actually running
any test? The goal would be to be able to retrieve and version the
content of this profile (e.g. in Subversion), make some adjustments to
it (e.g. add an extension to get ride of ads or just hide the
bookmarks toolbar), version it again and then use it as the default
profile. How do you guys manage and track your Firefox custom
profiles?

Cheers,

Stéphane

Krishnan Mahadevan

unread,
Oct 1, 2011, 11:20:44 PM10/1/11
to seleniu...@googlegroups.com
Stéphane,
If you are using WebDriver then you don't need to save your profile separately.
The profile can very well be created on the fly via your code, and you could add the required extensions etc., and that way your profile's nature/behavior/contents all exist only in your code and DONOT reside within your test code repository.

If you still want your Profile Directory to be checked into your test repository, then you can do something like this

org.apache.commons.io.FileUtils.copyDirectory(new FirefoxProfile().layoutOnDisk(), new File("myDestinationDirectory"));

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.


Bopolissimus X Platypus

unread,
Oct 9, 2011, 5:55:58 PM10/9/11
to seleniu...@googlegroups.com

I use linux. if you use windows the procedure will be slightly
different (at minimum, location of profiles).

1. start firefox with -profileManager
2. create a new profile (give it a name, e.g., my_project_firefox_profile
3. specify directory where I want the profile to be stored (instead of
in the default .mozilla/firefox/ directory).
e.g., I often specify the directory to be somewhere in my svn
checkout, so that the empty (later to be
filled in) profile is in version control and can be used by my
continuous integration tool to auto-run the
selenium tests.

When I want to initialize the profile config, I start firefox
specifying the profile, e.g.,

firefox -p my_project_firefox_profile

then I set up the config (adding any necessary plugins, setting
history/cache/cookie behavior, etc.
Once the profile is setup (it'll be used with -firefoxProfileTemplate
[template_dir] later) I usually
add/commit it to version control.

tiger

--
Gerald Timothy Quimpo bopolissimus_at_gmail.com
http://bopolissimus.*b*l*o*g*s*p*o*t*.com

Reply all
Reply to author
Forward
0 new messages