WinAppDriver UI自动化测试环境搭建

WinAppDriver UI自动化测试环境搭建,第1张

WinAppDriver UI自动化测试环境搭建 WinAppDriver 简介

Windows Application Driver (WinAppDriver)是由微软开发和支持的,基于Appium和Selenium构建的。所以在同一个框架中,可以集成Web, 移动端和桌面端的测试。

支持Windows10系统,应用程序类型: UWP, WPF, WinForms, Win32。

 官网:https://github.com/Microsoft/WinAppDriver

窗口组件元素识别工具

inspect.exe:微软官方工具集成于 Windows SDKFlaUInspect:第三方开源的识别工具

https://github.com/FlaUI/FlaUInspectUIRecorder: WinAppDriver里内置的识别工具

https://github.com/microsoft/WinAppDriver/tree/master/Tools/UIRecorder 安装,配置和运行

下载并安装WinAppDriver,为了方便使用,可以添加到环境变量里

打开开发者模式

默认运行IP和端口 127.0.0.1:4723,

 也可以自定义IP和端口

WinAppDriver.exe 4727
WinAppDriver.exe 10.0.0.10 4725
WinAppDriver.exe 10.0.0.10 4723/wd/hub
 启动参数
DesiredCapabilities options = new DesiredCapabilities();
options.setCapability("app", "AppId");
options.setCapability("ms:waitForAppLaunch", 30);
options.setCapability("ms:experimental-webdriver", true);
session = new WindowsDriver(new URL("http://127.0.0.1:4723", options);
session.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);

AppID 填写被测程序的路径 C:eclipsejava-2021-09eclipseeclipse.exe

如果是微软自带的程序或者通过Microsoft Store安装的程序,可以在Windows PowerShell下通过 Get-StartApps 查看AppID

注意,其中ms:experimental-webdriver 是在WinAppDriver v1.2.1新添加的参数。如果设置true的话,当findElements 时用xpath会返回null。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5713308.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-17
下一篇 2022-12-17

发表评论

登录后才能评论

评论列表(0条)

保存