硒格2 - 远程的webdriver没有设置在Firefox用户代理偏好 [英] Selenium Grid 2 - Remote webdriver not setting the user agent preference in FireFox

查看:190
本文介绍了硒格2 - 远程的webdriver没有设置在Firefox用户代理偏好的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Windows机器上的服务器硒2.28。我已成立了枢纽和节点。我使用.NET编写我的测试案例。我使用下面的代码使用自定义的火狐(17.0.1)配置文件与用户代理改变(到iPhone)。

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);

和我实例化一个 RemoteWebDriver 例如像这样的:

And I am instantiating a RemoteWebDriver instance like this:

driver = new RemoteWebDriver(new Uri("hub_uri"), capability);

当我检查 about:config中中火狐的节点机上的情况下,我没有看到general.useragent.override偏好的。如果我使用:

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?

推荐答案

我试图做的那一刻非常类似(设置Firefox的使用Windows身份验证)。

I am trying to do something very similar at the moment (setting Firefox to use Windows authentication).

在我的(比较有限)实验,使这项工作,只用简介将与一个本地驱动程序实例工作但交谈Selenium服务器的时候没有。我可以用得到的配置文件将传递给Selenium服务器 profile.ToBase64String()作为暗示的这里

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.

这篇关于硒格2 - 远程的webdriver没有设置在Firefox用户代理偏好的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆