如何使用C#为WinAppDriver创建测试项目
我需要了解如何在Visual Studio中设置WinAppdriver Windows App测试项目,并检查中等大小的Windows应用程序的元素。
I need to learn about how to set-up a winappdriver windows app test project in visual studio and inspecting the elements for a medium size windows application.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
版本。我在安装后下载了1.2版本
(x86)\ Windows应用程序驱动程序位置。
未启用模式。通过设置启用它并重新启动Windows
应用程序驱动程序
元素检查器,则已经在计算机上安装了元素检查器
网站,下载并安装它
工作正常
**。
创建一个新的Nunit测试项目
2-从Nuget下载Appium依赖性
3-更新现有的UnitTest1.cs类,如下:**
4 =运行测试
注意:如果缺少某些引用或软件包,请右键单击它,并将其包含在解决方案中。
5-创建Windows元素并执行操作
打开测试的应用程序(AUT),在我们的情况下是Notepad.exe,并检查exe工具以获取定位器。
单击记事本文本区域,然后在nevess.exe工具的右侧找到AutomationId属性。
WindowsElement Notepadtextarea = desktopsession.findelementByAccostibilityId(“ 15”);
notepadtextarea.sendkeys(“ Hello World”);
尝试!尝试! ,运行测试!运行测试!运行测试!
version. I downloaded the 1.2 version
(x86)\Windows Application Driver location.
mode is not enabled. Enable it through Settings and restart Windows
Application Driver
have Element Inspector already installed on your machine
site, download and install it.Run the inspect.exe and make sure it is
working fine
**.
Create a new NUnit test project
2- download appium dependency from NuGet
3- Update an existing UnitTest1.cs class as follows:**
4= Run the test
Note: If some references or packages are missing, right-click on it and include it in the solution.
5- Create Windows Elements and perform actions
Open up application under test (AUT), in our case it is Notepad.exe, and Inspect.exe tool to fetch locators.
Click on the Notepad text area and find the AutomationId attribute on the right-hand side of the Inspect.exe tool.
WindowsElement NotepadTextArea = DesktopSession.FindElementByAccessibilityId(“15”);
NotepadTextArea.SendKeys(“Hello World”);
Try! try! ,Run the test! Run the test! Run the test!
@pawansinghncr的答案是正确的,但我还建议尝试使用UI录音机(检查部分),它在Winappdriver的GitHub的发行页中。
@pawansinghncr's answer is correct, but I would also suggest trying out the UI Recorder (for the inspecting part), it's in the Releases page of the WinAppDriver's Github.