Can’t run a TestNG test on android emu (Mac OS)

I can’t seem to figure out why my android test wont execute. The error is a follows :

io.appium.java_client.service.local.InvalidServerInstanceException: Invalid server instance exception has occured: There is no installed nodes! Please install node via NPM (https://www.npmjs.com/package/appium#using-node-js) or download and install Appium app (http://appium.io/downloads.html)

at io.appium.java_client.service.local.AppiumServiceBuilder.findNodeInCurrentFileSystem(AppiumServiceBuilder.java:155)
at io.appium.java_client.service.local.AppiumServiceBuilder.checkAppiumJS(AppiumServiceBuilder.java:309)
at io.appium.java_client.service.local.AppiumServiceBuilder.createArgs(AppiumServiceBuilder.java:389)
at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:332)
at io.appium.java_client.service.local.AppiumDriverLocalService.buildService(AppiumDriverLocalService.java:76)
at io.appium.java_client.service.local.AppiumDriverLocalService.buildDefaultService(AppiumDriverLocalService.java:72)
at Config.DriverFactory.getAndroidDriver(DriverFactory.java:33)
at AndroidTests.CheckoutTestAndroid.setupSuite(CheckoutTestAndroid.java:40)
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:108)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:523)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:224)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:146)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:326)
at org.testng.SuiteRunner.run(SuiteRunner.java:289)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1301)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1226)
at org.testng.TestNG.runSuites(TestNG.java:1144)
at org.testng.TestNG.run(TestNG.java:1115)
at org.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:72)
at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:123)


at io.appium.java_client.service.local.AppiumServiceBuilder.findNodeInCurrentFileSystem(AppiumServiceBuilder.java:156)
... 25 more

I have installed nodejs via Homebrew and from the website. I have set the Environment variables in the /bash user_profile. I have uninstalled and reinstalled node/npm. I have linked the brew install. I can launch appium server manually and get xpaths from the app via appium.

node – v8.11.1 npm – 5.6.0

Any suggestions?

Answer

Double check node installation instructions

Install appium via npm: npm install -g appium

Install & launch appium doctor to check env setup: npm install appium-doctor appium-doctor

You should check output and fix any issues. As for Node.js it should print smth like:

info AppiumDoctor  ✔ The Node.js binary was found at: /usr/local/bin/node
info AppiumDoctor  ✔ Node version is 7.9.0

Leave a Reply

Your email address will not be published. Required fields are marked *