2015-12-21 27 views
5

sto usando npm's Selenium Webdriver.TypeError: By.cssSelector non è una funzione

non riesco a far funzionare il By.cssSelector. Tutto il resto lo fa: By.tagName, By.id, ecc

Codice:

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) 

ottengo questo errore:

[email protected]:~/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

Che cosa sto facendo di sbagliato?

risposta

5

Secondo this page dovrebbe essere .css (selettore) anziché .cssSelector (selettore).

+0

http://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/index_exports_By.html –

Problemi correlati