简体   繁体   English

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

[英]Can't run a TestNG test on android emu (Mac OS)

I can't seem to figure out why my android test wont execute. 我似乎无法弄清楚为什么我的Android测试无法执行。 The error is a follows : 错误如下:

io.appium.java_client.service.local.InvalidServerInstanceException: Invalid server instance exception has occured: There is no installed nodes! io.appium.java_client.service.local.InvalidServerInstanceException:发生无效的服务器实例异常:没有安装的节点! 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 ) 请通过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

I have installed nodejs via Homebrew and from the website. 我已经通过Homebrew和网站安装了nodejs。 I have set the Environment variables in the /bash user_profile. 我已经在/ bash user_profile中设置了环境变量。 I have uninstalled and reinstalled node/npm. 我已经卸载并重新安装了node / npm。 I have linked the brew install. 我已经链接了brew安装。 I can launch appium server manually and get xpaths from the app via appium. 我可以手动启动appium服务器,并通过appium从应用程序获取xpath。

node - v8.11.1 npm - 5.6.0 节点-v8.11.1 npm-5.6.0

Any suggestions? 有什么建议么?

Double check node installation instructions 仔细检查节点安装说明

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

Install & launch appium doctor to check env setup: npm install appium-doctor appium-doctor 安装并启动appium doctor以检查环境设置: npm install appium-doctor appium-doctor

You should check output and fix any issues. 您应该检查输出并解决所有问题。 As for Node.js it should print smth like: 至于Node.js它应该打印如下:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM