Selenium WebDriver uses following methods to access elements:

findElement_By_something

import org.openqa.selenium.By;

driver.findElement(By.id(“locator”)).getText()
driver.findElement(By.cssSelector(“locator”)).getText()
driver.findElement(By.xpath(“locator”)).getText()
driver.findElement(By.name(“locator”)).getText()
share me!:))Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInEmail this to someonePrint this page