Reputation: 55343
I've tried this:
driver.wait(function() {
return driver.isElementPresent(webdriver.findElement(By.xpath("//*[contains(text(),'Vanilla Sky Final Scene')]")))
}, 20000).then(function() {
console.log('worked')
})
and this:
driver.wait(function() {
return driver.isElementPresent(driver.findElement(By.xpath("//*[contains(text(),'Vanilla Sky Final Scene')]")))
}, 20000).then(function() {
console.log('worked')
})
And this:
driver.wait(function() {
return driver.findElement(By.xpath("//*[contains(text(),'Vanilla Sky Final Scene')]")))
}, 20000).then(function() {
console.log('worked')
})
None of them seem to work. What's the right way to do it?
Upvotes: 1
Views: 6046
Reputation: 7421
The correct function is isDisplayed()
, the following should work:
driver.wait(function() {
return driver.findElement(By.xpath("//*[contains(text(),'Vanilla Sky Final Scene')]")).isDisplayed();
}, 20000);
Upvotes: 2