No Of Links Present in a WebPage Using Selenium Webdriver


public class numoflinks {


@Test
public void linkspresent()
{
WebDriver driver=new FirefoxDriver();
driver.get("http://newtours.demoaut.com/");

//count of links in entire page
System.out.println("Total links in Demoaut page is:");
System.out.println(driver.findElements(By.tagName("a")).size());
}

}

Output:


Total links in Demoaut page is:
16

PASSED: linkspresent

No comments:

Post a Comment