如何将本地apk文件提交到远程appium服务器?

tru*_*-mt 2 android node.js appium

我的设置:

  • PC-1
  • PC-2

PC-1:

  • 有apk文件
  • 对PC-2执行appium测试

PC-2:

  • 只有运行appium的nodejs

问题: 当我想要进行测试时

org.openqa.selenium.SessionNotCreatedException: 
A new session could not be created. 
(Original error: Bad app: <<local_path>>myApp.apk. 
App paths need to be absolute, or relative to the appium server install dir, or a URL to compressed file, or a special app name. 
cause: Error: Error locating the app: 
ENOENT, stat '<<local_path>>myApp.apk') (WARNING: The server did not provide any stacktrace information)

Build info: version: '2.41.0', revision: '3192d8a6c4449dc285928ba024779344f5423c58', time: '2014-03-27 11:29:39'
System info: host: 'my-PC', ip: 'XXX.XXX.XXX.XXX', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_55'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:193)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:595)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:240)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:126)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:153)
Run Code Online (Sandbox Code Playgroud)

我的帽子:

caps.setCapability("device","android"); caps.setCapability("deviceName","Galaxy S3"); caps.setCapability("platformName","android"); caps.setCapability("version", "4.3"); caps.setCapability("deviceType", "phone"); caps.setCapability(CapabilityType.PLATFORM, "Windows"); caps.setCapability("app-activity", "package.activities.MyActivity_"); caps.setCapability("app-package", "xx.my.myapp"); caps.setCapability("app", app.getAbsolutePath());

- >那么如何将我的本地APK文件从PC-1汇总到运行appium的PC-2?

Jes*_*ess 5

所以你得到的错误Bad App是因为Appium找不到你在'app'功能中提供的.apk.

日志显示您正试图告诉Appium该应用程序位于:<>myApp.apk.

我的猜测是你的app.getAbsolutePath()函数没有返回到.apk的路径

Appium能够.apk从网址下载压缩文件.如果您.apk在本地网络上托管,或以某种方式将两台计算机联网,您应该能够将"app"功能指向该URL.

测试是如果您将路径粘贴到浏览器窗口,它应该带您下载 .apk