Create Automation Script to Count total hyperlink in Web Pages

0


import java.util.List;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
public class GetAllHyperLink {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", "c://chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("http://www.shivaconceptsolution.com");
List<WebElement> ele  = driver.findElements(By.tagName("a"));
System.out.print("Number of hyperlink is "+ele.size());
for(WebElement o:ele)
{
System.out.println(o.getAttribute("href"));
}
}
}


Post a Comment

0Comments

POST Answer of Questions and ASK to Doubt

Post a Comment (0)