thin proxy for webdriver over websockets
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples ws-selenium usage example Nov 12, 2015
test tests for POSt with body + bug fix Nov 12, 2015
LICENSE add license Nov 12, 2015
README.md rename project to ws-webdriver Dec 1, 2015
config.json rename project to ws-webdriver Dec 1, 2015
index.js rename project to ws-webdriver Dec 1, 2015
package.json rename project to ws-webdriver Dec 1, 2015

README.md

ws-webdriver

A thin proxy that translates between websockets and HTTP requests. Though primarily intended to drive Webdriver tests (reasons will follow soon), it can be used to send requests to a HTTP server over the websocket protocol.

Why?

HTTP requests have significant overhead. Opening a connection, sending the headers and then finally your request body. This is pretty much repetitive and wasteful work if you are sending a large number of requests to the same server. Whereas a websocket provides a persistent connection to just send the messages across and recieve the results.

A good candidate for this was Webdriver tests. The webdriver protocol requires clients to send HTTP requests to automate the browser for every single task to the same host.

Usage

Modify the config.json to update the configurationa according to your needs. Then do:

node index.js

It will bring the HTTP server up. Now just point your Webdriver tests to this URL. A sample script can be found in examples directory.

PS: You would need a patched webdriver client library that speaks the websocket protocol. I have patched WebdriverIO client library in this fork.

Benchmark

Just to test how fast this is compared to the normal webdriver HTTP protocol, I created an ngrok tunnel to my local ports so that request go via the internet. Then I ran the WebdriverIO's desktop browser's test suite.

Here are the results:

Webdriver HTTP requests:         9 min 31.68 sec
Webdriver over websockets:       5 min 55.63 sec

The time save by using ws-webdriver is pretty much noticable.