2017-03-06 155 views
0

我想運行一個簡單的測試在Windows 10 64位上啓動計算器應用程序,我已經安裝了[email protected]。根據安裝appium的文檔,winappdriver也將被安裝。但是,當我嘗試運行我的測試時,我看到下面的錯誤,其中抱怨winappdriver未安裝。不能得到WinAppDriver與appium 1.6.3工作

C:\WINDOWS\system32>appium 
[Appium] Welcome to Appium v1.6.3 
[Appium] Appium REST http interface listener started on 0.0.0.0:4723 
[HTTP] --> POST /wd/hub/session {"desiredCapabilities":{"app":"Microsoft.WindowsCalculator_8wekyb3d8bbwe!App","platformName":"Windows","deviceName":"WindowsPC"}} 
[debug] [MJSONWP] Calling AppiumDriver.createSession() with args: [{"app":"Microsoft.WindowsCalculator_8wekyb3d8bbwe!App","platformName":"Windows","deviceName":"WindowsPC"},null,null,null,null] 
[Appium] Creating new WindowsDriver session 
[Appium] Capabilities: 
[Appium] app: 'Microsoft.WindowsCalculator_8wekyb3d8bbwe!App' 
[Appium] platformName: 'Windows' 
[Appium] deviceName: 'WindowsPC' 
[BaseDriver] The following capabilities were provided, but are not recognized by appium: app. 
[BaseDriver] Session created with session id: c0c6c7e6-b782-4b14-8192-bc78e5b38008 
[WinAppDriver] Verifying WinAppDriver is installed with correct checksum 
[HTTP] <-- POST /wd/hub/session - - ms - - 
[debug] [WinAppDriver] Deleting WinAppDriver session 
[MJSONWP] Encountered internal error running command: Error: Could not verify WinAppDriver install; re-run install 
    at WinAppDriver.start$ (../../lib/winappdriver.js:35:13) 
    at tryCatch (C:\Users\bhawsar\AppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40) 
    at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Users\bhawsar\AppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:315:22) 
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (C:\Users\bhawsar\AppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21) 
    at GeneratorFunctionPrototype.invoke (C:\Users\bhawsar\AppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37) 

還附上我的測試腳本:

var wd = require("wd"); 
var chai = require("chai"); 
var chaiAsPromised = require("chai-as-promised"); 
chai.use(chaiAsPromised); 
var should = chai.should(); 
//enable chai assertion chaining 
chaiAsPromised.transferPromiseness = wd.transferPromiseness; 

var serverConfig = { 
    host:'127.0.0.1', 
    port:4723, 

}; 

var capabilities = { 
    app:'Microsoft.WindowsCalculator_8wekyb3d8bbwe!App', 
    platformName:'Windows', 
    deviceName:'WindowsPC' 
}; 

var driver; 

describe('test calculator',function(){ 
it('test launch calculator',function(done){ 

    driver = wd.promiseChainRemote(serverConfig); 
    console.log(driver) 
    this.timeout(10000); 
    var cap=driver.init(capabilities); 
    console.log(cap) 
     done(); 
}) 
}); 

回答

0

你有沒有在第一時間安裝WinAppDriver? https://github.com/Microsoft/WinAppDriver/releases,WindowsApplicationDriver.msi

注意:目前僅適用於Win 10。

+0

是的,我做到了,C:\ Program Files文件(x86)的\ Windows應用程序驅動程序。我也只贏了10場。我跟着https://jeremylindsayni.wordpress.com/2016/11/18/testing-your-windows-app-with-appium-in-windows-10-and-visual-studio-2015/。但它不適合我。 – PB13

+0

順便說一句,找到了一些相關的東西:https://github.com/Microsoft/WinAppDriver/issues/100 對於我這樣做在java中,WinAppDriver似乎開始好(硒-java v。3.2.0,appium java-客戶端5.0.0-BETA5),一切工作正常。 – Zaziro

0

我知道,我的回答是爲時已晚

我只是想讓別人知道 的是,在appium使用的雙贏應用驅動程序版本太舊(0.7),所以只是從GitHub(0.9)

下載它直接
0

我注意到appium和windows驅動程序的版本有緊密的依賴關係。通過桌面應用程序安裝appium時,它不起作用。你得到錯誤的版本。

安裝時,它將Windows驅動程序下載到您的appdata/temp文件夾中。你應該刪除它。

當通過nmp安裝appium時,它會工作得更好,這個下載正確的Windows驅動程序。

當你沒有刪除臨時文件夾下載這也是一個會失敗,因爲它需要的是windows驅動程序...