zoukankan      html  css  js  c++  java
  • UWP UI自动化测试(一)------WinAppDriver/Inspect.exe环境准备

    安装的软件:

    1、WinAppDriver

       WinAppDriver官网:https://github.com/Microsoft/WinAppDriver上面有些 demo。

          Application Driver直接安装地址:https://github.com/Microsoft/WinAppDriver/releases 

          或者 https://www.microsoft.com/en-us/download/details.aspx?id=51663

    环境准备

      安装完成后,默认在系统的:C:Program Files (x86)Windows Application DriverWinAppDriver.exe

      这个工具的作用是你写的测试工程,通过本地 localhost(127.0.0.1)以 json 方式与 WinAppDriver 进行通信,使 WinAppDriver调用 win32 api来模拟屏幕操作,如果鼠标点击、拖拽、触屏手势等,后续据说会支持 xbox 手柄、hololens 等操作。

    唯有启用Developer Mode,才能够使我们的程序能够检查界面元素及操纵界面。
    进入设置,查找Developer Mode即可:

     启用开发者模式:
     

    如果遇到错误 Developer Mode package failed to install. Error code: 0x80004005,需要按照以下步骤解决:

    1. Win + R ,输入regedit 打开注册表
    2. 找到以下键值:HKEY_LOCAL_MACHINESOFTWAREPoliciesMicrosoftWindowsWindowsUpdateAU
    3. 在右侧面板找到一个叫做UseWUServer的DWORD值,它的值可能是1. 双击修改该值为0
    4. 重启机器
    5. 再次进入“设置”尝试一次

    2、 inspect.exe

     这个工具是用来查看运行软件(uwp、win32、win form、wpf)的 UI 元素的 Name、ID、Text 等等。包含在 Windows SDK 中。

     安装完 Visual Studio2015后,可以在 C盘下找到:C:Program Files (x86)Windows Kits10inx64inspect.exe

     元素对照表:

    Client APILocator StrategyMatched AttributeExample
    FindElementByAccessibilityId accessibility id AutomationId AppNameTitle
    FindElementByClassName class name ClassName TextBlock
    FindElementById id RuntimeId (decimal) 42.333896.3.1
    FindElementByName name Name Calculator
    FindElementByTagName tag name LocalizedControlType (upper camel case) Text

    相关参考:

    UI Testing: What's new with WinAppDriver:https://channel9.msdn.com/Events/Build/2017/P4084

    Improving App Quality with UI Automation:https://channel9.msdn.com/Events/Connect/2016/202?ocid=player

    Automate Windows And Mac Apps With The WebDriver Protocol - Dan Cuellar, FOODIt:https://www.youtube.com/watch?v=MgBRvQOZhec

    StarDriver Enterprise Appium to the Future | Jonathan Lipps:https://www.youtube.com/watch?v=e61OhZzbsEI

    github WinAppDriver: https://github.com/microsoft/winappdriver

    Modern Dev Practices: Unit Testing:https://channel9.msdn.com/Shows/Visual-Studio-Toolbox/Modern-Dev-Practices-Unit-Testing

    Inspect.exe: https://msdn.microsoft.com/en-us/library/windows/desktop/dd318521(v=vs.85).aspx

    Windows SDK and emulator archive : https://developer.microsoft.com/en-us/windows/downloads/sdk-archive

    Windows Automation API: UI Automation:https://msdn.microsoft.com/zh-cn/library/ms726294(vs.85).aspx

    AutomationID :https://docs.microsoft.com/en-us/dotnet/framework/ui-automation/use-the-automationid-property

    UI Automation Overview: 
    https://docs.microsoft.com/en-us/dotnet/framework/ui-automation/ui-automation-overview
    https://msdn.microsoft.com/zh-cn/library/ms728097(v=vs.85).aspx

  • 相关阅读:
    HBase 在HDFS上的物理目录结构
    Hbase-site.xml
    hbase-default.xml(Hbase 默认参数翻译)
    flink-conf.yaml
    Spark Standalone spark-default.conf
    Spark Standalone spark-env.sh
    windows linux 文件编码转换
    Hbase G1 gc 调优最终参数
    python
    python
  • 原文地址:https://www.cnblogs.com/gracemm/p/9510268.html
Copyright © 2011-2022 走看看