package com.seleniumWebdriver;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.testng.annotations.Test;
/**
* @Blog Name : Selenium Code Example
* @author Deepak Gupta
* @Created Date 4-08-2017
*
*/
public class FindNoOfLinks extends SuperTestNG {
@Test
public void handleNoofLinks() {
try {
driver.get("http://only-testing-blog.blogspot.in/2013/09/testing.html");
List<WebElement> e = driver.findElements(By.tagName("a"));
int n = e.size();
logger.info("No. of link is: " + e.size());
for (int i = 0; i < n; i++) {
logger.info(e.get(i).getText());
}
Thread.sleep(2000);
} catch (Exception e) {
e.printStackTrace();
}
}
}
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.testng.annotations.Test;
/**
* @Blog Name : Selenium Code Example
* @author Deepak Gupta
* @Created Date 4-08-2017
*
*/
public class FindNoOfLinks extends SuperTestNG {
@Test
public void handleNoofLinks() {
try {
driver.get("http://only-testing-blog.blogspot.in/2013/09/testing.html");
List<WebElement> e = driver.findElements(By.tagName("a"));
int n = e.size();
logger.info("No. of link is: " + e.size());
for (int i = 0; i < n; i++) {
logger.info(e.get(i).getText());
}
Thread.sleep(2000);
} catch (Exception e) {
e.printStackTrace();
}
}
}
No comments:
Post a Comment