webdriverjs vs selenium-wedriverjs (question) #138

dmitrym0 opened this Issue Jan 10, 2014 · 14 comments


None yet

7 participants


Hello everyone,

I apologize in advance if I'm asking stupid questions.

First, this project is in fact different from selenium-wedriver-js is that correct? The name threw me off for a little while :(

Secondly, how does webdriverio compare to selenium-webdriverjs? selenium-webdriverjs looks very java-y to me, on the other hand I can't quite fiigure out how webdriverio (yours) does async stuff.

I basically need help choosing one or the other. Thanks!


hi @dmitrym0

that is not a stupid question in fact often asked! I answer that a lot. Basically both have the same purpose. There is also a library called WD.js which is also a selenium runner for node. They all do quiet the same but have a different level of development and a different syntax.

I've never used one of the other libraries before so I can just tell you about this one. We're trying to provide a selenium runner which is easy to use, highly extendable and compatible with all common JavaScript test frameworks. It uses an own chain API to execute all async commands in right order. The specialty of this library is that we wrap all JSONWire protocol commands in useful actions commands. So you don't have to care about to get an element first and then call the click command; you just execute the click with a selector as parameter. Here is a simplified example:





Now in this library:


WebdriverIO has also almost all protocol commands implemented, so you can do the same with the standard JSONWire protocol commands.

    .element('#q', function(err,res) {
        client.elementIdValue(res.value.ELEMENT, 'webdriver');
    .element('#btnG', function(err,res) {

Each one has its own flavor, you need to decide which one fits most to you. I hope this clarifies it a bit. I'ld like to help you if you have any problems setting up your tests. But I thing it should be pretty easy and straight forward. You can find a list of example tests here.


vvo commented Jan 12, 2014

Very nice answert @christian-bromann I think this should be linked in the readme.md now.


@christian-bromann, thank you very much for explaining this to me. It helps very much.

If I can ask for some more of your time. I've written a script in selenium-webdriverjs that illustrates my current use case nicely.


  • opens up a wikipedia page
  • finds all of the text paragraphs on the page
  • clicks on the first and the 5th paragraph to select them

I would like to reproduce this in webdriverio, however I can't seem to figure out how to select text. Can you help me with that? Thanks!

Text of my current selenium-webdriverjs is below:

var assert = require('assert'),
test = require('selenium-webdriver/testing'),
webdriver = require('selenium-webdriver');

var driver = new webdriver.Builder().

test.describe('selection', function() {
    test.it('should be able to select two paragraphs', function() {
        console.log("Request URL");
        var startParagraph, endParagraph;
        driver.sleep(500).then(function() {
            console.log("Getting all paragraphs");
            var allPs = driver.findElements({tagName: 'p'}).then();

                console.log("Got paragraphs.");
                    startParagraph = startParagraphvalue
                    console.log("Resolved paragraph 1")

                    endParagraph = endParagraphvalue
                    console.log("Resolved paragrpah 2" + endParagraphvalue);
        }).then(function() {
            console.log("Trying to select stuff now");
            new webdriver.ActionSequence(driver).
                    console.log("Done selection?");


With WebdriverIO it is a bit shorter ;-)

var assert = require('assert'),
    client = require('webdriverjs').remote({desiredCapabilities:{browserName:'chrome'}});

    .elements('tag name','p',function(err,res) {
            // move to first paragraph to the upper left corner (0,0)
            .moveTo(res.value[0].ELEMENT, 0, 0)
            // press shift key
            // do left click
            // move to 5th paragraph to the lower right corner (1,1)
            // do left click
            // pause for 5000ms to be able to see selected text

First we query all elements with tag name p. The res.value object contains an array of elements. Then we just select a text using the shift key. I admit that this is not straightforward for new user because the protocol commands aren't really documented. webdriver.io is gonna to go live soon and will cover that.


I'm really starting to lean towards webdriver.io!!!!


@dmitrym0 do you have any further questions?

@wayneseymour great! sounds good


seems to be that there are no further questions. closing.


Thanks for all your help @christian-bromann !


curious you and adam wd.js both work at sauce. Plan to keep 2 webdriver node libs going?


I don't know where WD.js is going, I started working on webdriver.io long before I joined sauce and all my work I put in here has nothing in common with the stuff I do at sauce. I am doing this all in my free time and enjoy it to contribute to the open source world ;-)


thanks for the response and the project looks great!

abacaj commented Feb 11, 2016

@christian-bromann I know this is rather old and may have been resolved already but your example of using a pause is a really bad practice in the selenium world and leads to inconclusive results, i.e how do you know it takes 5 seconds and can you guarantee that it will always be 5 seconds?


A better approach is to retry with a timeout period, i.e we don't know how long it takes but we will keep retrying for 30 seconds and if we still don't have it then there is obviously an issue.

Is there something in place for this type of approach using webdriver IO?


Yeah, WebdriverIO has a bunch of waitFor* commands. Check out the API

arpit7j commented Feb 24, 2016

Hi Christian , I really need your help. I am very much confused in selecting automation testing stack.
Options 1) Webdriver.IO , Selenium standalone and Cucumber.io (A JavaScript Approached) AND
Option 2) WebdriverJS, Selenium JAR and Cucumber JAR (A Java Approached) .

We as a team really had spent a good amount of time and experienced - WebdriverIO is not mature enough as compare to Selenium , Cucumber and Webdriver (java approach) .

I saw your lot of help and comments in the internet and would really appreciate your comments here too.

@xhuang26 xhuang26 referenced this issue in Zodiase/map-visualizer May 19, 2016

Need CI-testing setup #1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment