简体   繁体   English

无法在Codedui中找到在后台打开的控件

[英]unable to find the control that opens in background in codedui

I am currently working on AX form for automation . 我目前正在从事自动化的AX表单。 In one of the forms, I am trying to click a button , which opens another form and on this form I need to perform some action. 在其中一个表单中,我试图单击一个按钮,该按钮将打开另一个表单,在此表单上,我需要执行一些操作。

The window which I am opening on button click sometime opens in background and few times pop up in the foreground above the window where I have clicked the button. 我单击按钮时打开的窗口有时会在后台打开,而在单击按钮的窗口上方的前景中会弹出几次。

I would want my window to open in the foreground so that I can perform operation , since it is opening in background the codedui playback is searching for the controls on the main window/parent window, which making test case fail 我希望窗口在前台打开,以便执行操作,因为它在后台打开,因此codedui回放正在主窗口/父窗口中搜索控件,这会使测试用例失败

This is making my test case fails multiple times. 这使我的测试用例多次失败。 I am using SetFocus property and SearchInMinimizedwindow options but none of them is working 我正在使用SetFocus属性和SearchInMinimizedwindow选项,但是它们都不起作用

Is there any solution to always get the window on foreground in codedui or in c# 有什么解决方案可以使窗口始终在Codedui或C#中处于前台

I would suspect the popup window has some of the same automation properties as the parent window. 我怀疑弹出窗口具有与父窗口相同的自动化属性。 If not able to fix this code side by using a different AutomationId, you may be able to workaround this by specifiying this is a different window instance. 如果无法通过使用其他AutomationId来解决此代码问题,则可以通过指定这是一个不同的窗口实例来解决此问题。

SecondWindow.SearchProperties["Instance"] = 2;
SecondWindow.SetFocus();

The window that opens when you click the button, is that the child window of the Main window or does it exist on its own? 单击该按钮时打开的窗口是“主”窗口的子窗口还是它自己存在? Based on that, you will have to search on the parent (Main Window or Desktop). 基于此,您将不得不在父窗口(主窗口或桌面)上进行搜索。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM