how to focus on specific screen if there exists two same window application screen
I am testing Windows application, like Create New Member. After i input data in "New Member" screen and click on "Save" button, then click on "Add Dependent" button, it will open the "Add Dependent" screen and same as "New Member". Now it seems that TC always focus on "New Member" screen, so TC will failure when need to input data in "Add Dependent" screen. So how can i just focus on "Add Dependent" screen.
For focusing a window you need to use below code,
And also not you have a unique properties for Test Complete to identify both both window objects.
This looks, both widows have their unique property. But you have mapped both windows as same window.
Have you mapped both objects with below properties,
I use below method to SetFocus, but it will prompt the message: cannot obtain the window with the window class "ThunderRT6FormDC", window caption "MRMEMBMNT01 - Member Maintenance - Add Dependent".
obj = Aliases.Caesar.CSR_MAIN.MDIClient.MRMEMBMNT01
winobj = obj.Window("ThunderRT6FormDC", "MRMEMBMNT01 - Member Maintenance - Add Dependent")
Can you try below,
def FocusOnAddDependent(): obj = Aliases.Caesar.CSR_MAIN.MDIClient winobj = obj.Window("ThunderRT6FormDC", "MRMEMBMNT01 - Member Maintenance - Add Dependent") winobj.SetFocus()
I'm not a python script-er,
Aliases.Caesar.CSR_MAIN.MDIClient.MRMEMBMNT01 this is your expected object to click, But you are trying to find the same window again thats you getting error.