[英]Firefox Cannot Connect When Running Java Selenium WebDriver With GeckoDriver
I am trying to run my Selenium test script with Firefox. 我正在尝试使用Firefox运行Selenium测试脚本。 So far, it works fine with Chrome but Firefox says "Firefox can't establish a connection to the server at [any uri]".
到目前为止,它可以在Chrome上正常运行,但是Firefox表示“ Firefox无法在[任意时间]建立与服务器的连接”。 I need this to work for a system in which I am not the admin.
我需要这个才能在我不是管理员的系统上工作。 I tried this in my own system and it worked fine.
我在自己的系统中进行了尝试,效果很好。 I'm not sure why Chrome would work in the former system and Firefox wouldn't.
我不确定为什么Chrome在以前的系统中可以运行而Firefox不能。 Here is an excerpt of my code:
这是我的代码的摘录:
System.setProperty("driver.gecko.webdriver", "drivers\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();
driver.get("www.google.com");
I've tried various approaches with setting different options and configurations, but none have worked. 我尝试了各种方法来设置不同的选项和配置,但没有一个奏效。 Most of what I have found through Google has been from an exception:
我通过Google发现的大多数东西都来自一个例外:
org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms
org.openqa.selenium.firefox.NotConnectedException:在45000毫秒后无法连接到端口7055上的主机127.0.0.1
My problem does not relate to this at all as I do not have any exceptions. 我的问题根本与此无关,因为我没有任何例外。 Another thing to note is that when I use Firefox myself, it connects just fine.
要注意的另一件事是,当我自己使用Firefox时,它连接起来就很好。 The problem only happens when I run my scripts.
该问题仅在我运行脚本时发生。 I have also checked the proxy settings and they are fine.
我还检查了代理设置,它们很好。
EDIT: 编辑:
OS version: Windows 7 Enterprise
GeckoDriver version: 0.23.0
Firefox version: 62.2.2esr
Java version: 1.8.0_181
Selenium version: 3.14.0
Eclipse version: 4.8.0 (Photon)
我遇到了同样的问题,我刚刚做了一个新的更新selenium-java版本3.141.59 firefox 64 geckodriver v0.23.0,所有事情对我来说都很好
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.