我在 Windows 机器上使用 selenium server 2.28。我已经设置了集线器和节点。我正在使用 .net 编写我的测试用例。我正在使用以下代码来使用自定义 FireFox (17.0.1) 配置文件,用户代理已更改(更改为 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);
我正在实例化一个RemoteWebDriver
这样的实例:
driver = new RemoteWebDriver(new Uri("hub_uri"), capability);
当我about:config
在节点机器上检查 firefox 实例时,我根本看不到 general.useragent.override 首选项。如果我使用:
driver = new FirefoxDriver(profile);
首选项设置正确。我错过了什么吗?