Reputation: 1345
I am new to Selenium and I'm running into a problem where the code snippet below throws a NoElementFoundException when run via the Chrome driver, but hangs when using the Firefox driver. The expected behavior is both Chrome and Firefox should throw the exception.
I tried embedding this in a try-catch but no exception is caught on Firefox. I searched the Internet, but can't seem to find other posts about the same issue.
public static String getAlbumName(){
WebElement albumName = Browsers.getCurrentDriver().findElement(By.xpath("//div[contains(@class,...")));
String albumNameText = albumName.getText();
return albumNameText;
}
This is the exception through by Chrome: NoSuchElementException: The element could not be found (WARNING: The server did not provide any stacktrace information)
I'm using Selenium 2.25.0
Any ideas why I'm seeing this discrepancy?
Thanks!
Upvotes: 1
Views: 601
Reputation: 1345
Turns out this is a known bug for Firefox 17 in Selenium that will be fixed in Selenium 2.27 http://code.google.com/p/selenium/issues/detail?id=4814
Downgrading to Firefox 16 resolved my problem.
Upvotes: 2