Asked  8 Months ago    Answers:  5   Viewed   35 times

Selenium2, by default, starts firefox with a fresh profile. I like that for a default, but for some good reasons (access to my bookmarks, saved passwords, use my add-ons, etc.) I want to start with my default profile.

There is supposed to be a property controlling this but I think the docs are out of sync with the source, because as far as I can tell webdriver.firefox.bin is the only one that works. E.g. starting selenium with:

java -jar selenium-server-standalone-2.5.0.jar -Dwebdriver.firefox.bin=not-there

works (i.e. it complains). But this has no effect:

java -jar selenium-server-standalone-2.5.0.jar -Dwebdriver.firefox.profile=default

("default" is the name in profiles.ini, but I've also tried with "Profile0" which is the name of the section in profiles.ini).

I'm using PHPWebdriver (which uses JsonWireProtocol) to access:

$webdriver = new WebDriver("localhost", "4444");

$webdriver->connect("firefox");

I tried doing it from the PHP side:

$webdriver->connect("firefox","",array('profile'=>'default') );

or:

$webdriver->connect("firefox","",array('profile'=>'Profile0') );

with no success (firefox starts, but not using my profile).

I also tried the hacker's approach of creating a batch file:

#!/bin/bash
/usr/bin/firefox -P default

And then starting Selenium with: java -jar selenium-server-standalone-2.5.0.jar -Dwebdriver.firefox.bin="/usr/local/src/selenium/myfirefox"

Firefox starts, but not using by default profile and, worse, everything hangs: selenium does not seem able to communicate with firefox when started this way.

P.S. I saw Selenium - Custom Firefox profile I tried this:

java -jar selenium-server-standalone-2.5.0.jar -firefoxProfileTemplate "not-there"

And it refuses to run! Excited, thinking I might be on to something, I tried:

java -jar selenium-server-standalone-2.5.0.jar -firefoxProfileTemplate /path/to/0abczyxw.default/

This does nothing. I.e. it still starts with a new profile :-(

 Answers

94

Simon Stewart answered this on the mailing list for me.

To summarize his reply: you take your firefox profile, zip it up (zip, not tgz), base64-encode it, then send the whole thing as a /session json request (put the base64 string in the firefox_profile key of the Capabilities object).

An example way to do this on Linux:

cd /your/profile
zip -r profile *
base64 profile.zip > profile.zip.b64

And then if you're using PHPWebDriver when connecting do:

$webdriver->connect("firefox", "", array("firefox_profile" => file_get_contents("/your/profile/profile.zip.b64")))

NOTE: It still won't be my real profile, rather a copy of it. So bookmarks won't be remembered, the cache won't be filled, etc.

Wednesday, March 31, 2021
 
adjco
answered 8 Months ago
56

My experience is that using

@Profile("default")

the bean will only be added to the context if no other profile is identified. If you pass in a different profile, e.g. -Dspring.profiles.active="demo", this profile is ignored.

Saturday, June 12, 2021
 
barden
answered 5 Months ago
44

Look at the documentation page.

Tweaking an existing Firefox profile

You need to change "network.proxy.http" & "network.proxy.http_port" profile settings.

FirefoxProfile profile = new FirefoxProfile();
profile.addAdditionalPreference("network.proxy.http", "localhost");
profile.addAdditionalPreference("network.proxy.http_port", "3128");
WebDriver driver = new FirefoxDriver(profile);
Monday, June 21, 2021
 
Elxx
answered 5 Months ago
50

In case anyone is interested in knowing... I don't believe you can use the webdriver to click that button since it's not in the DOM (ie. not part of the web document) as suggested by other answers. However, you can create firefox profiles to manipulate geolocations or change the "Share Location" setting to "Allow" in Firefox.

See the following link for more info: http://selenium.polteq.com/nl/change-geolocation-in-firefox-with-selenium-webdriver/

Friday, August 20, 2021
 
Powering
answered 2 Months ago
97

You should add schema name for that function:

CREATE TABLE [dbo].[Clients](
   [ModifyingUser] [nvarchar](128) NOT NULL DEFAULT dbo.sCurrentAppUser (),
   [Modification] [char](1) NULL DEFAULT 'A',
   [ModifyingHost] [nvarchar](128) NOT NULL DEFAULT host_name (),
   [ClientID] [uniqueidentifier] NOT NULL,
   [Label] [nvarchar](1024) NULL,
   CONSTRAINT [PK_Clients] PRIMARY KEY (
      [ClientID] ASC
   )
)
Monday, August 23, 2021
 
Mikita Belahlazau
answered 2 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :
 
Share