Exception in thread "main" org.openqa.selenium.WebDriverException: connection refused

1,409 views
Skip to first unread message

Laveen sharma

unread,
Jul 18, 2018, 6:08:48 AM7/18/18
to Selenium Users
package Demo;

import java.util.concurrent.TimeUnit;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class FindByClassName {

public static void main(String[] args)  {
System.setProperty("webdriver.gecko.driver","C:\\Users\\lsharma1\\Desktop\\Selenium Drivers\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();
driver.get(url);
driver.manage().window().maximize();
driver.findElement(By.id("textfield-1044-inputEl")).sendKeys("Super2");
driver.findElement(By.id("textfield-1045-inputEl")).sendKeys("Respond");
driver.findElement(By.id("combo-1046-trigger-picker")).click();
driver.findElement(By.id("textfield-1045-inputEl")).click();
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
//driver.findElement(By.id("combo-1047-trigger-picker")).click();
driver.findElement(By.className("x-btn-button x-btn-button-default-small x-btn-button-center x-btn-text")).click();
driver.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS);

}

}





Console log:


1531906201694 geckodriver INFO geckodriver 0.21.0
1531906201718 geckodriver INFO Listening on 127.0.0.1:27067
1531906202328 mozrunner::runner INFO Running command: "C:\\Program Files\\Mozilla Firefox\\firefox.exe" "-marionette" "-foreground" "-no-remote" "-profile" "C:\\Users\\lsharma1\\AppData\\Local\\Temp\\rust_mozprofile.dKKNIJecLXcK"
1531906205524 Marionette INFO Listening on port 2828
Exception in thread "main" org.openqa.selenium.WebDriverException: connection refused
Build info: version: '3.9.1', revision: '63f7b50', time: '2018-02-07T22:42:22.379Z'
System info: host: 'APT04-6022HZ1', ip: '10.183.229.160', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '10.0.1'
Driver info: driver.version: FirefoxDriver
remote stacktrace: 
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.base/java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$new$0(W3CHandshakeResponse.java:57)
at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$getResponseFunction$2(W3CHandshakeResponse.java:104)
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:123)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
at java.base/java.util.Spliterators$ArraySpliterator.tryAdvance(Unknown Source)
at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(Unknown Source)
at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(Unknown Source)
at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
at java.base/java.util.stream.FindOps$FindOp.evaluateSequential(Unknown Source)
at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
at java.base/java.util.stream.ReferencePipeline.findFirst(Unknown Source)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:73)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:138)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:219)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:142)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:120)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:98)
at Demo.FindByClassName.main(FindByClassName.java:15)

Nick Kulungian

unread,
Jul 18, 2018, 10:09:34 PM7/18/18
to Selenium Users
To me this seems like Selenium/Java doesn't have access to your network. Like how a popup dialog comes up asking if you want to accept connections, listing Private and public networks as options. I'm not 100% sure you have to do this with selenium. Aside from that, are you able to access google.com with selenium? If so, then it could possibly be a problem with the site, or an issue with your firewall or antivirus software.

total-qa

unread,
Jul 19, 2018, 4:18:48 AM7/19/18
to Selenium Users
This will occurs mainly due to compatibility issues.
Please check the below configuration.

FF - Latest
Selenium - 3.13
Gecko driver latest version.

Regards,
Reply all
Reply to author
Forward
0 new messages