cancel
Showing results for 
Search instead for 
Did you mean: 

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

SOLVED
Frequent Contributor

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!

1 ACCEPTED SOLUTION

Accepted Solutions
Community Hero

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

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?

 

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Postings made by [Community Expert Group] members
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================

View solution in original post

6 REPLIES 6
Community Hero

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

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.

 

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Postings made by [Community Expert Group] members
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================
Highlighted
Frequent Contributor

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

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?

Community Hero

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

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.

 

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Postings made by [Community Expert Group] members
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================
Frequent Contributor

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

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

Community Hero

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

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?

 

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Postings made by [Community Expert Group] members
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================

View solution in original post

Community Manager

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

Thanks for your help, AlexKaras!

 

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

 

 

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓
New Here?
Join us and watch the welcome video:
Watch the new Interview
Top Kudoed Authors