I use Selenium to navigate a webpage that has a link called Mail using WebDriver (I recently switched from RC to WebDriver). I want to click the link, but the test test always fails with an error:
org.openqa.selenium.NoSuchElementException: Unable to find element: {"method": "link text", "selector": "Mail"}
When checking an element with Firebug, I get the following HTML:
<a href="url/New-Doc" target="_top" fahidden="false" faswid="e-switcher-mail" faprop="p-e-switcher-function-id">Mail</a>
This is Java that is trying to click the link:
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
driver.findElement(By.linkText("Mail"));
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
I see that the element is present on the screen, but, nevertheless, the test case fails.
Does anyone know what I may be missing here, or an alternative way to find the link element?
source