c# - TestStack.White - 使用 SearchCriteria.ByNativeProperty
问题描述
查看所有这些参数,“LabeledBy”参数似乎是识别元素的最佳参数。我正在使用 TestStack.White 进行自动化并以这种方式进行了尝试:
TestStack.White.UIItems.IUIItem[] IUIArr = GetMainWindow().GetMultiple(TestStack.White.UIItems.Finders.SearchCriteria.ByNativeProperty(System.Windows.Automation.AutomationElement.LabeledByProperty, NUnit.Framework.Is.EqualTo(TestStack.White.UIItems.Finders.SearchCriteria.ByNativeProperty(System.Windows.Automation.AutomationElement.NameProperty, "NLP*"))));
GetMainWindow()
是一个函数,返回应用程序的 MainWindow 并且它工作正常。
我的主要问题是,我得到一个例外的文本Der PropertyCondition-Wert für die AutomationElementIdentifiers.LabeledByProperty-Eigenschaft muss "AutomationElement" sein
是什么意思翻译的东西The value for property condition of an AutomationElementIdentifier.LabeledByPropery has to bei "AutomationElement"
我的第二个但不是很重要的问题是:我真的只需要为那个 Is.EqualTo-Function 引用 NUnit 吗?通常我会尽量避免引用外部 DLL,只针对一种方法。
不幸的是,我对使用 nativSystem.Windows.Automation
库不是很熟练,但是没有 TestStack.White 的解决方案也会有所帮助。
解决方案
推荐阅读
- user-interface - 如何从处理中的图像制作按钮
- r - 在 R 中组合多个数据集
- ruby-on-rails - Hotwire Rails - 无法在模块外使用导入语句
- jenkins - Jenkins 在构建失败时运行 shell 命令作为运行失败的 TestNG 计划的构建后操作
- javascript - 谁可以在 NG-Zorro 中自定义 DataPicker 的开始日期和结束日期
- python - 如何使用 OpenCV 从线扫描相机中提取连续图像边界中的对象及其大小?
- linux - linux设备驱动控制高速SPI ADC
- python - 如何修复heroku应用程序部署?应用程序在本地运行但不在线
- kotlin - 将类型传递给 Kotlin 中的函数
- r - 在 SSMS 中执行外部脚本时,如何在 SQL Server 上的 R 上获得正确的编码?