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!
Solved! Go to Solution.
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?
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.
Hi @AlexKaras thanks for you reply, but I can't map any browser to any of the object, because we need to run the test on all of the popular browsers whenever needed. So base on this, is there any other way to solve the issue?
Hi,
As one of the possible solutions, you may consider to map the browser via not hardcoded value, but via the Project Variable (of temporary type) and set the required value to this variable during runtime to reference the proper browser.
https://support.smartbear.com/testcomplete/docs/testing-with/object-identification/name-mapping/basi... for more details.
Hi @AlexKaras , I went through the topic you provided, but still not sure how to setup a browser variable on a mapped object. I setup a temporary variable with type as String and default value to firefox, but how can I configure this temp variable on a mapped object? All the web page objects have their own native values, I tried override the object native value from Constant mode to project variable mode with the default value (firefox), but then TC can no longer find the object anymore. Can you give more instruction how I can do this?
Thanks
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?
Thanks for your help, AlexKaras!
@whuang, was the issue resolved? What solution did you decide to use in the end?
Subject | Author | Latest Post |
---|---|---|