I am using selenium server 2.28 on windows machine. I have set up the hub and node. I am using .net to write my test cases. I am using the following code to use custom FireFox (17.0.1) Profile with the user agent changed(to iPhone).
FirefoxProfileManager profileManager = new FirefoxProfileManager();
FirefoxProfile profile = profileManager.GetProfile(FireFox_Profile_Name);
profile.SetPreference("general.useragent.override", _sUserAgent);
DesiredCapabilities capability = DesiredCapabilities.Firefox();
capability.SetCapability(FirefoxDriver.ProfileCapabilityName, profile);
And I am instantiating a RemoteWebDriver
instance like this:
driver = new RemoteWebDriver(new Uri("hub_uri"), capability);
When I check the about:config
in the instance of firefox on the node machine, I don't see the general.useragent.override preference at all. If i use:
driver = new FirefoxDriver(profile);
The preference is set correctly. Am I missing something?
I am trying to do something very similar at the moment (setting Firefox to use Windows authentication).
In my (somewhat limited) experimentation to make this work, using just profile
will work with a local driver instance, but not when talking to Selenium Server. I can get the profile to be passed to Selenium Server by using profile.ToBase64String()
as hinted to here.