Unable to start appium server programmatically. Error: spawn ENOTDIR - selenium-webdriver

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.

Related

E/launcher - unknown error: Chrome failed to start: crashed in headless mode

Face the following error
Google Chrome - 67.0
chromedriver - chromedriver_2.40
selenium standalone - selenium-server-standalone-3.12.0.jar
linux - CentOS Linux release 7.3
Protractor - 5.1.2
Nodejs - v6.14.2
config.ts
chrome: {
seleniumAddress: 'http://localhost:4444/wd/hub',
directConnect: true,
browserName: 'chrome',
chromeOptions:{
args: ['--headless','--disable-gpu','--disable-dev-shm-usage','--no-sandbox','window-size=1024,768']
}
10:37:07.923 [10:37:07] I/launcher - Running 1 instances of WebDriver
10:37:07.923 [10:37:07] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
10:38:09.409 [10:38:09] E/launcher - unknown error: Chrome failed to start: crashed
10:38:09.409 (Driver info: chromedriver=2.40.565383 (76257d1ab79276b2d53ee976b2c3e3b9f335cde7),platform=Linux 3.10.0-514.26.2.el7.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information)
10:38:09.409 Command duration or timeout: 60.39 seconds
10:38:09.409 Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T15:15:08.936Z'
10:38:09.409 System info: host: 'sigmagoagt-po-a1p.sys.comcast.net', ip: '147.191.72.189', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-514.26.2.el7.x86_64', java.version: '1.8.0_40'
10:38:09.410 Driver info: driver.version: unknown
10:38:09.410 [10:38:09] E/launcher - WebDriverError: unknown error: Chrome failed to start: crashed
10:38:09.410 (Driver info: chromedriver=2.40.565383 (76257d1ab79276b2d53ee976b2c3e3b9f335cde7),platform=Linux 3.10.0-514.26.2.el7.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information)
10:38:09.410 Command duration or timeout: 60.39 seconds
10:38:09.410 Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T15:15:08.936Z'
10:38:09.411 System info: host: 'sigmagoagt-po-a1p.sys.comcast.net', ip: '147.191.72.189', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-514.26.2.el7.x86_64', java.version: '1.8.0_40'
10:38:09.411 Driver info: driver.version: unknown
10:38:09.411 at WebDriverError (/app/go-agent1/pipelines/UI-Automation-Testing/web/client-portal/node_modules/selenium-webdriver/lib/error.js:27:5)
10:38:09.411 at Object.checkLegacyResponse (/app/go-agent1/pipelines/UI-Automation-Testing/web/client-portal/node_modules/selenium-webdriver/lib/error.js:505:15)
10:38:09.411 at parseHttpResponse (/app/go-agent1/pipelines/UI-Automation-Testing/web/client-portal/node_modules/selenium-webdriver/lib/http.js:509:13)
10:38:09.412 at doSend.then.response (/app/go-agent1/pipelines/UI-Automation-Testing/web/client-portal/node_modules/selenium-webdriver/lib/http.js:440:13)
10:38:09.412 at process._tickCallback (internal/process/next_tick.js:109:7)
10:38:09.412 From: Task: WebDriver.createSession()
10:38:09.412 at Function.createSession (/app/go-agent1/pipelines/UI-Automation-Testing/web/client-portal/node_modules/selenium-webdriver/lib/webdriver.js:777:24)
10:38:09.412 at Function.createSession (/app/go-agent1/pipelines/UI-Automation-Testing/web/client-portal/node_modules/selenium-webdriver/chrome.js:709:29)
10:38:09.412 at createDriver (/app/go-agent1/pipelines/UI-Automation-Testing/web/client-portal/node_modules/selenium-webdriver/index.js:167:33)
10:38:09.412 at Builder.build (/app/go-agent1/pipelines/UI-Automation-Testing/web/client-portal/node_modules/selenium-webdriver/index.js:623:16)
10:38:09.413 at Hosted.getNewDriver (/app/go-agent1/pipelines/UI-Automation-Testing/web/client-portal/node_modules/protractor/lib/driverProviders/driverProvider.ts:60:29)
10:38:09.413 at Runner.createBrowser (/app/go-agent1/pipelines/UI-Automation-Testing/web/client-portal/node_modules/protractor/lib/runner.ts:225:39)
10:38:09.413 at q.then.then (/app/go-agent1/pipelines/UI-Automation-Testing/web/client-portal/node_modules/protractor/lib/runner.ts:391:27)
10:38:09.413 at _fulfilled (/app/go-agent1/pipelines/UI-Automation-Testing/web/client-portal/node_modules/protractor/node_modules/q/q.js:834:54)
10:38:09.413 at self.promiseDispatch.done (/app/go-agent1/pipelines/UI-Automation-Testing/web/client-portal/node_modules/protractor/node_modules/q/q.js:863:30)
10:38:09.413 at Promise.promise.promiseDispatch (/app/go-agent1/pipelines/UI-Automation-Testing/web/client-portal/node_modules/protractor/node_modules/q/q.js:796:13)
10:38:09.414 at /app/go-agent1/pipelines/UI-Automation-Testing/web/client-portal/node_modules/protractor/node_modules/q/q.js:556:49
10:38:09.414 at runSingle (/app/go-agent1/pipelines/UI-Automation-Testing/web/client-portal/node_modules/protractor/node_modules/q/q.js:137:13)
10:38:09.414 at flush (/app/go-agent1/pipelines/UI-Automation-Testing/web/client-portal/node_modules/protractor/node_modules/q/q.js:125:13)
10:38:09.414 at _combinedTickCallback (internal/process/next_tick.js:73:7)
10:38:09.414 at process._tickCallback (internal/process/next_tick.js:104:9)
You can run tests using selenium server or run them directly on browser. You should remove one of :
seleniumAddress: 'http://localhost:4444/wd/hub',
or
directConnect: true,
Uninstalling and re-installation of Chrome in centOS machine solved the issue. Followed installation procedure available in "https://intoli.com/blog/installing-google-chrome-on-centos/". Thank you.

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"

Failures: Angular js testing tool protractor error for testing a application

while compiling cfg file we getting this error.
Failures:
1) Protractor Demo App should have a title
Message:
Failed: element not visible
(Session info: chrome=55.0.2883.87)
(Driver info: chromedriver=2.26.436362 (5476ec6bf7ccbada1734a0cdec7d570bb0
42aa30),platform=Windows NT 6.3.9600 x86_64) (WARNING: The server did not provid
e any stacktrace information)
Command duration or timeout: 120 milliseconds
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:
03'
System info: host: 'Guest684', ip: '172.17.13.252', os.name: 'Windows 8.1',
os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_92'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulati
onEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.2
6.436362 (5476ec6bf7ccbada1734a0cdec7d570bb042aa30), userDataDir=C:\Users\miracl
e\AppData\Local\Temp\scoped_dir9992_4680}, takesHeapSnapshot=true, pageLoadStrat
egy=normal, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, ver
sion=55.0.2883.87, platform=WIN8_1, browserConnectionEnabled=false, nativeEvents
=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true,
browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssS`enter code here`electorsE
nabled=true, unexpectedAlertBehaviour=}]
Session ID: 9601e64df3743dbf5dc215bd39d4f528
Stack:
ElementNotVisibleError: element not visible
Please use protractor Configuration and Specification file for your protractor test.
Configuration file should have - Selenium Port address, Browser info and Specification file name
Specification file should have - Test Steps and Verification Part.

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

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`

Exception launching Chrome: java.util.concurrent.ExecutionException

I am seeing this exception when launching Chrome Browser using RemoteWebDriver.
I have tried getting the latest versions of selenium server and chromedriver, but with no luck.
I seem to run out of ides.
Has anyone encountered this error and has found a solution.
12:48:18.012 INFO - Registering the node to hub :http://mydomain:4444/grid/regi
ster
12:50:38.741 INFO - Executing: [new session: {platform=ANY, browserName=chrome,
chromeOptions={args=[--user-data-dir=C:\Use..., version=}] at URL: /session)
12:50:38.771 INFO - Creating a new session for Capabilities [{platform=ANY, brow
serName=chrome, chromeOptions={args=[--user-data-dir=C:\Users\vidder\AppData\Loc
al\Vidder_Inc\SDP Browser\userdata, --start-maximized --profile-directory=Defaul
t], extensions=[]}, version=}]
Starting ChromeDriver (v2.4.226107) on port 29990
12:51:00.234 WARN - Exception thrown
java.util.concurrent.ExecutionException: org.openqa.selenium.WebDriverException:
java.lang.reflect.InvocationTargetException
Build info: version: '2.37.0', revision: 'a7c61cb', time: '2013-10-18 17:14:00'
System info: host: 'vidder-PC3', ip: '10.10.104.69', os.name: 'Windows 7', os.ar
ch: 'amd64', os.version: '6.1', java.version: '1.7.0_15'
Driver info: driver.version: unknown
at java.util.concurrent.FutureTask$Sync.innerGet(Unknown Source)
at java.util.concurrent.FutureTask.get(Unknown Source)
at org.openqa.selenium.remote.server.DefaultSession.execute(DefaultSessi
on.java:176)
at org.openqa.selenium.remote.server.DefaultSession.<init>(DefaultSessio
n.java:112)
at org.openqa.selenium.remote.server.DefaultSession.createSession(Defaul
tSession.java:89)
at org.openqa.selenium.remote.server.DefaultDriverSessions.newSession(De
faultDriverSessions.java:104)
at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSessio
n.java:63)
at org.openqa.selenium.remote.server.rest.ResultConfig.handle(ResultConf
ig.java:205)
at org.openqa.selenium.remote.server.JsonHttpRemoteConfig.handleRequest(
JsonHttpRemoteConfig.java:192)
at org.openqa.selenium.remote.server.DriverServlet.handleRequest(DriverS
ervlet.java:201)
at org.openqa.selenium.remote.server.DriverServlet.doPost(DriverServlet.
java:167)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.openqa.selenium.remote.server.DriverServlet.service(DriverServlet
.java:139)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.openqa.jetty.jetty.servlet.ServletHolder.handle(ServletHolder.jav
a:428)
at org.openqa.jetty.jetty.servlet.ServletHandler.dispatch(ServletHandler
.java:677)
at org.openqa.jetty.jetty.servlet.ServletHandler.handle(ServletHandler.j
ava:568)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1526)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1479)
at org.openqa.jetty.http.HttpServer.service(HttpServer.java:914)
at org.openqa.jetty.http.HttpConnection.service(HttpConnection.java:820)
at org.openqa.jetty.http.HttpConnection.handleNext(HttpConnection.java:9
86)
at org.openqa.jetty.http.HttpConnection.handle(HttpConnection.java:837)
at org.openqa.jetty.http.SocketListener.handleConnection(SocketListener.
java:243)
at org.openqa.jetty.util.ThreadedServer.handle(ThreadedServer.java:357)
at org.openqa.jetty.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
Caused by: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationT
argetException
Build info: version: '2.37.0', revision: 'a7c61cb', time: '2013-10-18 17:14:00'
System info: host: 'vidder-PC3', ip: '10.10.104.69', os.name: 'Windows 7', os.ar
ch: 'amd64', os.version: '6.1', java.version: '1.7.0_15'
Driver info: driver.version: unknown
at org.openqa.selenium.remote.server.DefaultDriverFactory.callConstructo
r(DefaultDriverFactory.java:72)
at org.openqa.selenium.remote.server.DefaultDriverFactory.newInstance(De
faultDriverFactory.java:56)
at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(
DefaultSession.java:215)
at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(
DefaultSession.java:1)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession
.java:169)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Sou
rce)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.server.DefaultDriverFactory.callConstructo
r(DefaultDriverFactory.java:62)
... 9 more
Caused by: org.openqa.selenium.WebDriverException: unknown error: Chrome failed
to start: exited normally

Resources