How to capture SessionNotFoundException thrown by webdriver because of appium session timeout - selenium-webdriver

I need to handle the following exception thrown by my suite when running the test on Chrome browser on Android real device using Appium 1.4.16.1. I believe the exception is thrown because of a timeout (set to 10s) on Appium, after which the session is deleted. However, once the exception is thrown by Selenium Webdriver (at line wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath(UILoc)))), it is not caught using catch block and any further execution is hanged.
Note that same test case when executed on desktop chrome browser is able to catch the exception.
Please let me know if there is a way to catch this, as I need to do further handling. Note that I can avoid the situation by increasing timeout of Appium session. However, I still want to handle the max limit.
Appium Timeout Logs
> info: --> POST /wd/hub/session/5ff4eaccea1df145b80f6df4af4c3d7b/url {"url":"http://test.com"}
> info: JSONWP Proxy: Proxying [POST /wd/hub/session/5ff4eaccea1df145b80f6df4af4c3d7b/url] to [POST hubsession] with body: {"url":"http://test.com"}
> info: [debug] Didn't get a new command in 10 secs, shutting down...
> info: Shutting down appium session
> info: Chromedriver: Changed state to 'stopping'
> info: JSONWP Proxy: Proxying [DELETE /] to [DELETE hubsession] with no body
> info: JSONWP Proxy: Got response with status 200: {"sessionId":"5ff4eaccea1df145b80f6df4af4c3d7b","status":0,"value":null}
> info: JSONWP Proxy: Replacing sessionId 5ff4eaccea1df145b80f6df4af4c3d7b with 5ff4eaccea1df145b80f6df4af4c3d7b
> info: <-- POST /wd/hub/session/5ff4eaccea1df145b80f6df4af4c3d7b/url 200 110858.244 ms - 72
> info: --> POST /wd/hub/session/5ff4eaccea1df145b80f6df4af4c3d7b/element {"using":"xpath","value":"//div[#id='form-1010']"}
> info: JSONWP Proxy: Proxying [POST /wd/hub/session/5ff4eaccea1df145b80f6df4af4c3d7b/element] to [POST hubsession] with body: {"using":"xpath","value":"//div[#id='form-1010']"}
> info: JSONWP Proxy: Got response with status 200: "{\"sessionId\":\"5ff4eaccea1df145b80f6df4af4c3d7b\",\"status\":0,\"value\":null}"
> info: JSONWP Proxy: Got response with status 200: {"sessionId":"","status":6,"value":{"message":"no such session\n (Driver info: chromedriver=2.23.409699 (49b0fa931cda1caad0ae15b7d1b68004acd05129),platform=Windows NT 10.0.10586 x86_64)"}}
> info: <-- POST /wd/hub/session/5ff4eaccea1df145b80f6df4af4c3d7b/element 200 743.048 ms - 189
> info: Chromedriver: Changed state to 'stopped'
> info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"shutdown"}
> info: [debug] [BOOTSTRAP] [debug] Got command of type SHUTDOWN
> info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":"OK, shutting down","status":0}
> info: [debug] [BOOTSTRAP] [debug] Closed client connection
Webdriver Exception Logs
Aug 17, 2016 12:49:44 AM org.openqa.selenium.support.ui.ExpectedConditions findElement
WARNING: WebDriverException thrown by findElement(By.xpath: //div[#id='form-1010'])
org.openqa.selenium.remote.SessionNotFoundException: no such session
(Driver info: chromedriver=2.23.409699 (49b0fa931cda1caad0ae15b7d1b68004acd05129),platform=Windows NT 10.0.10586 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 753 milliseconds
Build info: version: '2.53.0', revision: '35ae25b', time: '2016-03-15 17:00:58'
System info: host: 'Pune832', ip: '10.10.148.44', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_60'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, chrome={chromedriverVersion=2.23.409699 (49b0fa931cda1caad0ae15b7d1b68004acd05129)}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=true, version=52.0.2743.98, platform=ANDROID, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: 5ff4eaccea1df145b80f6df4af4c3d7b
*** Element info: {Using=xpath, value=//div[#id='form-1010']}
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:363)
at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:500)
at org.openqa.selenium.By$ByXPath.findElement(By.java:361)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:355)
at org.openqa.selenium.support.ui.ExpectedConditions.findElement(ExpectedConditions.java:899)
at org.openqa.selenium.support.ui.ExpectedConditions.access$0(ExpectedConditions.java:897)
at org.openqa.selenium.support.ui.ExpectedConditions$6.apply(ExpectedConditions.java:181)
at org.openqa.selenium.support.ui.ExpectedConditions$6.apply(ExpectedConditions.java:1)
at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:238)

It is not able to find element using the given xpath. *** Element info: {Using=xpath, value=//div[#id='form-1010']}
Since you are using ID as locator so I would suggest to use the below code -
driver.findElements(By.id("form-1010"));
I use the below code to check if element is present or not. If element is not present, it will capture error logs.
protected boolean isElementPresent(By by) throws IOException {
boolean isElement = false;
try
{
if (driver.findElement(by) != null)
{
isElement = true;
return isElement;
}
}
catch(Exception e)
{
System.out.println(e);
System.out.println("Element not found");
isElement = false;
return isElement;
}
return isElement;
}

Try increasing timeout 60 seconds when launching the appium server. Timeout can be passed as argument to the appium server.
--command-timeout 60
The default command timeout for the server to use for all sessions. Will still be overridden by newCommandTimeout cap`

Related

Unable to start appium server programmatically. Error: spawn ENOTDIR

I am trying to launch appium server using 'AppiumServiceBuilder' in mac. I am referring the following website:
https://appiumpro.com/editions/71
I am using the following code:
AppiumServiceBuilder serviceBuilder = new AppiumServiceBuilder();
serviceBuilder.usingAnyFreePort();
serviceBuilder.usingDriverExecutable(new File("/usr/local/bin/node"));
serviceBuilder.withAppiumJS(new File("/usr/local/bin/appium"));
HashMap<String, String> environment = new HashMap();
environment.put("PATH", "/usr/local/bin/carthage");
serviceBuilder.withEnvironment(environment);
server = AppiumDriverLocalService.buildService(TLDriverFactory.serviceBuilder);
server.start();
while starting the appium am using this:
capabilities.setCapability("automationName", "XCUITest");
capabilities.setCapability("platformName", "iOS");
capabilities.setCapability("platformVersion","12.3.1");
capabilities.setCapability("deviceName", "iPhone 6");
capabilities.setCapability("udid", getDeviceID());
capabilities.setCapability("bundleId", getBundleId());
capabilities.setCapability("noReset", true);
capabilities.setCapability("waitForQuiescence", false);
capabilities.setCapability("useJSONSource", true);
iDriver = new IOSDriver<IOSElement>(server.getUrl(),capabilities);
This is the console message am getting during the iDriver initialization:
[35m[HTTP][39m [37m-->[39m [37mPOST[39m [37m/wd/hub/session[39m
[35m[HTTP][39m [90m{"desiredCapabilities":{"waitForQuiescence":false,"noReset":true,"useJSONSource":true,"platformVersion":"12.3.1","automationName":"XCUITest","bundleId":"com.tekion.cdmsmobileenterprise","platformName":"iOS","udid":"cc6080c50dad4605d8e5511e89410792f0100026","deviceName":"iPhone 6"},"capabilities":{"alwaysMatch":{"appium:automationName":"XCUITest","appium:bundleId":"com.tekion.cdmsmobileenterprise","appium:deviceName":"iPhone 6","appium:noReset":true,"platformName":"ios","appium:platformVersion":"12.3.1","appium:udid":"cc6080c50dad4605d8e5511e89410792f0100026","useJSONSource":true,"waitForQuiescence":false},"firstMatch":[{}]}}[39m
[debug] [35m[W3C][39m Calling AppiumDriver.createSession() with args: [{"waitForQuiescence":false,"noReset":true,"useJSONSource":true,"platformVersion":"12.3.1","automationName":"XCUITest","bundleId":"com.tekion.cdmsmobileenterprise","platformName":"iOS","udid":"cc6080c50dad4605d8e5511e89410792f0100026","deviceName":"iPhone 6"},null,{"alwaysMatch":{"appium:automationName":"XCUITest","appium:bundleId":"com.tekion.cdmsmobileenterprise","appium:deviceName":"iPhone 6","appium:noReset":true,"platformName":"ios","appium:platformVersion":"12.3.1","appium:udid":"cc6080c50dad4605d8e5511e89410792f0100026","useJSONSource":true,"waitForQuiescence":false},"firstMatch":[{}]}]
[debug] [35m[BaseDriver][39m Event 'newSessionRequested' logged at 1568395822117 (23:00:22 GMT+0530 (India Standard Time))
[35m[BaseDriver][39m The capabilities ["useJSONSource","waitForQuiescence"] are not standard capabilities and should have an extension prefix
[35m[Appium][39m Appium v1.13.0 creating new XCUITestDriver (v2.113.2) session
[35m[Appium][39m Capabilities:
[35m[Appium][39m platformName: ios
[35m[Appium][39m useJSONSource: true
[35m[Appium][39m waitForQuiescence: false
[35m[Appium][39m automationName: XCUITest
[35m[Appium][39m bundleId: com.tekion.cdmsmobileenterprise
[35m[Appium][39m deviceName: iPhone 6
[35m[Appium][39m noReset: true
[35m[Appium][39m platformVersion: 12.3.1
[35m[Appium][39m udid: cc6080c50dad4605d8e5511e89410792f0100026
[debug] [35m[BaseDriver][39m W3C capabilities {"alwaysMatch":{"platformNa... and MJSONWP desired capabilities {"waitForQuiescence":false,... were provided
[debug] [35m[BaseDriver][39m Creating session with W3C capabilities: {"alwaysMatch":{"platformNa...
[35m[BaseDriver][39m Session created with session id: 7e5f96b0-2540-41d4-9d2f-4153ffef9cd3
[debug] [35m[XCUITest][39m Unable to get username running server: spawn ENOTDIR
[35m[XCUITest][39m Error: spawn ENOTDIR
[35m[XCUITest][39m at ChildProcess.spawn (internal/child_process.js:394:11)
[35m[XCUITest][39m at spawn (child_process.js:540:9)
[35m[XCUITest][39m at /usr/local/lib/node_modules/appium/node_modules/teen_process/lib/exec.js:30:16
[35m[XCUITest][39m at Promise.cancellationExecute [as _execute] (/usr/local/lib/node_modules/appium/node_modules/bluebird/js/release/debuggability.js:335:9)
[35m[XCUITest][39m at Promise._resolveFromExecutor (/usr/local/lib/node_modules/appium/node_modules/bluebird/js/release/promise.js:483:18)
[35m[XCUITest][39m at new Promise (/usr/local/lib/node_modules/appium/node_modules/bluebird/js/release/promise.js:79:10)
[35m[XCUITest][39m at exec (/usr/local/lib/node_modules/appium/node_modules/teen_process/lib/exec.js:27:10)
[35m[XCUITest][39m at getConnectedDevices (/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/real-device-management.js:8:26)
[35m[XCUITest][39m at XCUITestDriver.determineDevice (/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:762:31)
[35m[XCUITest][39m at XCUITestDriver.determineDevice [as start] (/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:269:51)
[35m[XCUITest][39m at runNextTicks (internal/process/task_queues.js:58:5)
[35m[XCUITest][39m at processImmediate (internal/timers.js:412:9)
[35m[XCUITest][39m at XCUITestDriver.createSession (/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:206:7)
[35m[XCUITest][39m at AppiumDriver.createSession (/usr/local/lib/node_modules/appium/lib/appium.js:342:35)
[35m[XCUITest][39m at AppiumDriver.executeCommand (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/basedriver/driver.js:319:13)
[35m[XCUITest][39m at AppiumDriver.executeCommand (/usr/local/lib/node_modules/appium/lib/appium.js:471:14)
[35m[XCUITest][39m at asyncHandler (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/protocol.js:352:21)
[debug] [35m[BaseDriver][39m Event 'newSessionStarted' logged at 1568395822141 (23:00:22 GMT+0530 (India Standard Time))
[debug] [35m[W3C][39m Encountered internal error running command: Error: spawn ENOTDIR
[debug] [35m[W3C][39m at ChildProcess.spawn (internal/child_process.js:394:11)
[debug] [35m[W3C][39m at spawn (child_process.js:540:9)
[debug] [35m[W3C][39m at /usr/local/lib/node_modules/appium/node_modules/teen_process/lib/exec.js:30:16
[debug] [35m[W3C][39m at Promise.cancellationExecute [as _execute] (/usr/local/lib/node_modules/appium/node_modules/bluebird/js/release/debuggability.js:335:9)
[debug] [35m[W3C][39m at Promise._resolveFromExecutor (/usr/local/lib/node_modules/appium/node_modules/bluebird/js/release/promise.js:483:18)
[debug] [35m[W3C][39m at new Promise (/usr/local/lib/node_modules/appium/node_modules/bluebird/js/release/promise.js:79:10)
[debug] [35m[W3C][39m at exec (/usr/local/lib/node_modules/appium/node_modules/teen_process/lib/exec.js:27:10)
[debug] [35m[W3C][39m at getConnectedDevices (/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/real-device-management.js:8:26)
[debug] [35m[W3C][39m at XCUITestDriver.determineDevice (/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:762:31)
[debug] [35m[W3C][39m at XCUITestDriver.determineDevice [as start] (/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:269:51)
[debug] [35m[W3C][39m at runNextTicks (internal/process/task_queues.js:58:5)
[debug] [35m[W3C][39m at processImmediate (internal/timers.js:412:9)
[debug] [35m[W3C][39m at XCUITestDriver.createSession (/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:206:7)
[debug] [35m[W3C][39m at AppiumDriver.createSession (/usr/local/lib/node_modules/appium/lib/appium.js:342:35)
[debug] [35m[W3C][39m at AppiumDriver.executeCommand (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/basedriver/driver.js:319:13)
[debug] [35m[W3C][39m at AppiumDriver.executeCommand (/usr/local/lib/node_modules/appium/lib/appium.js:471:14)
[debug] [35m[W3C][39m at asyncHandler (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/protocol.js:352:21)
[35m[HTTP][39m [37m<-- POST /wd/hub/session [39m[31m500[39m [90m28 ms - 523[39m
[35m[HTTP][39m [90m[39m
org.openqa.selenium.WebDriverException: It is impossible to create a new session because 'createSession' which takes HttpClient, InputStream and long was not found or it is not accessible
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'Abduls-MacBook-Pro-2.local', ip: '2402:3a80:464:2a24:6980:fa71:954a:5c2b%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.6', java.version: '12'
Driver info: driver.version: IOSDriver
at io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:195)
at io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:209)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:231)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
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.startSession(RemoteWebDriver.java:213)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
at io.appium.java_client.DefaultGenericMobileDriver.<init>(DefaultGenericMobileDriver.java:38)
at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:84)
at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:94)
at io.appium.java_client.ios.IOSDriver.<init>(IOSDriver.java:95)
at com.utilities.TLDriverFactory.initializeIOSDriver(TLDriverFactory.java:225)
at com.utilities.TLDriverFactory.setTLDriver(TLDriverFactory.java:134)
at com.utilities.Tek_Properties.beforeMethodReporting(Tek_Properties.java:257)
at com.utilities.Mobile_TestBase.initializWebDriver(Mobile_TestBase.java:162)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124)
at org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:59)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:458)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:222)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:523)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:719)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:989)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
at org.testng.TestRunner.privateRun(TestRunner.java:648)
at org.testng.TestRunner.run(TestRunner.java:505)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:455)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:415)
at org.testng.SuiteRunner.run(SuiteRunner.java:364)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1208)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1137)
at org.testng.TestNG.runSuites(TestNG.java:1049)
at org.testng.TestNG.run(TestNG.java:1017)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:115)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)
Caused by: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:185)
... 44 more
Caused by: org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: spawn ENOTDIR
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'Abduls-MacBook-Pro-2.local', ip: '2402:3a80:464:2a24:6980:fa71:954a:5c2b%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.6', java.version: '12'
Driver info: driver.version: IOSDriver
remote stacktrace: UnknownError: An unknown server-side error occurred while processing the command. Original error: spawn ENOTDIR
at getResponseForW3CError (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/errors.js:826:9)
at asyncHandler (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/protocol.js:447:37)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$errorHandler$0(W3CHandshakeResponse.java:62)
at org.openqa.selenium.remote.HandshakeResponse.lambda$getResponseFunction$0(HandshakeResponse.java:30)
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:126)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
at java.base/java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:127)
at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:502)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:488)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:543)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:128)
... 49 more
I googled and found that the spawn : enotdir is due to missing phantomJS. I did it:
brew cask install phantomjs
node rebuild
I am still getting the issue.
I have two questions:
1. How to resolve this issue and make it work?
2. While launching iDriver, why it says 'The capabilities ["useJSONSource","waitForQuiescence"] are not standard capabilities and should have an extension prefix'? Does that mean these capabilities won't work if appium is launched via AppiumServiceBuilder?
Mac version: macOS Mojave 10.14.6
Appium Version: 1.13.0
Appium Java Client: 6.1.0 (Tried with 7.2.0 as well)
Selenium Version: 3.4.0
I tried with this code:
AppiumServiceBuilder serviceBuilder = new AppiumServiceBuilder();
serviceBuilder.usingAnyFreePort();
serviceBuilder.usingDriverExecutable(new File("/usr/local/bin/node"));
serviceBuilder.withAppiumJS(new File("/usr/local/bin/appium"));
HashMap<String, String> environment = new HashMap();
environment.put("PATH", "/usr/local/bin:" + System.getenv("PATH"));
serviceBuilder.withEnvironment(environment);
server.set(AppiumDriverLocalService.buildService(serviceBuilder));
server.get().start();
This worked fine for me.

I am getting 80% time error on running protractor scripts on IE 11

My protractor scripts are highly stable on chrome browser but the same scripts throws below mentioned for 20% of the test cases.
Failed: JavaScript error (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 100 milliseconds
Build info: version: '3.3.1', revision: '5234b32', time: '2017-03-10 09:04:52 -0800'
System info: host: 'LAPTOP-RNQ2JQBE', ip: '192.168.89.115', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_121'
Driver info: org.openqa.selenium.ie.InternetExplorerDriver
Capabilities [{browserAttachTimeout=0, ie.enableFullPageScreenshot=true, enablePersistentHover=true, ie.forceCreateProcessApi=false, ie.forceShellWindowsApi=false, pageLoadStrategy=normal, ignoreZoomSetting=true, ie.fileUploadDialogTimeout=3000, version=11, platform=WINDOWS, nativeEvents=true, ie.ensureCleanSession=false, elementScrollBehavior=0, ie.browserCommandLineSwitches=, requireWindowFocus=false, browserName=internet explorer, initialBrowserUrl=http://localhost:41897/, javascriptEnabled=true, ignoreProtectedModeSettings=false, enableElementCacheCleanup=true, unexpectedAlertBehaviour=dismiss}]
Session ID: f32d0eb8-65d9-4161-9535-da5cde8b9a6c
Failed: Error while waiting for Protractor to sync with the page:
"Unable to get property '$$testability' of undefined or null
reference"

Webdriver Click not working for chrome on Android devices

I am trying to automate a web application on android device using Selenium webdriver and appium. However am stuck because click() seems to be not working for chrome browser on Android devices, same works for chrome browser on desktop.
Please see attached test code to reproduce the issue on gmail.com and also appium console logs. Not sure if this an issue with chromeDriver or needs to implemented some other way.
Code
import java.net.MalformedURLException;
import java.net.URL;
import org.openqa.selenium.By;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
public class TestMobileBrowser {
public DesiredCapabilities capabilities;
public RemoteWebDriver driver;
#BeforeTest
public void beforeTest() throws MalformedURLException{
capabilities = new DesiredCapabilities();
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("deviceName", "Android");
capabilities.setCapability("browserName", "chrome");
capabilities.setCapability("newCommandTimeout", 60);
driver = new RemoteWebDriver(new URL("http://localhost:4723/wd/hub"), capabilities);
}
#Test
public void test(){
driver.get("http://gmail.com");
driver.findElement(By.id("Email")).sendKeys("test");
driver.findElement(By.id("next")).click();
driver.findElement(By.id("Passwd")).sendKeys("test");
driver.findElement(By.id("signIn")).click();
}
}
Appium logs
> info: --> POST /wd/hub/session {"desiredCapabilities":{"newCommandTimeout":60,"browserName":"chrome","platformName":"Android","deviceName":"Android"}}
> info: Client User-Agent string: Apache-HttpClient/4.5.1 (Java/1.8.0_60)
> info: Set mode: Proxying straight through to Chromedriver
> info: [debug] Looks like we want chrome on android
> info: [debug] Creating new appium session b061da72-cfb4-4d06-8595-b9fe52439d37
> info: [debug] Checking whether adb is present
> info: [debug] Using adb from D:\eGain\Automation\Android\sdk\platform-tools\adb.exe
> info: [debug] Using fast reset? true
> info: [debug] Preparing device for session
> info: [debug] Not checking whether app is present since we are assuming it's already on the device
> info: Retrieving device
> info: [debug] Trying to find a connected android device
> info: [debug] Getting connected devices...
> info: [debug] executing cmd: D:\eGain\Automation\Android\sdk\platform-tools\adb.exe devices
> info: [debug] 1 device(s) connected
> info: Found device a33124a7
> info: [debug] Setting device id to a33124a7
> info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
> info: [debug] executing cmd: D:\eGain\Automation\Android\sdk\platform-tools\adb.exe -s a33124a7 wait-for-device
> info: [debug] executing cmd: D:\eGain\Automation\Android\sdk\platform-tools\adb.exe -s a33124a7 shell "echo 'ready'"
> info: [debug] Starting logcat capture
> info: [debug] Pushing unlock helper app to device...
> info: [debug] executing cmd: D:\eGain\Automation\Android\sdk\platform-tools\adb.exe -s a33124a7 install "C:\Program Files (x86)\Appium\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk"
> info: [debug] executing cmd: D:\eGain\Automation\Android\sdk\platform-tools\adb.exe -s a33124a7 shell "dumpsys window"
> info: Unlocking screen
> info: [debug] Screen is locked, trying to unlock
> info: [debug] Getting device API level
> info: [debug] executing cmd: D:\eGain\Automation\Android\sdk\platform-tools\adb.exe -s a33124a7 shell "getprop ro.build.version.sdk"
> info: [debug] Device is at API Level 23
> info: [debug] executing cmd: D:\eGain\Automation\Android\sdk\platform-tools\adb.exe -s a33124a7 shell "am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n io.appium.unlock/.Unlock"
> info: [debug] executing cmd: D:\eGain\Automation\Android\sdk\platform-tools\adb.exe -s a33124a7 shell "dumpsys window"
> info: [debug] Screen is unlocked, continuing
> info: [debug] Forwarding system:4724 to device:4724
> info: [debug] executing cmd: D:\eGain\Automation\Android\sdk\platform-tools\adb.exe -s a33124a7 forward tcp:4724 tcp:4724
> info: [debug] Pushing appium bootstrap to device...
> info: [debug] executing cmd: D:\eGain\Automation\Android\sdk\platform-tools\adb.exe -s a33124a7 push "C:\\Program Files (x86)\\Appium\\node_modules\\appium\\build\\android_bootstrap\\AppiumBootstrap.jar" /data/local/tmp/
> info: Starting App
> info: [debug] Attempting to kill all 'uiautomator' processes
> info: [debug] Getting all processes with 'uiautomator'
> info: [debug] executing cmd: D:\eGain\Automation\Android\sdk\platform-tools\adb.exe -s a33124a7 shell "ps 'uiautomator'"
> info: [debug] No matching processes found
> info: [debug] Running bootstrap
> info: [debug] spawning: D:\eGain\Automation\Android\sdk\platform-tools\adb.exe -s a33124a7 shell uiautomator runtest AppiumBootstrap.jar -c io.appium.android.bootstrap.Bootstrap -e pkg com.android.chrome -e disableAndroidWatchers false
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
> info: [debug] [UIAUTOMATOR STDOUT] io.appium.android.bootstrap.Bootstrap:
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 1
> info: [debug] [BOOTSTRAP] [debug] Socket opened on port 4724
> info: [debug] [BOOTSTRAP] [debug] Appium Socket Server Ready
> info: [debug] [BOOTSTRAP] [debug] Loading json...
> info: [debug] [BOOTSTRAP] [debug] Registered crash watchers.
> info: [debug] Pushing command to appium work queue: ["getDataDir",{}]
> info: [debug] [BOOTSTRAP] [debug] Client connected
> info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"getDataDir","params":{}}
> info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
> info: [debug] [BOOTSTRAP] [debug] Got command action: getDataDir
> info: [debug] dataDir set to: /data/local/tmp
> info: Chromedriver: Changed state to 'starting'
> info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":"\/data\/local\/tmp"}
> info: Chromedriver: Set chromedriver binary as: C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-chromedriver\chromedriver\win\chromedriver.exe
> info: Chromedriver: Killing any old chromedrivers, running: FOR /F "usebackq tokens=5" %a in (`netstat -nao ^| findstr /R /C:"9515 "`) do (FOR /F "usebackq" %b in (`TASKLIST /FI "PID eq %a" ^| findstr /I chromedriver.exe`) do (IF NOT %b=="" TASKKILL /F /PID %a))
> info: Chromedriver: No old chromedrivers seemed to exist
> info: Chromedriver: Spawning chromedriver with: C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-chromedriver\chromedriver\win\chromedriver.exe --url-base=wd/hub --port=9515
> info: Chromedriver: [STDOUT] Starting ChromeDriver 2.23.409699 (49b0fa931cda1caad0ae15b7d1b68004acd05129) on port 9515
> Only local connections are allowed.
> info: JSONWP Proxy: Proxying [GET /status] to [GET http://127.0.0.1:9515/wd/hub/status] with no body
> info: JSONWP Proxy: Got response with status 200: "{\"sessionId\":\"\",\"status\":0,\"value\":{\"build\":{\"version\":\"alpha\"},\"os\":{\"arch\":\"x86_64\",\"name\":\"Windows NT\",\"version\":\"10.0.10586\"}}}"
> info: JSONWP Proxy: Proxying [POST /session] to [POST http://127.0.0.1:9515/wd/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"com.android.chrome","androidDeviceSerial":"a33124a7"}}}
> info: JSONWP Proxy: Got response with status 200: {"sessionId":"0ebf4514a9760982649f45ce431656e8","status":0,"value":{"acceptSslCerts":true,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"browserName":"chrome","chrome":{"chromedr...
> info: Chromedriver: Changed state to 'online'
> info: [debug] Overriding session id with "0ebf4514a9760982649f45ce431656e8"
> info: [debug] Device launched! Ready for commands
> info: [debug] Setting command timeout to 60 secs
> info: [debug] Appium session started with sessionId 0ebf4514a9760982649f45ce431656e8
> info: <-- POST /wd/hub/session 303 18667.504 ms - 70
> info: --> GET /wd/hub/session/0ebf4514a9760982649f45ce431656e8 {}
> info: JSONWP Proxy: Proxying [GET /wd/hub/session/0ebf4514a9760982649f45ce431656e8] to [GET http://127.0.0.1:9515/wd/hub/session/0ebf4514a9760982649f45ce431656e8] with body: {}
> info: JSONWP Proxy: Got response with status 200: {"sessionId":"0ebf4514a9760982649f45ce431656e8","status":0,"value":{"acceptSslCerts":true,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"browserName":"chrome","chrome":{"chromedr...
> info: JSONWP Proxy: Replacing sessionId 0ebf4514a9760982649f45ce431656e8 with 0ebf4514a9760982649f45ce431656e8
> info: <-- GET /wd/hub/session/0ebf4514a9760982649f45ce431656e8 200 11.638 ms - 606
> info: --> POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/url {"url":"http://gmail.com"}
> info: JSONWP Proxy: Proxying [POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/url] to [POST http://127.0.0.1:9515/wd/hub/session/0ebf4514a9760982649f45ce431656e8/url] with body: {"url":"http://gmail.com"}
> info: JSONWP Proxy: Got response with status 200: {"sessionId":"0ebf4514a9760982649f45ce431656e8","status":0,"value":null}
> info: JSONWP Proxy: Replacing sessionId 0ebf4514a9760982649f45ce431656e8 with 0ebf4514a9760982649f45ce431656e8
> info: <-- POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/url 200 2374.402 ms - 72
> info: --> POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/element {"using":"id","value":"Email"}
> info: JSONWP Proxy: Proxying [POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/element] to [POST http://127.0.0.1:9515/wd/hub/session/0ebf4514a9760982649f45ce431656e8/element] with body: {"using":"id","value":"Email"}
> info: JSONWP Proxy: Got response with status 200: {"sessionId":"0ebf4514a9760982649f45ce431656e8","status":0,"value":{"ELEMENT":"0.46630814854548563-1"}}
> info: JSONWP Proxy: Replacing sessionId 0ebf4514a9760982649f45ce431656e8 with 0ebf4514a9760982649f45ce431656e8
> info: <-- POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/element 200 154.429 ms - 103
> info: --> POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/element/0.46630814854548563-1/value {"id":"0.46630814854548563-1","value":["test"]}
> info: JSONWP Proxy: Proxying [POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/element/0.46630814854548563-1/value] to [POST http://127.0.0.1:9515/wd/hub/session/0ebf4514a9760982649f45ce431656e8/element/0.46630814854548563-1/value] with body: {"id":"0.46630814854548563-1","value":["test"]}
> info: JSONWP Proxy: Got response with status 200: {"sessionId":"0ebf4514a9760982649f45ce431656e8","status":0,"value":null}
> info: JSONWP Proxy: Replacing sessionId 0ebf4514a9760982649f45ce431656e8 with 0ebf4514a9760982649f45ce431656e8
> info: <-- POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/element/0.46630814854548563-1/value 200 300.313 ms - 72
> info: --> POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/element {"using":"id","value":"next"}
> info: JSONWP Proxy: Proxying [POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/element] to [POST http://127.0.0.1:9515/wd/hub/session/0ebf4514a9760982649f45ce431656e8/element] with body: {"using":"id","value":"next"}
> info: JSONWP Proxy: Got response with status 200: {"sessionId":"0ebf4514a9760982649f45ce431656e8","status":0,"value":{"ELEMENT":"0.46630814854548563-2"}}
> info: JSONWP Proxy: Replacing sessionId 0ebf4514a9760982649f45ce431656e8 with 0ebf4514a9760982649f45ce431656e8
> info: <-- POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/element 200 160.963 ms - 103
> info: --> POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/element/0.46630814854548563-2/click {"id":"0.46630814854548563-2"}
> info: JSONWP Proxy: Proxying [POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/element/0.46630814854548563-2/click] to [POST http://127.0.0.1:9515/wd/hub/session/0ebf4514a9760982649f45ce431656e8/element/0.46630814854548563-2/click] with body: {"id":"0.46630814854548563-2"}
> info: JSONWP Proxy: Got response with status 200: {"sessionId":"0ebf4514a9760982649f45ce431656e8","status":0,"value":null}
> info: JSONWP Proxy: Replacing sessionId 0ebf4514a9760982649f45ce431656e8 with 0ebf4514a9760982649f45ce431656e8
> info: <-- POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/element/0.46630814854548563-2/click 200 350.330 ms - 72
> info: --> POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/element {"using":"id","value":"Passwd"}
> info: JSONWP Proxy: Proxying [POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/element] to [POST http://127.0.0.1:9515/wd/hub/session/0ebf4514a9760982649f45ce431656e8/element] with body: {"using":"id","value":"Passwd"}
> info: JSONWP Proxy: Got response with status 200: {"sessionId":"0ebf4514a9760982649f45ce431656e8","status":7,"value":{"message":"no such element: Unable to locate element: {\"method\":\"id\",\"selector\":\"Passwd\"}\n (Session info: chrome=52.0.2...
> info: JSONWP Proxy: Replacing sessionId 0ebf4514a9760982649f45ce431656e8 with 0ebf4514a9760982649f45ce431656e8
> info: <-- POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/element 200 227.600 ms - 331
> info: [debug] Didn't get a new command in 60 secs, shutting down...
> info: Shutting down appium session
> info: Chromedriver: Changed state to 'stopping'
> info: JSONWP Proxy: Proxying [DELETE /] to [DELETE http://127.0.0.1:9515/wd/hub/session/0ebf4514a9760982649f45ce431656e8] with no body
> info: JSONWP Proxy: Got response with status 200: "{\"sessionId\":\"0ebf4514a9760982649f45ce431656e8\",\"status\":0,\"value\":null}"
> info: Chromedriver: Changed state to 'stopped'
> info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"shutdown"}
> info: [debug] [BOOTSTRAP] [debug] Got command of type SHUTDOWN
> info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":"OK, shutting down"}
> info: [debug] [BOOTSTRAP] [debug] Closed client connection
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=.
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 0
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
> info: [debug] [UIAUTOMATOR STDOUT] Test results for WatcherResultPrinter=.
> info: [debug] [UIAUTOMATOR STDOUT] Time: 76.13
> info: [debug] [UIAUTOMATOR STDOUT] OK (1 test)
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: -1
> info: [debug] Sent shutdown command, waiting for UiAutomator to stop...
> info: [debug] UiAutomator shut down normally
> info: [debug] executing cmd: D:\eGain\Automation\Android\sdk\platform-tools\adb.exe -s a33124a7 shell "am force-stop com.android.chrome"
> info: [debug] Stopping logcat capture
> info: [debug] Logcat terminated with code null, signal SIGTERM
> info: [debug] Cleaning up appium session
> info: [debug] We shut down because no new commands came in
#Vaibhav because there is screen transition between ID and password field entry and appium starts looking for password field before the next screen is displayed so I would suggest you to add a wait condition for it.
WebDriverWait wait = new WebDriverWait(driver, 30);
wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//android.widget.EditText[#resource-id='Passwd']")));
The below capabilities worked for me -
public void setUp() throws Exception {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("deviceName", "Galaxy");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability(CapabilityType.BROWSER_NAME, "Chrome");
capabilities.setCapability("platformVersion", "6.0");
capabilities.setCapability("appPackage", "com.android.chrome");
capabilities.setCapability("appActivity","com.google.android.apps.chrome.ChromeTabbedActivity");
driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
}
But if you are able to enter gmail user name and click on "next" button using your capabilities then you can use your existing capabilities. Just add wait statement before clicking password.
The following code is working for me
Here is the code
public class TestMobileBrowser {
public DesiredCapabilities capabilities;
public AppiumDriver driver;
#BeforeTest
public void beforeTest() throws Exception{
capabilities = new DesiredCapabilities();
capabilities.setCapability("deviceName", "Android");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability(CapabilityType.BROWSER_NAME, "Chrome");
capabilities.setCapability("platformVersion", "5.0.2");
capabilities.setCapability("appPackage", "com.android.chrome");
capabilities.setCapability("appActivity","com.google.android.apps.chrome.ChromeTabbedActivity");
driver= new AppiumDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
}
#Test
public void test(){
driver.get("http://gmail.com");
driver.findElement(By.id("Email")).sendKeys("test");
Thread.sleep(30000);
driver.findElement(By.id("next")).click();
driver.findElement(By.id("Passwd")).sendKeys("test");
driver.findElement(By.id("signIn")).click();
}
}
capabilities.setCapability("deviceName", "YOUR-DEVICE-NAME"); // such as GalaxyS6
capabilities.setCapability("browserName", "Chrome"); // its Chrome instead of chrome
You might need to add :
chromedriverExecutable under capabilities. The absolute local path to webdriver executable (if Chromium embedder provides its own webdriver, it should be used instead of original chromedriver bundled with Appium)
It is unable to find password field.If its hidden by device keyboard, I would suggest to hide keyboard first.
driver.hideKeyboard();
driver.findElement(By.id("Passwd")).sendKeys("test");
driver = new RemoteWebDriver(new URL("http://localhost:4723/wd/hub"), capabilities); This line might be cause of error. In other answers AndroidDriver and appium driver is used. Some of methods of these drivers may not be available in RemoteWebDriver

Getting "Error: read ECONNRESET" on reseting and launching the app

I am getting the following error on resetting the app [driver.resetApp()] and on launching the app on Appium (version: 1.4.16.1). I am using Java.
Eclispe console
org.openqa.selenium.WebDriverException: chrome not reachable
(Session info: chrome=50.0.2661.86)
(Driver info: chromedriver=2.18.343845 (73dd713ba7fbfb73cbb514e62641d8c96a94682a),platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 2.08 seconds
Build info: version: '2.48.2', revision: '41bccdd', time: '2015-10-09 19:59:12'
System info: host: 'IN2084073W1', ip: '192.168.56.1', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_21'
*** Element info: {Using=id, value=password}
Session ID: 2968b7e9-948e-4b75-94ed-838d10a08c82
Driver info: io.appium.java_client.android.AndroidDriver
Capabilities [{platform=LINUX, app=C:/apk/appname.apk, javascriptEnabled=true, appActivity=.MainActivity, browserName=, networkConnectionEnabled=true, desired={newCommandTimeout=120, app=C:/apk/surveyorapp.apk, platformVersion=5.1, deviceName=TA93303Q2F, platformName=Android, appActivity=.MainActivity, browserName=, appPackage=com.axa.surveyorapp}, locationContextEnabled=false, appPackage=com.axa.surveyorapp, newCommandTimeout=120, platformVersion=5.1, databaseEnabled=false, deviceName=TA93303Q2F, platformName=Android, webStorageEnabled=false, warnings={}, takesScreenshot=true}]
Appium Log
error: Could not proxy command to remote server. Original error: Error: read ECONNRESET
error: Chromedriver: Chromedriver exited unexpectedly with code 3221225477, signal null
info: Chromedriver: Changed state to 'stopped'
warn: Chromedriver for context WEBVIEW_com.clientname.appname stopped unexpectedly
error: Chromedriver quit unexpectedly during session
Update
Thanks for the update Emna. I have tried your option.
Can you please let me know how exactly I need to add this. I am using AndroidDriver not AppiumDriver. I have tried with both, but I'm getting below error.
Try to use :
(AppiumDriver)driver.resetApp();
Instead of :
driver.resetApp();
You can have a look into this link: Appium java-client
and use this link also to download ;)

Protractor - Safari - Timed out awaiting response to command "sendKeysToElement"

One of my E2E Test is failing only on Safari browser, when trying to send Text to an inputBox.
element(by.css('#content')).clear();
element(by.css('#content')).sendKeys("%20%DCben%20von%20Xylophonmusik%20qu%E4lt%20jeden%20gr%F6%DFeren%20Zwerg%20El%20ping%FCino%20Wenceslao%20hizo%20kil%F3metros%20bajo%20exhaustiva%20ll"); //UTF Text
Seeing following error in Webdriver manager console
18:40:12.150 INFO - Executing: [send keys: 16 [[SafariDriver: safari
on MAC (null)] -> css selector: #contentText],
[Falsches%20%DCben%20von%20Xylophonmusik%20qu%E4lt%20jeden%20gr%F6%DFeren%20Zwerg%20El%20ping%FCino%20Wenceslao%20hizo%20kil%F3metros%20bajo%20exhaustiva%20lluvia%20y%20%0A%200c%F4t%E9%20de%20l%27alc%F4ve%20ovo%EFde%2C%20o%F9%20les%20b%FBche%u0E40%u18:40:42.663
WARN - Exception thrown org.openqa.selenium.TimeoutException: Timed
out awaiting response to command "sendKeysToElement" after 30004 ms
(WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 30.02 seconds Build info: version:
'2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50' System
info: host: 'vq-mac-dt-036.local', ip: '10.21.134.62', os.name: 'Mac
OS X', os.arch: 'x86_64', os.version: '10.9.5', java.version:
'1.8.0_31' Driver info: org.openqa.selenium.safari.SafariDriver
Capabilities [{browserName=safari, takesScreenshot=true,
javascriptEnabled=true, version=7.0.6, cssSelectorsEnabled=true,
platform=MAC, secureSsl=true}] Session ID: null at
sun.reflect.GeneratedConstructorAccessor57.newInstance(Unknown Source)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
at org.openqa.selenium.remote.ErrorHandler.createThrowa18:40:42.664
WARN - Exception: Timed out awaiting response to command
"sendKeysToElement" after 30004 ms (WARNING: The server did not
provide any stacktrace information) Command duration or timeout: 30.02
seconds
This test is working in Firefox, Chrome Browsers. I can't find any open issue related to safari driver.
Could you please advise, how to resolve this.
Thanks in advance.
Try chaining the clear, click and sendKeys functions on the input box to send the value. I don't think the UTF8 text should cause any problem. Here's how to do it -
var ele = element(by.css('#content'));
ele.clear().then(function(){
ele.click().then(function(){
ele.sendKeys("%20%DCben%20von%20Xylophonmusik%20qu%E4lt%20jeden%20gr%F6%DFeren%20Zwerg%20El%20ping%FCino%20Wenceslao%20hizo%20kil%F3metros%20bajo%20exhaustiva%20ll"); //UTF Text
});
});
Hope this helps.

Resources