org.openqa.selenium.WebDriverException: Connection refused (Connection refused)

facing the below error while starting Appium using java code.
org.openqa.selenium.WebDriverException:
Connection refused (Connection refused)
Build info: version: ‘3.11.0’, revision: ‘e59cfb3’, time: ‘2018-03-11T20:26:55.152Z’
System info: host: ‘administratotr-Latitude-E5570’, ip: ‘127.0.1.1’, os.name: ‘Linux’, os.arch: ‘amd64’, os.version: ‘3.19.0-30-generic’, java.version: ‘1.8.0_171’
Driver info: driver.version: AndroidDriver
Caused by: java.net.ConnectException: Connection refused (Connection refused)

1 Like

Please include the stacktrace and appium.log for triaging. Also what are your capabilities, and how are you starting the appium server?

Try ‘127.0.0.1’ (loopback) or better ‘0.0.0.0’ (INADDR_ANY)

You don’t bother to include the linux distro you are using. ‘127.0.1.1’ should be the loopback interface also, but can have slightly different behaviors depending on the linux distro you are using. It can also be just plain wrong.

Starting Appium by java programme.

Please include the capabilities, stacktrace, and appium log.

Any update on this? I also get the error when running on bamboo agent. Works fine locally. I connect to 127.0.0.1 using specific port.
(new URL("http://127.0.0.1:" + port + "/wd/hub"), capabilities)
And when I check the used ports, I don’t see that ports in use.