Need to Update on Practice Exercise 1

Hi,

Need to update Practice Exercise 1 codes on this link http://www.toolsqa.com/selenium-webdriver/handling-tables-selenium-webdriver/

Updated working code:

import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.firefox.FirefoxDriver;

public class exercise1 {

private static WebDriver driver = null;

public static void main(String[] args) {

driver = new FirefoxDriver();

driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

driver.get(“http://www.toolsqa.com/automation-practice-table”);

//Here we are storing the value from the cell in to the string variable

String sCellValue = driver.findElement(By.xpath(“.//*[@id=’content’]/table/tbody/tr[1]/td[2]”)).getText();

System.out.println(sCellValue);

// Here we are clicking on the link of first row and the last column

driver.findElement(By.xpath(“.//*[@id=’content’]/table/tbody/tr[1]/td[6]/a”)).click();

System.out.println(“Link has been clicked otherwise an exception would have thrown”);

driver.close();

}

}

jctantiado Default Asked on March 30, 2015 in Selenium WebDriver.

It differs on the given xpath value. Thanks

on March 30, 2015.
Add Comment
2 Answer(s)

Thanks for the updated code, we will soon update your code on the website.

Thanks for your help!!

Virender

Virender Singh Professor Answered on March 30, 2015.
Add Comment

Please include also Example 3 and Practice Exercise 2 for the changes. Thank you.

jctantiado Default Answered on March 31, 2015.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.