我正在使用npm的Selenium Webdriver.
我无法完成这项By.cssSelector
工作.其他一切的作用:By.tagName
,By.id
,等.
码:
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('xxx@gmail.com') 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)
我收到此错误:
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不是函数
我究竟做错了什么?
根据这个页面,它应该是.css(选择器),而不是.cssSelector(选择器).