我有一个硒webdriver测试,转换为maven项目,我想通过詹金斯上的xvfb运行。如何更改Webdriver Firefox连接到本地主机的端口?
显示选择存在问题,但我想尝试其他方法并更改端口,例如。
这是错误我得到:
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
这是我的代码:
File ffExe = new File("/usr/bin/firefox");
FirefoxBinary ffox = new FirefoxBinary(ffExe);
ffox.setEnvironmentProperty("DISPLAY", ":21");
WebDriver driver = new FirefoxDriver(ffox, null);
所以,我怎么能告诉火狐使用其他端口和一个我应该指定?
你能告诉我一个如何在代码中使用“webdriver.firefox.port”的例子吗?在你链接到的页面中,一旦他们谈论了setProperty,然后他们谈论setPreference和Im变得困惑 –
System.setProperty(“propertyname”,“propertyvalue”) – Akbar
谢谢!将尝试它 –