我的设置:
PC-1:
PC-2:
问题:当我想要运行测试时,
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)My Caps:
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呢?
发布于 2014-09-22 16:13:29
所以你所得到的错误,Bad App,是因为Appium找不到你给它的“应用”功能中的.apk。
日志显示,您试图告诉Appium该应用程序位于:<>myApp.apk。
我猜您的app.getAbsolutePath()函数没有将路径返回到.apk
Appium可以从url下载压缩的.apk文件。如果您在本地网络上托管.apk,或者以某种方式将这两台计算机连接在一起,您应该能够将“app”功能指向该URL。
测试是,如果将路径粘贴到浏览器窗口,则需要下载.apk。
https://stackoverflow.com/questions/25975349
复制相似问题