cancel
Showing results for 
Search instead for 
Did you mean: 

Click on the link on current web page should open browser in another tab.

Super Contributor

Click on the link on current web page should open browser in another tab.

When click on the link on the current web page open the browser and that too in another tab - how we can do in testcomplete ?

 

Thanks

NG

10 REPLIES 10
Highlighted
Community Hero

Re: Click on the link on current web page should open browser in another tab.

If the new page is a different URL, then no problem.  It would be mapped as a different page object in TestComplete and operated against appropriately.


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
Highlighted
Super Contributor

Re: Click on the link on current web page should open browser in another tab.

@tristaanogre 

Thanks for the updates 

 

Yes New page is different URL. I have mapped it . But When We click on the link on the current page then how can I ask testcomplete to click on the new page in another tab ?

 

 

Highlighted
Super Contributor

Re: Click on the link on current web page should open browser in another tab.

Just like we do right click and then select "Open link in New Tab" manually.

How can we ask testcomplete to do this ?

Highlighted
Community Hero

Re: Click on the link on current web page should open browser in another tab.

Question: What is the test purpose of this? I would expect that, if this is an application requirement to open a new tab on clicking the link, a standard "click" would do what you want.

I mean, you can do it.  You would have to use the ClickR method to perform the right click. Clicking on the context menu is a bit different and tricky.  I don't like having to work with context menus unless I explicitly have to.  I tried it in Chrome and it's not pretty.

 

So, if THAT's what you want to do, here's what I would suggest.

 

1) Grab the URL from the appropriate property on the link you want to click and store it in a variable

2) Use the keystrokes your browsewr has for opening a new tab.  Basically, I sent a Keys("^t") to my page to open the new tab

3) Use the "ToURL" method on your browser to navigate to the URL captured in step 1.

 

This will open up the new tab and navigate to the appropriate URL in that new tab.  Then, if the pages are mapped properly, TestComplete will operate on the appropriate tabs based upon the page that is used.

 

2020-02-24 14_38_59-TestComplete - C__MySource_Sandbox_Sandbox.pjs.png

2) 


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
Highlighted
Super Contributor

Re: Click on the link on current web page should open browser in another tab.

I need to check whether link navigate to another application page from the current page. So when click on the link it open up another application on top of the current page. I do not have the way to go back to same page from where I clicked on the link except using back button of the browser which I do not want to use.

 

Thanks

NG

Highlighted
Community Hero

Re: Click on the link on current web page should open browser in another tab.

Does your app not have a Back or Return or some other button that the user would click to go back to the first browser?  If the user has to use the back button on the browser, then that's what you should do too.

Highlighted
Super Contributor

Re: Click on the link on current web page should open browser in another tab.

No the app do not have back button.

In the mean time I am trying to follw the solution mentioned by @tristaanogre 

I am not sure how the users are using those applications. we do not expect to use back browser button. 

 

Thanks

NG

Highlighted
Community Hero

Re: Click on the link on current web page should open browser in another tab.

If your purpose is to make sure that the link takes you to the correct page, you may not need to navigate to it.  There is a property on a link that contains the URL of the target page.  You could simply set up a property checkpoint to check that value.  


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
Highlighted
Super Contributor

Re: Click on the link on current web page should open browser in another tab.

@tristaanogre 

Thanks for the updates

 

I am seeing the property

namePropStr - showing the URL without the https

 

then we have also browser specific property like 

origin 

 

So suppose if clicking on the link give 404 error then how will this take care without navigating ?

 

Thanks

NG