Forum Discussion

  • Mr_Bro's avatar
    Mr_Bro
    Frequent Contributor

    Hi DSmachineWorld,

    If you are trying to achieve in web applications the other approach would be to make use of FindElements Method

    please refer the below code snippet for your reference

    function FindElements_Example()
    {
      var browser = Sys.Browser();
      var page = browser.Page("*services.smartbear.com/samples/TestComplete*/smartstore*");
      var links = page.FindElements("//body//a");
    
      if (links.length > 0)
      {
        for (var i = 0; i < links.length; i++)
        {
          /* Write your logic here to click each link and verify the page is valid or not
          for our example we can print the innertext property */
          Log.Message(links[i].innerText);
        }
      }
      else
      {
        Log.Message("visited all the link.");
      }
    }