简体   繁体   中英

Firefox Cannot Connect When Running Java Selenium WebDriver With GeckoDriver

I am trying to run my Selenium test script with Firefox. So far, it works fine with Chrome but Firefox says "Firefox can't establish a connection to the server at [any uri]". 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. 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:

org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms

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. 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,所有事情对我来说都很好

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM