简体   繁体   English

使用GeckoDriver运行Java Selenium WebDriver时,Firefox无法连接

[英]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.

相关问题 在 Java 程序 (Firefox) 中使用 Selenium Webdriver 获取无法连接错误 - Getting cannot connect error using Selenium Webdriver in Java program (Firefox) org.openqa.selenium.WebDriverException: java.net.ConnectException: 无法使用 GeckoDriver Firefox 和 Selenium 连接到 localhost/0:0:0:0:0:0:0 - org.openqa.selenium.WebDriverException: java.net.ConnectException: Failed to connect to localhost/0:0:0:0:0:0:0 using GeckoDriver Firefox and Selenium Selenium Webdriver刚刚停止使用GeckoDriver在Firefox浏览器上工作 - Selenium webdriver just stop working for Firefox browser with GeckoDriver 错误“org.openqa.selenium.WebDriverException: java.net.ConnectException: Failed to connect to localhost/” with GeckoDriver 和 Firefox - error“ org.openqa.selenium.WebDriverException: java.net.ConnectException: Failed to connect to localhost/” with GeckoDriver and Firefox WebDriverException:无法使用 GeckoDriver Firefox 和 Selenium Java 连接到二进制 FirefoxBinary(C:\\Program Files\\Mozilla Firefox\\firefox.exe) - WebDriverException: Failed to connect to binary FirefoxBinary(C:\Program Files\Mozilla Firefox\firefox.exe) with GeckoDriver Firefox and Selenium Java Selenium Webdriver(Java)与Firefox扩展/插件连接/互操作 - Selenium Webdriver (Java) connect/interoperate with a Firefox extension/plugin Selenium,Firefox和GeckoDriver - Selenium, Firefox and GeckoDriver Selenium WebDriver测试(Java)后无法关闭Firefox窗口 - Cannot close Firefox window after Selenium WebDriver test (Java) 无法在没有UI的框中以Java启动selenium.WebDriver firefox - cannot start selenium.WebDriver firefox in java in a box with no UI 在Eclipse中的Java中执行Selenium WebDriver Firefox时显示错误异常? - Error exception is displayed when Selenium WebDriver Firefox executing in Java in Eclipse?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM