This is one of the reasons I like to write my code as:
public boolean isDueDateHeaderDisplayed() {
String xpathExpression = "//table[1]/thead/tr[2]/th[3]";
WebElement we = driver.findElement(By.xpath(xpathExpression));
return we.isDisplayed();
}
If you wrote it this way you would see that it is failing on the
findElement call. You are trying to figure out what is wrong with
isDisplayed but you aren't even making it to that code.
According to your xpath you are expecting to see at least:
<table>
<thead>
<tr><th>R1C1</th><th>R1C2</th><th>R1C3</th></tr>
<tr><th>R2C1</th><th>R2C2</th><th>R2C3</th></tr>
</thead>
</table>
You might have more than two rows in the THEAD section. You probably
have a TBODY section after the THEAD section. You might have a TFOOT
sections immediately after the THEAD section. You might have more
then 3 TH tags. If you have less than 3 TH in the first row, you'll
need some COLSPAN or having different number of columns in the headers
can cause odd behaviour.
Darrell