Count elements/links on page using webdriver
Sometimes we need to count links on page. Here we are counting the elements on page. We use the same method for any type of element like link, span,button just use html tag of that element in xpath. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// import java.net.URL; import java.util.List; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By ; import org.openqa.selenium.WebDriver; import org.openqa.selenium. WebElement; import org.openqa.selenium.chrome. ChromeDriver; import org.openqa.selenium.firefox. FirefoxDriver; import org.openqa.selenium.firefox. FirefoxProfile;