javascript - Webdriverjs - By is not defined -
i using webdriverjs, open website , select element id. code is,
var webdriverjs = require('webdriverjs'), client = webdriverjs.remote({desiredcapabilities:{browsername:'phantomjs'}}).init(); client.url('www.google.com', function(err){ client.findelement(webdriverjs.by.id('lst-ib')).sendkeys('duck duck go\n') })
it throws error as,
webdriverjs.by undefined
how use by
function in webdriverjs
?
i think can still use webdriverjs, example code has mistake
https://code.google.com/p/selenium/wiki/webdriverjs
the code in example
driver.findelement(by.name("q")).sendkeys("webdriver");
driver.findelement(by.name("btng")).click();
should
driver.findelement(webdriver.by.name("q")).sendkeys("webdriver");
driver.findelement(webdriver.by.name("btng")).click();
i not sure why incorrect on website.
Comments
Post a Comment