无法在android emu上运行TestNG测试(Mac OS)

时间:2018-04-09 06:14:12

标签: java node.js maven appium

我似乎无法弄清楚为什么我的android测试不会执行。错误如下:

io.appium.java_client.service.local.InvalidServerInstanceException:发生了无效的服务器实例异常:没有安装的节点!请通过NPM(https://www.npmjs.com/package/appium#using-node-js)安装节点或下载并安装Appium应用程序(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

我已经通过Homebrew和网站安装了nodejs。 我在/ bash user_profile中设置了环境变量。 我已经卸载并重新安装了node / npm。 我已经联系了brew安装。 我可以手动启动appium服务器并通过appium从应用程序获取xpath。

node - v8.11.1 npm - 5.6.0

有什么建议吗?

1 个答案:

答案 0 :(得分:0)

仔细检查节点installation instructions

通过npm安装appium: npm install -g appium

安装&启动appium医生检查env设置: npm install appium-doctor appium-doctor

您应该检查输出并修复任何问题。至于Node.js,它应该像:

一样打印出来
info AppiumDoctor  ✔ The Node.js binary was found at: /usr/local/bin/node
info AppiumDoctor  ✔ Node version is 7.9.0