2014-09-22 100 views
2

我的設置:如何提交本地apk文件到遠程appium服務器?

  • PC-1
  • PC-2

PC-1:

  • 有apk文件
  • 對執行appium測試PC-2

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到PC-2,其中appium運行?

+0

你能提供有關環境的信息和構建工具? 知道你是否使用Maven或搖籃,和你使用詹金斯/特拉維斯/ TeamCity的爲您建立是非常重要的。 – deadmoto 2014-09-22 18:36:53

回答

4

所以你得到,Bad App錯誤,是因爲Appium找不到你給它的「應用程序」功能.apk文件。

該日誌顯示你正在試圖告訴Appium該應用程序是:<>myApp.apk

我的猜測是,你app.getAbsolutePath()功能沒有路徑返回.apk文件

Appium能夠從一個網址下載一個壓縮文件.apk。如果您在本地網絡上託管.apk,或者以某種方式將兩臺計算機聯網,則應該可以將「應用」功能指向該URL。

的測試,如果你粘貼路徑到您的瀏覽器窗口,應該把你下載.apk

+1

你是對的 - 我現在使用Url'http://my-repo/myApk.apk' - Appium功能文檔可以在這裏找到: http://appium.io/slate/en/master/?紅寶石#appium-server-capabilities – 2014-09-23 12:05:07

+0

確保投票。 – sheeptest 2014-09-23 12:07:01

相關問題