Selenium节点忽略Firefox设置并设置自己的设置配置文件不起作用 [英] Selenium node ignores Firefox settings and sets its own, setting profile doesn't work

查看:180
本文介绍了Selenium节点忽略Firefox设置并设置自己的设置配置文件不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有问题为Selenium使用的Firefox设置代理。 Firefox的安装是默认的(v 14.0.1,%programfiles%/ mozilla firefox /)。
我用默认配置文件启动了firefox,并设置了代理(我需要或者没有代理或手动代理,但有一个例外)。要测试的站点是可达的。 (默认代理设置站点不可访问)

我启动了默认的selenium节点

  java -jar selenium-server-standalone-2.24.1.jar -role node -hub http:// localhost:4444 / grid / register 

如果我开始硒测试ff打开,url进入,但现在我得到代理错误。如果我中断测试并检查设置:代理服务器恢复为默认设置。在about:config中,我可以看到并不是所有的设置都是默认的,WebDriver似乎已经设置了一些东西(更新关闭等)。

所以我的下一个方法是设置节点:$ b​​
$ b

  -firefoxProfileTemplate<我的默认配置文件文件夹> 

但没有成功 - 看起来selenium忽略了。设置一个不同的配置文件也不行。



那么如何让我的特殊代理设置被firefox使用呢?
(我也试过没有网格,用本地firefox运行测试 - 同样的问题)

来自这里我可以看到活动的配置文件:anonymous3433195750899294958webdriver-profile
有可能让webdriver不使用这个?



更新:似乎工作的唯一的东西是设置代理在java中:

  DesiredCapabilities FF = DesiredCapabilities.firefox(); 
Proxy proxy = new Proxy();
proxy.setProxyType(ProxyType.DIRECT);
FF.setCapability(CapabilityType.PROXY,proxy);

但是这个硬编码的解决方案从长远来看是没有选择的,我需要环境独立的代码,除此之外,要知道发生了什么。
解决方案您可以为每个Selenium网格2个节点分配一个特定的Firefox配置文件,只需设置
webdriver.firefox.profile 属性:

java -jar selenium-server-standalone-2.37.0.jar -Dwebdriver.firefox。 profile = my-profile -role node -hub http://mydomain.com:4444/grid/register




  • webdriver.firefox.profile的值必须是firefox配置文件名称,而不是位置或文件夹名称


http ://automatictester.wordpress.com/2013/04/07/selenium-running-custom-firefox-profile/

I have problem to set up the proxy for Firefox used by Selenium. The firefox installation is default (v 14.0.1, %programfiles%/mozilla firefox/). I started firefox with default profile and set up the proxy (i need either no proxy or manual proxy with one exception). the site to be tested is reachable. (with default proxy setting the site is not reachable)

I started the default selenium node

java -jar selenium-server-standalone-2.24.1.jar -role node  -hub http://localhost:4444/grid/register

If i start the selenium test ff opens, url is entered but now i get proxy error. If i interrupt the test and check the settings: proxy is back to default. in "about:config" i can see that not all settings are default, it seems that WebDriver has set some things (updates off and such).

So my next approach was to set the node with:

-firefoxProfileTemplate <my default profile folder>

but with no success - it seems selenium ignores is completly. Setting up a different profile doesn't work either.

So how to get my special proxy settings to be used by firefox? (i also tried it without grid, running the tests with a local firefox - same problem)

Withe the trick from here i could see the active profile: "anonymous3433195750899294958webdriver-profile" it is possible to let webdriver not use this?

Update: the only thing that seem to work is to set proxy in java:

DesiredCapabilities FF = DesiredCapabilities.firefox();
Proxy proxy = new Proxy();
proxy.setProxyType(ProxyType.DIRECT);
FF.setCapability(CapabilityType.PROXY, proxy);

But this hardcoded solution is no option in long run, i need environment independent code and besides that i want to know whats going on.

解决方案

You can assign to each Selenium grid 2 node a specific firefox profile, just set the webdriver.firefox.profile property:

java -jar selenium-server-standalone-2.37.0.jar -Dwebdriver.firefox.profile=my-profile -role node -hub http://mydomain.com:4444/grid/register

  • The value of the webdriver.firefox.profile has to be the firefox profile name, not the location or the folder name

http://automatictester.wordpress.com/2013/04/07/selenium-running-custom-firefox-profile/

这篇关于Selenium节点忽略Firefox设置并设置自己的设置配置文件不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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