Ask a Question

how to focus on specific screen if there exists two same window application screen

Hardy
Occasional Contributor

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.

13 REPLIES 13
shankar_r
Community Hero

Hi,

 

For focusing a window you need to use below code,

 

yourwindowObject.SetFocus()

 

And also not you have a unique properties for Test Complete to identify both both window objects.

 

Reference: https://support.smartbear.com/testcomplete/docs/reference/test-objects/members/window-and-process/se...


Thanks
Shankar R

LinkedIn | CG-VAK Software | Bitbucket | shankarr.75@gmail.com

“You must expect great things from you, before you can do them”

Extension Available

Hardy
Occasional Contributor

Now the two screen's window object was the same, do you know how to deal with this problem. thanks.

It would be better if you post tow objects properties.


Thanks
Shankar R

LinkedIn | CG-VAK Software | Bitbucket | shankarr.75@gmail.com

“You must expect great things from you, before you can do them”

Extension Available

Hardy
Occasional Contributor

It cannot input data to add dependent screen during TC playback, please refer to the attached screenshot.

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,

 

WndCaption

WndClass

 


Thanks
Shankar R

LinkedIn | CG-VAK Software | Bitbucket | shankarr.75@gmail.com

“You must expect great things from you, before you can do them”

Extension Available

Hardy
Occasional Contributor

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".

 

def FocusOnAddDependent():
    obj = Aliases.Caesar.CSR_MAIN.MDIClient.MRMEMBMNT01
    winobj = obj.Window("ThunderRT6FormDC", "MRMEMBMNT01 - Member Maintenance - Add Dependent")
    winobj.SetFocus()

Can you try below,

 

def FocusOnAddDependent():
    obj = Aliases.Caesar.CSR_MAIN.MDIClient
    winobj = obj.Window("ThunderRT6FormDC", "MRMEMBMNT01 - Member Maintenance - Add Dependent")
    winobj.SetFocus()

Thanks
Shankar R

LinkedIn | CG-VAK Software | Bitbucket | shankarr.75@gmail.com

“You must expect great things from you, before you can do them”

Extension Available

Hardy
Occasional Contributor

Still cannot work, it will prompt the message "Python runtime error" and additional info "Runtime error Member not found".

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.

 

Aliases.Caesar.CSR_MAIN.MDIClient.MRMEMBMNT01.SetFocus()


Thanks
Shankar R

LinkedIn | CG-VAK Software | Bitbucket | shankarr.75@gmail.com

“You must expect great things from you, before you can do them”

Extension Available

cancel
Showing results for 
Search instead for 
Did you mean: