Forum Discussion
TanyaYatskovska
10 years agoSmartBear Alumni (Retired)
Hi Purush,
There are many ways to count the links from a panel or a page. The code below uses the EvaluateXPath method that searches for HTML's A tag on a page:
function LinkCounter()
{
var page = NameMapping.Sys.Browser("chrome").Page("http://smartbear.com/forums/");
page.Form("form").Panel("container").Panel(1).Panel(0).Nav(0).Link(0).Click();
var panel = page.Form("form").Panel("container").Panel(1).Panel(0).Nav(0).Panel(0).Panel(0).Panel(3);
var tmp = panel.EvaluateXPath("//A");
if (tmp != null)
{
// Convert the array to the JScript-compatible format
var links = (new VBArray(tmp)).toArray();
Log.Message("Number of liks: " + links.length);
}
}
Refer to the "Finding Web Objects Using XPath Expressions" article for details.
Related Content
- 4 years agoSuperTester
Recent Discussions
- 5 hours agoSvetaG