1

我一直在研究如何从上下文菜单中访问这些项目,但是,到目前为止我的搜索还没有成功。我发现 ContextMenu 显示为 Desktop 的子项,这也是 MSDN 所证实的。我正在为控制台应用程序进行自动化。但是,当我调试以查看桌面的子项时,或尝试从我的根目录访问我的上下文菜单时 - 它表示它不存在。此外,UISpy/Inspect 告诉我 ProcessID 与我的应用程序相关。那么麻瓜和父母在哪里呢?

下面是我正在使用的代码示例

//Launched application here
   Application Console2 = Application.Launch(@"C:\Program Files (x86)\ABC.exe");
   Thread.Sleep(3000);

   // got context on main window of application
   Window MainWindow =       Console2.GetWindow("ABC",White.Core.Factory.InitializeOption.NoCache); 

   // In the console there is tree and got focus on that well 
   Tree GetTree = MainWindow.Get<Tree>(SearchCriteria.ByAutomationId("9999"));
   TreeNode computertree = MainWindow.Get<TreeNode>   (SearchCriteria.ByText("Machines"));

   // Searched treee node as Groups and right click on that control 
   TreeNode DMG = DSMainWindow.Get<TreeNode>(SearchCriteria.ByText("Groups")); 
   DMG.Click(); 
   DMG.RightClick();

右键单击 TreeNode 后,我得到了弹出菜单,我想单击其中一个可用的选项(菜单项)。但是在检查工具中弹出菜单显示为上下文及其桌面的子项。我无法专注于上下文菜单并单击可用的选项(菜单项)?谁能指导我如何单击上下文菜单上可用的菜单项?

提前致谢!

4

0 回答 0