riponalwasim
10 years agoOccasional Contributor
Solved
How to verify that a new tab is opened in a browser with TestComplete using C#
I am testing a website. In the body of website has a URL. After clicking that URL it should be opened in new tab, not in same window. After clicking the URL link it is opened in new tab. I want to verify that feature by using TestComplete.
How to do it?
Hi Ripon,
You can count the number of the Page objects before and after clicking the link to open a new page in a new tab. Here is an example:
function test() { var before = getNumberofPages(); // Open a new tab var after = getNumberofPages(); } function getNumberofPages() { var browser = Sys.Browser("chrome"); var pages = browser.FindAllChildren("ObjectType", "Page", 1); pages = (new VBArray(pages)).toArray(); return pages.length; }