RE: Pulling text from DIV element using Selenium/Java

Answered

The text is contained in a DIV element:
<div class=”messageText”>No matches found</div>

The CSS path is:
//#searchResultsWarningMessageBox > table > tbody > tr > td.messageCell > div

The code I have is:
WebElement txtMsg = driver.findElement(By.cssSelector(“#searchResultsWarningMessageBox > table > tbody > tr > td.messageCell > div”));
txtMsg.getText();

I keep gettingĀ  .. no such element. Any ideas or hints?

Richard Allen Train Asked on September 24, 2014 in Selenium WebDriver.
Add Comment
3 Answers

Can you Provide the URL?
Can you provide the complete div tag

Doctor Answered on September 24, 2014.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.