我的设置:
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)
我的帽子:
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 sumbit到运行appium的pc-2呢?
最佳答案
因此,您得到的错误是,Bad App
,因为appium找不到您在“app”功能中提供的.apk。
日志显示您正试图告诉Appium应用程序位于:<>myApp.apk
。
我猜您的app.getAbsolutePath()
函数没有返回到.apk的路径
appium能够从url下载压缩的.apk
文件。如果您在本地网络上托管.apk
,或者以某种方式将两台计算机连接在一起,您应该能够将“应用程序”功能指向该url。
测试是,如果将路径粘贴到浏览器窗口中,则需要下载.apk
关于android - 如何将本地apk文件提交到远程appium服务器?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/25975349/