如何使用Appium检查Windows应用程序

时间:2019-07-10 09:54:52

标签: appium appium-desktop winappdriver

是否可以使用Appium检查Windows应用程序? 如果是,有人可以告诉我应设置什么“期望功能”来启动,例如记事本?

我所做的是:

  • 已安装/已启动的Appium
  • 在0.0.0.0:4723上启动服务器
  • 点击了开始检查器
  • 提供以下功能:

    {   “ platformName”:“ Windows”,   “ deviceName”:“ WindowsPC”,   “ app”:“ C:\ Windows \ System32 \ notepad.exe” }

我得到的是以下日志:

[HTTP] --> POST /wd/hub/session
[HTTP] {"desiredCapabilities":{"app":"C:\\Windows\\System32\\notepad.exe","deviceName":"WindowsPC","platformName":"Windows","newCommandTimeout":0,"connectHardwareKeyboard":true}}
[MJSONWP] Calling AppiumDriver.createSession() with args: [{"app":"C:\\Windows\\System32\\notepad.exe","deviceName":"WindowsPC","platformName":"Windows","newCommandTimeout":0,"connectHardwareKeyboard":true},null,null]
[BaseDriver] Event 'newSessionRequested' logged at 1562752317506 (11:51:57 GMT+0200 (W. Europe Daylight Time))
[Appium] Appium v1.14.0 creating new WindowsDriver (v1.5.1) session
[Appium] Capabilities:
[Appium]   app: C:\Windows\System32\notepad.exe
[Appium]   deviceName: WindowsPC
[Appium]   platformName: Windows
[Appium]   newCommandTimeout: 0
[Appium]   connectHardwareKeyboard: true
[BaseDriver] Creating session with MJSONWP desired capabilities: {"app":"C:\\Windows\\System...
[BaseDriver] The following capabilities were provided, but are not recognized by Appium:
[BaseDriver]   app
[BaseDriver]   connectHardwareKeyboard
[BaseDriver] Session created with session id: b4f9003f-6a56-47b8-b9f3-bf70ac3dc91d
[WinAppDriver] You must use WinAppDriver version 1.1
[WinAppDriver] Verifying WinAppDriver version 1.1 is installed via comparing the checksum.
[WinAppDriver] Deleting WinAppDriver session
[BaseDriver] Event 'newSessionStarted' logged at 1562752317614 (11:51:57 GMT+0200 (W. Europe Daylight Time))
[MJSONWP] Encountered internal error running command: Error: Could not verify WinAppDriver install; re-run install
[MJSONWP]     at C:\Users\myUser\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-windows-driver\lib\winappdriver.js:35:13
[MJSONWP]     at Generator.next ()
[MJSONWP]     at asyncGeneratorStep (C:\Users\myUser\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\@babel\runtime\helpers\asyncToGenerator.js:3:24)
[MJSONWP]     at _next (C:\Users\myUser\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\@babel\runtime\helpers\asyncToGenerator.js:25:9)
[MJSONWP]     at run (C:\Users\myUser\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\core-js\modules\es6.promise.js:75:22)
[MJSONWP]     at C:\Users\myUser\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\core-js\modules\es6.promise.js:92:30
[MJSONWP]     at flush (C:\Users\myUser\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\core-js\modules\_microtask.js:18:9)
[MJSONWP]     at process._tickCallback (internal/process/next_tick.js:61:11)
[HTTP] <-- POST /wd/hub/session 500 113 ms - 190
[HTTP] 
[HTTP] --> DELETE /wd/hub/session
[HTTP] {}
[HTTP] No route found. Setting content type to 'text/plain'
[HTTP] <-- DELETE /wd/hub/session 404 1 ms - 57

卸载并重新安装没有帮助。 我做错什么了吗? Windows驱动程序应该手动启动吗?

1 个答案:

答案 0 :(得分:0)

您可以从Windows命令提示符下运行硒服务器

C:\Users\Administrator> “C:\Program Files (x86)\Windows Application Driver\WinAppDriver.exe” 4723/wd/hub

服务器运行后。在Visual Studio中使用断点,然后开始调试。开始调试时,您将在命令窗口中看到sessionID。复制该会话ID

打开appium>文件>新会话窗口>自定义服务器>附加到会话>粘贴会话ID>单击“附加到会话”>

您将得到您的结果。 (appium需要一些时间来获取当前会话)。