I have an error:
TypeError: element.isDisplayed is not a function
When executing the following code:
var webdriver = require('selenium-webdriver'),
By = webdriver.By,
until = webdriver.until;
var driver = new webdriver.Builder()
.forBrowser('chrome')
.usingServer('http://localhost:4444/wd/hub')
.build();
driver.get('https://www.test.com');
driver.wait(until.elementIsVisible(By.id('someButton')), 5000);
This is on my local machine using https://www.npmjs.com/package/selenium-webdriver and kicking off a server with:
webdriver-manager start
My spec:
Mac oSX Sierra 10.12.6
Chrome v60
The site I'm developing on is using AJAX to load pages to this could make a difference?
Problem
until.elementIsVisible(..)
needs a WebElement
an not a Locator
as a Argument.
Solution
Writing
driver.wait(until.elementIsVisible(driver.findElement(By.id('someButton'))), 5000);
instead of
driver.wait(until.elementIsVisible(By.id('someButton')), 5000);
will solve the Problem.
More Infos
http://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/lib/until.html https://github.com/SeleniumHQ/selenium/issues/2935
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With