gpt4 book ai didi

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

转载 作者:太空狗 更新时间:2023-10-29 16:37:03 25 4
gpt4 key购买 nike

我的设置:

  • 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 上传到运行 appium 的 PC-2?

最佳答案

所以你得到的错误,Bad App ,是因为 Appium 无法找到您在“应用程序”功能中提供的 .apk。

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

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

Appium 能够下载压缩的 .apk来自网址的文件。如果您主持 .apk在本地网络上,或以某种方式将两台计算机联网在一起,您应该能够将“应用程序”功能指向该 URL。

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

关于android - 如何将本地apk文件提交到远程appium服务器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25975349/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com