如何更改Webdriver Firefox连接到本地主机的端口? [英] How to change the port that Webdriver Firefox connects to localhost?
问题描述
显示选择有一个问题,但我例如
这是我得到的错误:
org.openqa.selenium.firefox.NotConnectedException:无法在45000 ms后在端口7055上连接到主机127.0.0.1。
$ b Firefox控制台输出:
错误:未指定显示
错误:未指定显示
这是我的代码:
File ffExe = new File(/ usr / bin / firefox);
FirefoxBinary ffox =新的FirefoxBinary(ffExe);
ffox.setEnvironmentProperty(DISPLAY,:21);
WebDriver driver = new FirefoxDriver(ffox,null);
那么,我该如何告诉firefox使用另一个端口,我应该指定哪一个?
有一个系统属性-webdriver.firefox.port这可能是yoru查询的答案。它在wiki上列出 - http://code.google.com/p/selenium/ wiki / FirefoxDriver ,但没有提供相同的文档。你可以尝试让我们知道,如果它的工作:)
I have a selenium webdriver test, converted to maven project, that I want to run via xvfb on Jenkins.
There is a problem with display selection, but I would like to try something else and change the port, for example.
This is the error I get:
org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms.
Firefox console output:
Error: no display specified
Error: no display specified
And this is my code:
File ffExe = new File("/usr/bin/firefox");
FirefoxBinary ffox = new FirefoxBinary(ffExe);
ffox.setEnvironmentProperty("DISPLAY", ":21");
WebDriver driver = new FirefoxDriver(ffox, null);
So, how can I tell firefox to use another port and which one should I specify?
There is a System property -webdriver.firefox.port which could be the answer for yoru query. It is listed on the wiki - http://code.google.com/p/selenium/wiki/FirefoxDriver, but there is no documentaion provided for the same. You can try and let us know if it works :)
这篇关于如何更改Webdriver Firefox连接到本地主机的端口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!