javascript - How do you get webdriverjs working? -
anyone here have experience using selenium , webdriverjs? i'm coming non-java background deal of experience node.js , javascript in general. according selenium docs, have set-up stand-alone selenium server use node web driver. fortunately, seem bundled together.
npm install webdriverjs
gets jar file standalone selenium server inside node_modules/webdriverjs/bin
directory. example tests inside node node_modules/webdriverjs/examples
directory tests in them fail when run them either webdriverjs or examples directories.
what's missing piece here? what's quickest way , running?
i have read docs.
note: stack overflow wouldn't let me use tag webdriverjs, webdriverjs, not using selenium java or other languages.
update: problem built-in example tests broken!
here's did webdriverjs working:
step 1: start selenium standalone in laptop running command java -jar selenium-server-standalone-2.33.0.jar
. listen http://localhost:4444/
, can access via http://localhost:4444/wd/hub/
. need make sure firefox browser installed on laptop.
step 2: create new directory , run command npm install webdriverjs
.
step 3: create new file named test_webdriverjs.js
in new directory created, , looks this:
var webdriverjs = require('webdriverjs'); var client = webdriverjs.remote({ host: 'localhost', port: 4444 }); client.init(); client.url('https://github.com/') .gettitle(function(err, title) { console.log (title)}).call(function () {}); client.end();
then run command node test_webdriverjs.js
under same directory , find works. if doesn't work, paste out console output.
Comments
Post a Comment