Forum Discussion

whuang's avatar
whuang
Regular Contributor
5 years ago
Solved

How can I stay and perform actions on a webpage after switching to another browser page

Hi Support,

 

Sometimes I need to launch two browsers and switch back and forth between the two browsers during the test, but I am having difficulty to stay on the page and perform actions after switching to another browser page. So my steps are, launch a page with a browser, firefox let's say, and then launch the same page on a different browser, iexplore for instance, then I called "Sys.Browser("firefox").BrowserWindow(0).Activate();" to switch back to firefox, and called "Aliases.browser.E5Admin.LeftNevMenu.All.HoverMouse();" to hover the mouse over a menu item, which it did, so far so good. But the next action is an link click, which TC errored out by trying to click on the link on iexplore, but I don't want it goes back to iexplore, I need it to click on the link from my currect active brwoser page. I didn't specify anything browser related when mapping the link it was clicking, so I don't understand why all the sudden it wanted to swtich back to the previous browser, plus it did perform a hovermouse action on the active browser after I switched browsers. Any suggestion how I can stay on the new active browser page and perform actions?

 

Thanks in advance!

  • Hi,

     

    > how can I configure this temp variable on a mapped object?

    You should use this variable to provide the value to the process name (or ObjectIdentifier) identification parameter for the Browser mapped object. The Page and all other page elements do not require any adjustments (assuming that they have the same structure for all target browsers).

    Then, during test execution, when you need to switch to another browser, you will need to assign required value to this variable (e.g. iexplore) and, optionally, call the .RefreshMappingInfo() method to make TestComplete to refresh its internal objects cache. The necessity of the latter may be verified experimentally.

     

    Does this help?

     

6 Replies

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    > I didn't specify anything browser related when mapping [...]

    This is the point.

    If you precisely specify action target (browser, page, link, etc.) then TestComplete executes action on the specified object.

    If the target object is not specified with full details (e.g. - browser is omitted or specified as '*'), then TestComplete starts to search in its Objects Tree for the object that fits specified generic criteria and proceeds with the requested action as soon as the first object that meets search criteria is found.

     

  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Thanks for your help, AlexKaras!

     

    whuang, was the issue resolved? What solution did you decide to use in the end?