title: Selenium Webdriver: how to use xpath filter?
body: <p>I'm trying to follow the Selenium Webdrive Basic Tutorial in the case of using HTML tables here </p>
  
  <p><a href="http://www.toolsqa.com/selenium-webdriver/handling-tables-selenium-webdriver/" rel="nofollow">http://www.toolsqa.com/selenium-webdriver/handling-tables-selenium-webdriver/</a></p>
  
  <p>The code of "Practice Exercise 1" in that page doesn't work: the problem seems to be about the xpath filter here</p>
  
  <pre><code>String sCellValue = driver.findElement(By.xpath(".//*[@id='post-1715']/div/div/div/table/tbody/tr[1]/td[2]")).getText();
  </code></pre>
  
  <p>and here</p>
  
  <pre><code>driver.findElement(By.xpath(".//*[@id='post-1715']/div/div/div/table/tbody/tr[1]/td[6]/a")).click(); 
  </code></pre>
  
  <p>The page used in the sample code is this one</p>
  
  <p><a href="http://www.toolsqa.com/automation-practice-table/" rel="nofollow">http://www.toolsqa.com/automation-practice-table/</a></p>
  
  <p>I've tried to change the code extracting the xpath directly form the page using Firebug and my new code is the following</p>
  
  <pre><code>package practiceTestCases;
  
  import java.util.concurrent.TimeUnit;
  
  import org.openqa.selenium.By;
  
  import org.openqa.selenium.WebDriver;
  
  import org.openqa.selenium.firefox.FirefoxDriver;
  
  public class PracticeTables_00 {
  
  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("/html/body/div[1]/div[3]/div[2]/div/div/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("/html/body/div[1]/div[3]/div[2]/div/div/table/tbody/tr[1]/td[6]/a")).click();        
  
          System.out.println("Link has been clicked otherwise an exception would have thrown");
  
          driver.close();
  
  }
  
  }
  </code></pre>
  
  <p>Trying to execute the error is still </p>
  
  <pre><code>Exception in thread "main" org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"xpath","selector":"/html/body/div[1]/div[3]/div[2]/div/div/table/tbody/tr[1]/td[2]"}
  </code></pre>
  
  <p>I'm using Eclipse Luna on Windows 7</p>
  
  <p>Any suggestions? Thank you in advance ... </p>
  
  <p>Cesare</p>