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('');
driver.wait(until.elementIsVisible(By.id('someButton')), 5000);
This is on my local machine using 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?
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.');
driver.wait(until.elementIsVisible(By.id('someButton')), 5000);
This is on my local machine using https://www.npmjs./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?
Share Improve this question edited Aug 16, 2017 at 15:57 Christopher Grigg asked Aug 16, 2017 at 9:43 Christopher GriggChristopher Grigg 2,30827 silver badges35 bronze badges 7- 1 There is a issue with some version of selenium webdriver, safari driver. Could you test with Safari 9.1 – Gaurang Shah Commented Aug 16, 2017 at 10:07
-
Which Selenium binding are you using?
Java
? – undetected Selenium Commented Aug 16, 2017 at 10:22 - I tested with Safari 10.1.2 and Firefox 54.0.1 and am getting the same error. – Christopher Grigg Commented Aug 16, 2017 at 14:17
- I'm using npmjs./package/webdriver-manager and this worked out of the box – Christopher Grigg Commented Aug 16, 2017 at 14:19
-
You haven't specified what language you are using (should be added as a tag) and haven't responded to a request for that info so it's hard to tell. If I were to guess, it's likely that you are using the wrong syntax in the last line. There should be a reference to
ExpectedConditions
in there somewhere. Look at some wait sample code in your language and follow those examples. – JeffC Commented Aug 16, 2017 at 14:20
1 Answer
Reset to default 16Problem
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./SeleniumHQ/selenium/issues/2935