Forum Discussion

whuang's avatar
whuang
Regular Contributor
5 years ago
Solved

How can I stay on the popup window and perform actions?

Hello,   I have a test that will trigger a popup window, and I need to enter some data on the popup, I used the SetFocus to try to stay on the popup, but when TC run the codes after the setfocus,...
  • tristaanogre's avatar
    tristaanogre
    5 years ago

    OK, first of all...  why no NameMapping?  Honestly, that's going to be the BEST way to identify objects and make sure they are distinct.  You are using a wildcard for the page which will find ANY page, literally the FIRST page it finds will be returned.  If your popup is a second page in the Browser, then there's no guarentee that your code will find it.  AT LEAST you need to be specific in the page.  

    So, your popup comes up... I still don't know EXACTLY what that popup is, but your code below will find the first textbox with the label indicated in whatever page is returned.   By the description of your behavior, probably the first page it returns is NOT the page containing your popup, so that's why it activates the page instead of the popup.

     

    So:

     

    1) Consider mapping all your components rather than relying on find methods solely... use Find when mapping doesn't make sense

    2) Be more specific with all aspects of your object identification, even the page URL