Huong Vo Mai
Huong Vo Mai

Reputation: 1

locate element in selenium webdriver

I'm using Selenium to navigate a webpage which has a link named "Edit", using WebDriver (just recently switched from RC to WebDriver). I want to click on the link but the testcase always fails with the error:

org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"link text","selector":"Edit"}

When inspecting the element with Firebug I got the following HTML:

<a href="/00kn00000039X4j/e?retURL=%2F006n0000002BuKq" class="actionLink" title="Edit - Record 1 - Collaborator - Concurrent User License (Includes 1 year Maintenance)">Edit</a>

This is the Java which attempts to click the link:

driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
driver.findElement(By.linkText("Mail")); 

I can see that the element is present on screen but still, the test case fails.

Does anyone know what I might be missing here or an alternative way to find the link element?

Upvotes: 0

Views: 82

Answers (1)

Vignesh Paramasivam
Vignesh Paramasivam

Reputation: 2470

The link text is Edit not Mail

driver.findElement(By.linkText("Edit"));

Upvotes: 1

Related Questions