0

I have been asked to track when a user drags a link on our site in to a brand new tab. Is there a drag property that I can use to tell if a new tab was created?

I have tried looking at the dragEnd event but the thing that I could find that might help would be the pageX and pageY. Could it be possible to use these to work out if the link was used to create a new tab?

Cheers

1 Answers1

0

Using TestComplete with C#Script might help you.You can simulate a click to this link and then check whether a new page object with the target URL has appeared.

function Test1()
{
     var browser = Sys.Browser("firefox");
     var numOfTabs = browser.FindAllChildren("ObjectType", "Page").toArray().length;
     var page = browser.ToUrl("http://www.w3schools.com/html/tryit.asp?filename=tryhtml_links_target");

     var pageUrl = page.Url; 
     frame = page.Panel(0).Panel(1).Panel(0).Panel(1).Frame("iframeResult");
     frame.Link(0).Click();

     if (page.Url != pageUrl)
     Log.Error("The page's URL has been changed!");

    if (browser.FindAllChildren("ObjectType", "Page").toArray().length == numOfTabs)
     Log.Error("A new tab has not been opened!");
 }
Nayantara Jeyaraj
  • 2,624
  • 7
  • 34
  • 63