copenndthagen
copenndthagen

Reputation: 50722

Selenium WebDriver waitForText()

For AJAX application testing, is there a waitForText() method using Selenium WebDriver?

Basically, I need to test for refreshed/new element/text value post AJAX request.

Is an example of this available?

Upvotes: 1

Views: 2174

Answers (1)

Petr Mensik
Petr Mensik

Reputation: 27496

Just do

WebElement myDynamicElement = (new WebDriverWait(driver, 10))
  .until(ExpectedConditions.textToBePresentInElement(By.id("idOfElement")));

where 10 is timeout for polling, JavaDoc.

Upvotes: 5

Related Questions