查找选项以右键单击c#White/TestStack UI Automation [英] Find option to right click c# White/TestStack UI Automation
问题描述
我正在使用White \ TestStack的C#语言框架创建软件流程自动化.
I am creating a software process automation using the language C # framework by White \ TestStack.
我有一个问题,因为用鼠标右键单击时无法捕获选项.
I have a problem because I am unable to capture an option when I click with the right mouse button.
图片预览
我正在尝试使用的代码
panel.RightClick();
var propClick = _mainWindow.Get<White.Core.UIItems.MenuItems.PopupMenu>(SearchCriteria.ByText("Propeties"));
propClick .Click();
无法捕获该选项,从而使变量变为空propClick
can not capture the option, making the variable becomes null propClick
对不起,我的英语很烂:(
Sorry my english sucks :(
帮助!
谢谢:)
推荐答案
显然,您无法通过Get<T>
方法获取上下文菜单.在找到以下文档之前,我一直在研究这种方法:
https://github.com/TestStack/White/blob/6c61106f2a62686636eb7cace0ee187a02db7295/docs/UIItems.md#menu-bars
Apparently you can’t get context menu via Get<T>
method. I’ve been digging around that approach until I’ve found this piece of documentation:
https://github.com/TestStack/White/blob/6c61106f2a62686636eb7cace0ee187a02db7295/docs/UIItems.md#menu-bars
因此您的情况应该是:
panel.RightClick();
var popup = _mainWindow.Popup;
var properties_item = popup.ItemBy(
SearchCriteria.ByText( "Propeties" )
);
properties_item.Click();
我还建议您对要自动化的每个控件使用自动化ID.
I’d also suggest using automation ID for every control you wish to automate.
这篇关于查找选项以右键单击c#White/TestStack UI Automation的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!