new tab
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Solved! Go to Solution.
- Labels:
-
Script Tests
-
Variables
-
Web Testing
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
For example,
function newtab()
{
var browser = Sys.Browser("chrome");
browser.Page("*").Keys("^t");
var page = browser.ToUrl("https://support.smartbear.com/testcomplete/");
}
You need to give instructions to TC, as to what URL you want to load
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi rrahvani,
without giving URL is it possible to open in newtab in any other ways.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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:
link.Object.click(1, 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.
Example:
link.Object.rightClick() Aliases.browser.popupMenu("Open Link in New Tab").click()
You can also use the JavaScript inbuilt function window.open("link","_blank") to open the link in new tab.
Example:
link.Object.eval("window.open(this.href,'_blank');")
Please note that you need to be careful while using the above JavaScript functions as they may be blocked by the browser.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I will check this KB1. Thanks
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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..
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@MW_Didata Thanks simply it works for my scenario.
To focus tabs
Sys.keys("^[Tab]");
var newTab=Sys.Browser("chrome").Page("*")
