node package manager
Easy collaboration. Discover, share, and reuse code in your team. Create a free org ยป



QProxy wraps JavaScript promises (Promises/A spec, e.x. Q) to allow you to chain arbitrary method calls before proxy is resolved.

For example, normally with the wd WebDriver library you would need to do the following:

browser.elementById("email").then(function(element) {

With QProxy you can do the following:


Once the result of elementById is resolved the type method will actually be called with the correct arguments. The whole expression returns a promise which is resolved after both the elementById and subsequent type invocations are resolved.

With a sequential helper library such as QStep you could do the following (CoffeeScript):

browser = QProxy(wd.promiseRemote("localhost", 4444))
  -> browser.init(browserName: "firefox")
  -> browser.get("")
  -> browser.elementById("email").type(
  -> browser.elementById("pass").type(credentials.password)
  -> browser.elementById("u_0_b").click()