Ask a Question

new tab


new tab

Hello team,


How to open a link in new tab. I want to open the product documentation in new tab.



I have tried through testedobj.keys (cntrl+t) it opens only a new tab. 

Also tried rightclick that link 


Let me know



Trusted Contributor

For example,


function newtab()
    var browser = Sys.Browser("chrome");
    var page = browser.ToUrl("");


You need to give instructions to TC, as to what URL you want to load

Hi rrahvani,

without giving URL is it possible to open in newtab in any other ways.



Frequent Contributor


There are a few different ways to open a link in a new tab the way rraghvagni explained is the way that I also use. but depending on the programming language and framework you are using. In TestComplete, you can open a link in a new tab using the following method:


Alternatively, you can use the .click() method on the link element and set the 'ctrl' property to true:, 1, {ctrl: true});

You can also use the right-click context menu option to open a link in a new tab, by simulating a right-click on the link element and selecting the "Open Link in New Tab" option.



Aliases.browser.popupMenu("Open Link in New Tab").click()

You can also use the JavaScript inbuilt function"link","_blank") to open the link in new tab.



Please note that you need to be careful while using the above JavaScript functions as they may be blocked by the browser.

Trusted Contributor

@ḥari how would you do this manually?


Alternative solutions are provided by @KB1 

I will check this KB1. Thanks

Manually i will right click and click open new tab it's right clicked but not hit the open new tab so only asked if any other ways. Any way thanks..

Trusted Contributor

See Click Action


Using TestObj.Click(1, 1, skCtrl) will open the link in a new tab, whereas TestObj.Click(1, 1, skShift) will open the link in a new window.

Frequent Contributor

Maybe you could use middle mouse button?

when browsing normally I always use mmb to open links in a new tab so TC should be able to do that too.



EDIT: I just tested it with chrome and TC does open new tabs, but those tabs are not focussed.

@MW_Didata Thanks simply it works for my scenario.

To focus tabs


var newTab=Sys.Browser("chrome").Page("*")





Showing results for 
Search instead for 
Did you mean: