Connection reset(WebDriver Exception) in appium

Hi all I got an exception name webdriverException: Connection reset on some elements during my IOS script running, I am using appium v1.8.0. It’s is not happening every-time but some time on many elements, When I catch this exception and try to use same action it works.
Configuration:
I am using Appium v1.8.0, java-client-5.0.0-BETA6, jdk1.8.0_171.jdk

cap.setCapability(MobileCapabilityType.PLATFORM, “iOS”);
cap.setCapability(MobileCapabilityType.AUTOMATION_NAME, “XCUITest”);
cap.setCapability(MobileCapabilityType.PLATFORM_VERSION, “11.4”);
cap.setCapability(MobileCapabilityType.DEVICE_NAME, “iPhone 7 Plus”);
cap.setCapability(MobileCapabilityType.BROWSER_NAME, “”);
cap.setCapability(MobileCapabilityType.SUPPORTS_ALERTS, true);
cap.setCapability(MobileCapabilityType.CLEAR_SYSTEM_FILES, true);
cap.setCapability(MobileCapabilityType.SUPPORTS_FINDING_BY_CSS, true);
cap.setCapability(“useNewWDA”, true);
cap.setCapability(“webviewConnectRetries”, “25”);
cap.setCapability(“usePrebuiltWDA”, true);
cap.setCapability(“simpleIsVisibleCheck”, false);
cap.setCapability(“webStorageEnabled”, false);
cap.setCapability(“locationContextEnabled”, false);
cap.setCapability(“javascriptEnabled”, true);
cap.setCapability(“platform”, “MAC”);
cap.setCapability(“webkitResponseTimeout”, “2000”);
cap.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, “120”);
cap.setCapability(MobileCapabilityType.APP, “APP Bundle id”);
driver = new IOSDriver (new URL(“http://0.0.0.0:4723/wd/hub”), cap);

Exception:

org.openqa.selenium.WebDriverException: java.net.SocketException: Connection reset
Build info: version: ‘3.3.1’, revision: ‘5234b325d5’, time: ‘2017-03-10 09:10:29 +0000’
System info: host: ‘C02W3BF6HTD6’, ip: ‘fe80:0:0:0:1cf3:2859:a854:82a0%en0’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.13.4’, java.version: ‘1.8.0_171’
Driver info: driver.version: IOSDriver
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:177)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:604)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.ios.IOSDriver.execute(IOSDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver$RemoteWebDriverOptions$RemoteTimeouts.implicitlyWait(RemoteWebDriver.java:835)
at io.appium.java_client.pagefactory.AppiumElementLocator.changeImplicitlyWaitTimeOut(AppiumElementLocator.java:81)
at io.appium.java_client.pagefactory.AppiumElementLocator.waitFor(AppiumElementLocator.java:87)
at io.appium.java_client.pagefactory.AppiumElementLocator.findElement(AppiumElementLocator.java:112)
at io.appium.java_client.pagefactory.interceptors.InterceptorOfASingleElement.intercept(InterceptorOfASingleElement.java:61)
at io.appium.java_client.ios.IOSElement$$EnhancerByCGLIB$$d311658.click()
at Main.Regression.TabBarMyAccountSelection(Regression.java:344)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:348)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:343)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:305)
at org.testng.SuiteRunner.run(SuiteRunner.java:254)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
at org.testng.TestNG.run(TestNG.java:1057)
at org.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:72)
at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:123)
Caused by: java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:210)
at java.net.SocketInputStream.read(SocketInputStream.java:141)
at org.apache.http.impl.conn.LoggingInputStream.read(LoggingInputStream.java:87)
at org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:139)
at org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.java:155)
at org.apache.http.impl.io.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:284)
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:140)
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:57)
at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:261)
at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:165)
at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:167)
at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:272)
at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:124)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:271)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55)
at org.openqa.selenium.remote.internal.ApacheHttpClient.fallBackExecute(ApacheHttpClient.java:142)
at org.openqa.selenium.remote.internal.ApacheHttpClient.execute(ApacheHttpClient.java:88)
at io.appium.java_client.remote.AppiumCommandExecutor.doExecute(AppiumCommandExecutor.java:132)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:162)
… 34 more

I am using Appium v1.8.0, java-client-5.0.0-BETA6, jdk1.8.0_171.jdk

Same on Android, after updating to 6.0.0 when trying to take sceenshot or get current activity

Can you include the appium log as well? Are these real phones or simulators? Is the stacktrace when upgrading to java-client 6.0.0 stable the same?

I’m facing the same issue - could anyone find a solution?

Appium 1.8.1
Java-Client 6.0.0

I also got an exception:

org.openqa.selenium.WebDriverException: java.io.IOException: unexpected end of stream on Connection{0.0.0.0:4726, proxy=DIRECT hostAddress=/0.0.0.0:4726 cipherSuite=none protocol=http/1.1}
Build info: version: ‘3.12.0’, revision: ‘7c6e0b3’, time: ‘2018-05-08T14:04:26.12Z’
System info: host: ‘build-ios3.local’, ip: ‘fe80:0:0:0:ccf:2108:f18a:f464%en0’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.13.5’, java.version: ‘1.8.0_161’
Driver info: driver.version: IOSDriver

1 Like

Hey, how did you solve the problem?Can you please share?

Bug has been fixed in Appium v1.8.1. What you can do also is to try catch the line of code where this happens and call it again - it works.

Please find this ticket where it is discussed.
The solution is - Please upgrade Java-Client to 6.1.0 which should fix the issue. I did and working fine with no connection reset error.