I'm using npm's Selenium Webdriver.
I can't make the By.cssSelector
work. Everything else does: By.tagName
, By.id
, etc.
Code:
var webdriver = require('selenium-webdriver'),
By = require('selenium-webdriver').By,
until = require('selenium-webdriver').until
var driver = new webdriver.Builder()
.forBrowser('firefox')
.build()
driver.get('http://www.facebook.com/')
driver.findElement(By.name('email')).sendKeys('[email protected]')
driver.findElement(By.name('pass')).sendKeys('xxx')
driver.findElement(By.id('pass')).submit()
driver.findElement(By.name('xhpc_message')).sendKeys('https://www.youtube.com/watch?v=UfvZvd-kjyo')
driver.wait(function () {
return driver.isElementPresent(driver.findElement(By.cssSelector(".uiScaledImageContainer")))
}, 10000)
I get this error:
alex@alex-K43U:~/node/sapp$ node app.js /home/alex/node/sapp/node_modules/selenium-webdriver/lib/goog/async/nexttick.js:41 goog.global.setTimeout(function() { throw exception; }, 0); ^
TypeError: By.cssSelector is not a function
What am I doing wrong?
According to this page it should be .css(selector), rather than .cssSelector(selector).
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