无法在Selenium网格节点上安装APK

时间:2015-02-16 14:21:26

标签: java android appium selenium-grid

我已经建立了一个拥有1个MAC - 10.9和2个Windows机器 - Windows 7的Selenium Grid。

我正在此网格环境中执行Appium脚本。

我可以在MAC机器上执行iPhone脚本,但甚至无法在Windows机器上安装apk文件。

我已将apk文件保留在节点机器中,并使用“app”DesiredCapabilities从脚本提供其路径。

每次执行Appium时都会抛出错误 -

Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 2.871 sec <<< FAILURE! - in TestSuite
setTemepraturesAndroid(com.testcases.SetTemperatures)  Time elapsed: 1.856 sec  <<< FAILURE!
org.openqa.selenium.WebDriverException: Only a (zipped) app/apk files can be installed using this endpoint (WARNING: The server did not provide any sta
cktrace information)
Command duration or timeout: 78 milliseconds
Build info: version: '2.43.1', revision: '5163bceef1bc36d43f3dc0b83c88998168a363a0', time: '2014-09-10 09:43:55'
System info: host: 'kdsksadaskjd', ip: 'XX.XX.XX.XX', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_25'
Driver info: io.appium.java_client.android.AndroidDriver
Capabilities [{app=./Arena_prod.apk, appPackage=com.android.arena, networkConnectionEnabled=true, warnings={}, databaseEnabled=false, deviceN
ame=Nexus5, platform=LINUX, desired={app=./Arena_prod.apk, appPackage=com.android.arena, autoLaunch=false, platformVersion=4.4.4, automationN
ame=Appium, browserName=Nexus5, platformName=Android, deviceName=Nexus5}, autoLaunch=false, platformVersion=4.4.4, webStorageEnabled=false, locationCon
textEnabled=false, automationName=Appium, browserName=Nexus5, takesScreenshot=true, javascriptEnabled=true, platformName=Android}]
Session ID: 009dffae-2e34-4dc0-a208-bf54ed230c7c
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
        at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
        at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
        at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:180)
        at io.appium.java_client.AppiumDriver.installApp(AppiumDriver.java:217)
        at com.commons.Utils.launchApplication(Utils.java:299)
        at com.keywords.LoginToApp.run(LoginToApp.java:21)
        at com.testcases.SetTemperatures.setTemepraturesAndroid(SetTemperatures.java:65)

结果:

Failed tests:
  SetTemperatures.setTemepraturesAndroid:65 » WebDriver Only a (zipped) app/apk ...

Tests run: 1, Failures: 1, Errors: 0, Skipped: 0

如果我压缩apk文件,我收到以下错误 -

Running TestSuite
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 1.7 sec <<< FAILURE! - in TestSuite
setTemepraturesAndroid(com.testcases.SetTemperatures)  Time elapsed: 0.671 sec  <<< FAILURE!
org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: Bad app: C:\Selenium-Grid\Appium\Appium\node_modul
es\appium\Arena_prod.zip. App paths need to be absolute, or relative to the appium server install dir, or a URL to compressed file, or a special app na
me. cause: Error: Command failed: 'xargs' is not recognized as an internal or external command,
operable program or batch file.
) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 343 milliseconds
Build info: version: '2.43.1', revision: '5163bceef1bc36d43f3dc0b83c88998168a363a0', time: '2014-09-10 09:43:55'
System info: host: 'hjasdkjashdklajsd', ip: 'XX.XX.XX.XXX', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_25'
Driver info: io.appium.java_client.android.AndroidDriver
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
        at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
        at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
        at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:180)
        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)
        at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:109)
        at io.appium.java_client.android.AndroidDriver.<init>(AndroidDriver.java:39)
        at com.commons.Utils.launchApplication(Utils.java:271)
        at com.keywords.LoginToApp.run(LoginToApp.java:21)
        at com.testcases.SetTemperatures.setTemepraturesAndroid(SetTemperatures.java:65)

结果:

Failed tests:
  SetTemperatures.setTemepraturesAndroid:65 » SessionNotCreated A new session co...

Tests run: 1, Failures: 1, Errors: 0, Skipped: 0

[ERROR] There are test failures.

1 个答案:

答案 0 :(得分:0)

在第一个日志中(使用apk时),您似乎为应用程序提供了以下路径:

  

应用=。/ Arena_prod.apk

这是对的吗?如果您使用的是Windows,是否可以尝试使用.apk文件,但提供完整路径,就像在第二种情况下使用zip一样?

例如:C:\ Selenium-Grid \ Appium \ Appium \ node_modul ES \ appium \ Arena_prod.apk