I'm trying a black box testing with selenium I'm working with:
- Mac os.: version: 10.9.4
- java.version: 1.6.0_65
- browser: firefox version 32.0.3
- selenium: version 2.43.0
the page holds a table, each row has a unique id which is extracted correctly and stored in String itemId
Then I create the corresponding WebElement and try to click on it as follows:
WebElement anchor = webDriver.findElement(By.id(itemId));
if (anchor != null) {
anchor.click();
Sleeper.sleep(2);
}
and I'm getting this exception:
WARNING: Error extracting item data
org.openqa.selenium.ElementNotVisibleException: Element is not currently visible and so may not be interacted with
I've read in couple of SO questions about WebDriverWait and tried the following code:
String itemId = item.getAttribute("id");
WebDriverWait wait = new WebDriverWait(webDriver, 10);
WebElement anchor = wait.until(ExpectedConditions.elementToBeClickable(By.id(itemId)));
anchor.click();
Sleeper.sleep(2); // yes I know I waited 10 seconds already I have time :)
and now I get the following exception:
WARNING: Error extracting item data
org.openqa.selenium.TimeoutException: Timed out after 10 seconds waiting for element to be clickable
I've tried instead of elementToBeClickable to use ElementIsVisible but it seems depricated