package selenium_examples;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class Example {
public static void main(String[] args)
{
WebDriver driver = new FirefoxDriver();
driver.get("http://www.w3schools.com/html/html_tables.asp");
String text=driver.findElement(By.xpath("//table/tbody/tr[3]/td[2]")).getText();
System.out.println(text);
}
Output:- Jackson
Above script gets 3rd row,2nd column cell text from below shown table.
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class Example {
public static void main(String[] args)
{
WebDriver driver = new FirefoxDriver();
driver.get("http://www.w3schools.com/html/html_tables.asp");
String text=driver.findElement(By.xpath("//table/tbody/tr[3]/td[2]")).getText();
System.out.println(text);
}
Output:- Jackson
Above script gets 3rd row,2nd column cell text from below shown table.
No comments:
Post a Comment