Response:
isPresent: (selector) ->
    @driver.isElementPresent(Driver.By.css(@_selector(selector)))

  isVisible: (opts) ->
    @find(opts).then (elm) -> elm.isDisplayed()

  addClass: (opts) ->
    if _.isString(opts)
      opts = {className: opts}
    @find(opts.selector).then (el) =>
      @driver.executeScript("arguments[0].classList.add(arguments[1])", el, opts.className)

  removeClass: (opts) ->
    if _.isString(opts)
      opts = {className: opts}
    @find(opts.selector).then (el) =>
      @driver.executeScript("arguments[0].classList.remove(arguments[1])", el, opts.className)

  toggleClass: (opts) ->
    if _.isString(opts)
      opts = {className: opts}
    @find(opts.selector).then (el) =>
      @driver.executeScript("arguments[0].classList.toggle(arguments[1])", el, opts.className)

  findAll: (selector) ->
    @driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  _findByText: (opts) ->
    @find().then (el) ->
      el.findElement(
        # WebDriver lets you go out of the child scope
        # if you pass an absolute xpath selector
        # this is a bug in WebDriver and is terrible
        # by passing a `.` this is no longer an issue.
        Driver.By.xpath('.//*[normalize-space(text())=normalize-space("' + opts.text + '")]')
      )


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
isPresent: (selector) ->
    @driver.isElementPresent(Driver.By.css(@_selector(selector)))

  isVisible: (opts) ->
    @find(opts).then (elm) -> elm.isDisplayed()

  addClass: (opts) ->
    if _.isString(opts)
      opts = {className: opts}
    @find(opts.selector).then (el) =>
      @driver.executeScript("arguments[0].classList.add(arguments[1])", el, opts.className)

  removeClass: (opts) ->
    if _.isString(opts)
      opts = {className: opts}
    @find(opts.selector).then (el) =>
      @driver.executeScript("arguments[0].classList.remove(arguments[1])", el, opts.className)

  toggleClass: (opts) ->
    if _.isString(opts)
      opts = {className: opts}
    @find(opts.selector).then (el) =>
      @driver.executeScript("arguments[0].classList.toggle(arguments[1])", el, opts.className)

  findAll: (selector) ->
    @driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  _findByText: (opts) ->
    @find().then (el) ->
      el.findElement(
        # WebDriver lets you go out of the child scope
        # if you pass an absolute xpath selector
        # this is a bug in WebDriver and is terrible
        # by passing a `.` this is no longer an issue.
        Driver.By.xpath('.//*[normalize-space(text())=normalize-space("' + opts.text + '")]')
      )
```

Response:
({
  isPresent: function(selector) {
    return this.driver.isElementPresent(Driver.By.css(this._selector(selector)));
  },
  isVisible: function(opts) {
    return this.find(opts).then(function(elm) {
      return elm.isDisplayed();
    });
  },
  addClass: function(opts) {
    if (_.isString(opts)) {
      opts = {
        className: opts
      };
    }
    return this.find(opts.selector).then((el) => {
      return this.driver.executeScript("arguments[0].classList.add(arguments[1])", el, opts.className);
    });
  },
  removeClass: function(opts) {
    if (_.isString(opts)) {
      opts = {
        className: opts
      };
    }
    return this.find(opts.selector).then((el) => {
      return this.driver.executeScript("arguments[0].classList.remove(arguments[1])", el, opts.className);
    });
  },
  toggleClass: function(opts) {
    if (_.isString(opts)) {
      opts = {
        className: opts
      };
    }
    return this.find(opts.selector).then((el) => {
      return this.driver.executeScript("arguments[0].classList.toggle(arguments[1])", el, opts.className);
    });
  },
  findAll: function(selector) {
    return this.driver.findElements(Driver.By.css(this._selector(selector)));
  },
  _selector: function(selector) {
    return this.root + (selector ? ` ${selector}` : '');
  },
  _findByText: function(opts) {
    return this.find().then(function(el) {
      // WebDriver lets you go out of the child scope
      // if you pass an absolute xpath selector
      // this is a bug in WebDriver and is terrible
      // by passing a `.` this is no longer an issue.
      return el.findElement(Driver.By.xpath('.//*[normalize-space(text())=normalize-space("' + opts.text + '")]'));
    });
  }
});


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
({
  isPresent: function(selector) {
    return this.driver.isElementPresent(Driver.By.css(this._selector(selector)));
  },
  isVisible: function(opts) {
    return this.find(opts).then(function(elm) {
      return elm.isDisplayed();
    });
  },
  addClass: function(opts) {
    if (_.isString(opts)) {
      opts = {
        className: opts
      };
    }
    return this.find(opts.selector).then((el) => {
      return this.driver.executeScript("arguments[0].classList.add(arguments[1])", el, opts.className);
    });
  },
  removeClass: function(opts) {
    if (_.isString(opts)) {
      opts = {
        className: opts
      };
    }
    return this.find(opts.selector).then((el) => {
      return this.driver.executeScript("arguments[0].classList.remove(arguments[1])", el, opts.className);
    });
  },
  toggleClass: function(opts) {
    if (_.isString(opts)) {
      opts = {
        className: opts
      };
    }
    return this.find(opts.selector).then((el) => {
      return this.driver.executeScript("arguments[0].classList.toggle(arguments[1])", el, opts.className);
    });
  },
  findAll: function(selector) {
    return this.driver.findElements(Driver.By.css(this._selector(selector)));
  },
  _selector: function(selector) {
    return this.root + (selector ? ` ${selector}` : '');
  },
  _findByText: function(opts) {
    return this.find().then(function(el) {
      // WebDriver lets you go out of the child scope
      // if you pass an absolute xpath selector
      // this is a bug in WebDriver and is terrible
      // by passing a `.` this is no longer an issue.
      return el.findElement(Driver.By.xpath('.//*[normalize-space(text())=normalize-space("' + opts.text + '")]'));
    });
  }
});
```

Response:
isPresent: (selector) ->
    @driver.isElementPresent(Driver.By.css(@_selector(selector)))

  isVisible: (opts) ->
    @find(opts).then (elm) -> elm.isDisplayed()

  addClass: (opts) ->
    if _.isString(opts)
      opts = {className: opts}
    @find(opts.selector).then (el) =>
      @driver.executeScript("arguments[0].classList.add(arguments[1])", el, opts.className)

  removeClass: (opts) ->
    if _.isString(opts)
      opts = {className: opts}
    @find(opts.selector).then (el) =>
      @driver.executeScript("arguments[0].classList.remove(arguments[1])", el, opts.className)

  toggleClass: (opts) ->
    if _.isString(opts)
      opts = {className: opts}
    @find(opts.selector).then (el) =>
      @driver.executeScript("arguments[0].classList.toggle(arguments[1])", el, opts.className)

  findAll: (selector) ->
    @driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  _findByText: (opts) ->
    @find().then (el) ->
      el.findElement(
        # WebDriver lets you go out of the child scope
        # if you pass an absolute xpath selector
        # this is a bug in WebDriver and is terrible
        # by passing a `.` this is no longer an issue.
        Driver.By.xpath('.//*[normalize-space(text())=normalize-space("' + opts.text + '")]')
      )


Prompt:
isPresent: (selector) ->
    @driver.isElementPresent(Driver.By.css(@_selector(selector)))

  isVisible: (opts) ->
    @find(opts).then (elm) -> elm.isDisplayed()

  addClass: (opts) ->
    if _.isString(opts)
      opts = {className: opts}
    @find(opts.selector).then (el) =>
      @driver.executeScript("arguments[0].classList.add(arguments[1])", el, opts.className)

  removeClass: (opts) ->
    if _.isString(opts)
      opts = {className: opts}
    @find(opts.selector).then (el) =>
      @driver.executeScript("arguments[0].classList.remove(arguments[1])", el, opts.className)

  toggleClass: (opts) ->

Response:
if _.isString(opts)
      opts = {className: opts}
    @find(opts.selector).then (el) =>
      @driver.executeScript("arguments[0].classList.toggle(arguments[1])", el, opts.className)

  findAll: (selector) ->
    @driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  _findByText: (opts) ->
    @find().then (el) ->
      el.findElement(
        # WebDriver lets you go out of the child scope
        # if you pass an absolute xpath selector
        # this is a bug in WebDriver and is terrible
        # by passing a `.` this is no longer an issue.
        Driver.By.xpath('.//*[normalize-space(text())=normalize-space("' + opts.text + '")]')
      )


Response:
isPresent: (selector) ->
    @driver.isElementPresent(Driver.By.css(@_selector(selector)))

  isVisible: (opts) ->
    @find(opts).then (elm) -> elm.isDisplayed()

  addClass: (className) ->
    @find().then (el) =>
      @driver.executeScript("arguments[0].classList.add(arguments[1])", el, className)

  removeClass: (className) ->
    @find().then (el) =>
      @driver.executeScript("arguments[0].classList.remove(arguments[1])", el, className)

  toggleClass: (className) ->
    @find().then (el) =>
      @driver.executeScript("arguments[0].classList.toggle(arguments[1])", el, className)

  findAll: (selector) ->
    @driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  _findByText: (opts) ->
    @find().then (el) ->
      el.findElement(
        # WebDriver lets you go out of the child scope
        # if you pass an absolute xpath selector
        # this is a bug in WebDriver and is terrible
        # by passing a `.` this is no longer an issue.
        Driver.By.xpath('.//*[normalize-space(text())=normalize-space("' + opts.text + '")]')
      )

  _ensureElement: (selector) ->
    @driver.wait(
      _.bind(@isPresent, this, selector),
      10000,
      "#{@_selector(selector)} not found"
    )


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
isPresent: (selector) ->
    @driver.isElementPresent(Driver.By.css(@_selector(selector)))

  isVisible: (opts) ->
    @find(opts).then (elm) -> elm.isDisplayed()

  addClass: (className) ->
    @find().then (el) =>
      @driver.executeScript("arguments[0].classList.add(arguments[1])", el, className)

  removeClass: (className) ->
    @find().then (el) =>
      @driver.executeScript("arguments[0].classList.remove(arguments[1])", el, className)

  toggleClass: (className) ->
    @find().then (el) =>
      @driver.executeScript("arguments[0].classList.toggle(arguments[1])", el, className)

  findAll: (selector) ->
    @driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  _findByText: (opts) ->
    @find().then (el) ->
      el.findElement(
        # WebDriver lets you go out of the child scope
        # if you pass an absolute xpath selector
        # this is a bug in WebDriver and is terrible
        # by passing a `.` this is no longer an issue.
        Driver.By.xpath('.//*[normalize-space(text())=normalize-space("' + opts.text + '")]')
      )

  _ensureElement: (selector) ->
    @driver.wait(
      _.bind(@isPresent, this, selector),
      10000,
      "#{@_selector(selector)} not found"
    )
```

Response:
({
  isPresent: function(selector) {
    return this.driver.isElementPresent(Driver.By.css(this._selector(selector)));
  },
  isVisible: function(opts) {
    return this.find(opts).then(function(elm) {
      return elm.isDisplayed();
    });
  },
  addClass: function(className) {
    return this.find().then((el) => {
      return this.driver.executeScript("arguments[0].classList.add(arguments[1])", el, className);
    });
  },
  removeClass: function(className) {
    return this.find().then((el) => {
      return this.driver.executeScript("arguments[0].classList.remove(arguments[1])", el, className);
    });
  },
  toggleClass: function(className) {
    return this.find().then((el) => {
      return this.driver.executeScript("arguments[0].classList.toggle(arguments[1])", el, className);
    });
  },
  findAll: function(selector) {
    return this.driver.findElements(Driver.By.css(this._selector(selector)));
  },
  _selector: function(selector) {
    return this.root + (selector ? ` ${selector}` : '');
  },
  _findByText: function(opts) {
    return this.find().then(function(el) {
      // WebDriver lets you go out of the child scope
      // if you pass an absolute xpath selector
      // this is a bug in WebDriver and is terrible
      // by passing a `.` this is no longer an issue.
      return el.findElement(Driver.By.xpath('.//*[normalize-space(text())=normalize-space("' + opts.text + '")]'));
    });
  },
  _ensureElement: function(selector) {
    return this.driver.wait(_.bind(this.isPresent, this, selector), 10000, `${this._selector(selector)} not found`);
  }
});


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
({
  isPresent: function(selector) {
    return this.driver.isElementPresent(Driver.By.css(this._selector(selector)));
  },
  isVisible: function(opts) {
    return this.find(opts).then(function(elm) {
      return elm.isDisplayed();
    });
  },
  addClass: function(className) {
    return this.find().then((el) => {
      return this.driver.executeScript("arguments[0].classList.add(arguments[1])", el, className);
    });
  },
  removeClass: function(className) {
    return this.find().then((el) => {
      return this.driver.executeScript("arguments[0].classList.remove(arguments[1])", el, className);
    });
  },
  toggleClass: function(className) {
    return this.find().then((el) => {
      return this.driver.executeScript("arguments[0].classList.toggle(arguments[1])", el, className);
    });
  },
  findAll: function(selector) {
    return this.driver.findElements(Driver.By.css(this._selector(selector)));
  },
  _selector: function(selector) {
    return this.root + (selector ? ` ${selector}` : '');
  },
  _findByText: function(opts) {
    return this.find().then(function(el) {
      // WebDriver lets you go out of the child scope
      // if you pass an absolute xpath selector
      // this is a bug in WebDriver and is terrible
      // by passing a `.` this is no longer an issue.
      return el.findElement(Driver.By.xpath('.//*[normalize-space(text())=normalize-space("' + opts.text + '")]'));
    });
  },
  _ensureElement: function(selector) {
    return this.driver.wait(_.bind(this.isPresent, this, selector), 10000, `${this._selector(selector)} not found`);
  }
});
```

Response:
isPresent: (selector) ->
    @driver.isElementPresent(Driver.By.css(@_selector(selector)))

  isVisible: (opts) ->
    @find(opts).then (elm) -> elm.isDisplayed()

  addClass: (className) ->
    @find().then (el) =>
      @driver.executeScript("arguments[0].classList.add(arguments[1])", el, className)

  removeClass: (className) ->
    @find().then (el) =>
      @driver.executeScript("arguments[0].classList.remove(arguments[1])", el, className)

  toggleClass: (className) ->
    @find().then (el) =>
      @driver.executeScript("arguments[0].classList.toggle(arguments[1])", el, className)

  findAll: (selector) ->
    @driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  _findByText: (opts) ->
    @find().then (el) ->
      el.findElement(
        # WebDriver lets you go out of the child scope
        # if you pass an absolute xpath selector
        # this is a bug in WebDriver and is terrible
        # by passing a `.` this is no longer an issue.
        Driver.By.xpath('.//*[normalize-space(text())=normalize-space("' + opts.text + '")]')
      )

  _ensureElement: (selector) ->
    @driver.wait(
      _.bind(@isPresent, this, selector),
      10000,
      "#{@_selector(selector)} not found"
    )


Prompt:
isPresent: (selector) ->
    @driver.isElementPresent(Driver.By.css(@_selector(selector)))

  isVisible: (opts) ->
    @find(opts).then (elm) -> elm.isDisplayed()

  addClass: (className) ->
    @find().then (el) =>
      @driver.executeScript("arguments[0].classList.add(arguments[1])", el, className)

  removeClass: (className) ->
    @find().then (el) =>
      @driver.executeScript("arguments[0].classList.remove(arguments[1])", el, className)

  toggleClass: (className) ->
    @find().then (el) =>
      @driver.executeScript("arguments[0].classList.toggle(arguments[1])", el, className)

  findAll: (selector) ->
    @driver.findElements(Driver.By.css(@_selector(selector)))

Response:
_selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  _findByText: (opts) ->
    @find().then (el) ->
      el.findElement(
        # WebDriver lets you go out of the child scope
        # if you pass an absolute xpath selector
        # this is a bug in WebDriver and is terrible
        # by passing a `.` this is no longer an issue.
        Driver.By.xpath('.//*[normalize-space(text())=normalize-space("' + opts.text + '")]')
      )

  _ensureElement: (selector) ->
    @driver.wait(
      _.bind(@isPresent, this, selector),
      10000,
      "#{@_selector(selector)} not found"
    )


Response:
# Defines a noop initialize method intended to be
  # overridden by the user when extending a Widget base class
  initialize: ->

  world: World

  # use a getter to lazily initialize driver
  @getter 'driver', ->
    @_driver || World.driver

  click: (selector) ->
    @find(selector).then (el) ->
      el.click()

  fill: ->
    args = arguments
    if (args.length > 1)
      @find(args[0]).then (el) ->
        el.clear().then ->
          el.sendKeys(args[1])
    else
     @find().then (el) ->
      el.sendKeys(args[0])

  read: (selector, transformer) ->
    transformer ||= (value) -> value
    @find(selector).then (el) ->
      return el.getText().then transformer

  getValue: (selector, transformer) ->
    transformer ||= (value) -> value
    @find(selector).then (el) ->
      el.getAttribute('value').then (value) ->
        return transformer(value)

  find: (selector) ->
    deferred = new $.Deferred

    if (@el)
      if !selector
        deferred.fulfill(@el)
      else
        return @el.findElement(Driver.By.css(selector))


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
# Defines a noop initialize method intended to be
  # overridden by the user when extending a Widget base class
  initialize: ->

  world: World

  # use a getter to lazily initialize driver
  @getter 'driver', ->
    @_driver || World.driver

  click: (selector) ->
    @find(selector).then (el) ->
      el.click()

  fill: ->
    args = arguments
    if (args.length > 1)
      @find(args[0]).then (el) ->
        el.clear().then ->
          el.sendKeys(args[1])
    else
     @find().then (el) ->
      el.sendKeys(args[0])

  read: (selector, transformer) ->
    transformer ||= (value) -> value
    @find(selector).then (el) ->
      return el.getText().then transformer

  getValue: (selector, transformer) ->
    transformer ||= (value) -> value
    @find(selector).then (el) ->
      el.getAttribute('value').then (value) ->
        return transformer(value)

  find: (selector) ->
    deferred = new $.Deferred

    if (@el)
      if !selector
        deferred.fulfill(@el)
      else
        return @el.findElement(Driver.By.css(selector))
```

Response:
// Defines a noop initialize method intended to be
// overridden by the user when extending a Widget base class
({
  initialize: function() {},
  world: World
});

// use a getter to lazily initialize driver
this.getter('driver', function() {
  return this._driver || World.driver;
});

({
  click: function(selector) {
    return this.find(selector).then(function(el) {
      return el.click();
    });
  },
  fill: function() {
    var args;
    args = arguments;
    if (args.length > 1) {
      return this.find(args[0]).then(function(el) {
        return el.clear().then(function() {
          return el.sendKeys(args[1]);
        });
      });
    } else {
      return this.find().then(function(el) {
        return el.sendKeys(args[0]);
      });
    }
  },
  read: function(selector, transformer) {
    transformer || (transformer = function(value) {
      return value;
    });
    return this.find(selector).then(function(el) {
      return el.getText().then(transformer);
    });
  },
  getValue: function(selector, transformer) {
    transformer || (transformer = function(value) {
      return value;
    });
    return this.find(selector).then(function(el) {
      return el.getAttribute('value').then(function(value) {
        return transformer(value);
      });
    });
  },
  find: function(selector) {
    var deferred;
    deferred = new $.Deferred();
    if (this.el) {
      if (!selector) {
        return deferred.fulfill(this.el);
      } else {
        return this.el.findElement(Driver.By.css(selector));
      }
    }
  }
});


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
// Defines a noop initialize method intended to be
// overridden by the user when extending a Widget base class
({
  initialize: function() {},
  world: World
});

// use a getter to lazily initialize driver
this.getter('driver', function() {
  return this._driver || World.driver;
});

({
  click: function(selector) {
    return this.find(selector).then(function(el) {
      return el.click();
    });
  },
  fill: function() {
    var args;
    args = arguments;
    if (args.length > 1) {
      return this.find(args[0]).then(function(el) {
        return el.clear().then(function() {
          return el.sendKeys(args[1]);
        });
      });
    } else {
      return this.find().then(function(el) {
        return el.sendKeys(args[0]);
      });
    }
  },
  read: function(selector, transformer) {
    transformer || (transformer = function(value) {
      return value;
    });
    return this.find(selector).then(function(el) {
      return el.getText().then(transformer);
    });
  },
  getValue: function(selector, transformer) {
    transformer || (transformer = function(value) {
      return value;
    });
    return this.find(selector).then(function(el) {
      return el.getAttribute('value').then(function(value) {
        return transformer(value);
      });
    });
  },
  find: function(selector) {
    var deferred;
    deferred = new $.Deferred();
    if (this.el) {
      if (!selector) {
        return deferred.fulfill(this.el);
      } else {
        return this.el.findElement(Driver.By.css(selector));
      }
    }
  }
});
```

Response:
# Defines a noop initialize method intended to be
  # overridden by the user when extending a Widget base class
  initialize: ->

  world: World

  # use a getter to lazily initialize driver
  @getter 'driver', ->
    @_driver || World.driver

  click: (selector) ->
    @find(selector).then (el) ->
      el.click()

  fill: ->
    args = arguments
    if (args.length > 1)
      @find(args[0]).then (el) ->
        el.clear().then ->
          el.sendKeys(args[1])
    else
     @find().then (el) ->
      el.sendKeys(args[0])

  read: (selector, transformer) ->
    transformer ||= (value) -> value
    @find(selector).then (el) ->
      return el.getText().then transformer

  getValue: (selector, transformer) ->
    transformer ||= (value) -> value
    @find(selector).then (el) ->
      el.getAttribute('value').then (value) ->
        return transformer(value)

  find: (selector) ->
    deferred = new $.Deferred

    if (@el)
      if !selector
        deferred.fulfill(@el)
      else
        return @el.findElement(Driver.By.css(selector))


Prompt:
# Defines a noop initialize method intended to be
  # overridden by the user when extending a Widget base class
  initialize: ->

  world: World

  # use a getter to lazily initialize driver
  @getter 'driver', ->
    @_driver || World.driver

  click: (selector) ->
    @find(selector).then (el) ->
      el.click()

  fill: ->
    args = arguments
    if (args.length > 1)
      @find(args[0]).then (el) ->
        el.clear().then ->
          el.sendKeys(args[1])
    else

Response:
@find().then (el) ->
      el.sendKeys(args[0])

  read: (selector, transformer) ->
    transformer ||= (value) -> value
    @find(selector).then (el) ->
      return el.getText().then transformer

  getValue: (selector, transformer) ->
    transformer ||= (value) -> value
    @find(selector).then (el) ->
      el.getAttribute('value').then (value) ->
        return transformer(value)

  find: (selector) ->
    deferred = new $.Deferred

    if (@el)
      if !selector
        deferred.fulfill(@el)
      else
        return @el.findElement(Driver.By.css(selector))


Response:
return deferred

    @_ensureElement(selector)
    @driver.findElement(Driver.By.css(@_selector(selector)))

  getHtml: (selector) ->
     @find(selector).then (el) -> el.getOuterHtml()

  getText: (selector) ->
    @find(selector).then (el) -> el.getText()

  getAttribute: (attribute) ->
    @find().then (el) ->
      el.getAttribute(attribute)

  getInnerHTML: (selector) ->
    @find(selector).then (el) -> el.getInnerHtml()

  getOuterHTML: (selector) ->
    @find(selector).then (el) -> el.getOuterHtml()

  isPresent: (selector) ->
    @driver.isElementPresent(Driver.By.css(@_selector(selector)))

  isVisible: (selector) ->
    @find(selector).then (elm) ->
      elm.isDisplayed()

  addClass: (className) ->
    @find().then (el) =>
      @driver.executeScript("arguments[0].classList.add(arguments[1])", el, className)

  removeClass: (className) ->
    @find().then (el) =>
      @driver.executeScript("arguments[0].classList.remove(arguments[1])", el, className)

  toggleClass: (className) ->
    @find().then (el) =>
      @driver.executeScript("arguments[0].classList.toggle(arguments[1])", el, className)


Prompt:
return deferred

    @_ensureElement(selector)
    @driver.findElement(Driver.By.css(@_selector(selector)))

  getHtml: (selector) ->
     @find(selector).then (el) -> el.getOuterHtml()

  getText: (selector) ->
    @find(selector).then (el) -> el.getText()

  getAttribute: (attribute) ->
    @find().then (el) ->
      el.getAttribute(attribute)

  getInnerHTML: (selector) ->
    @find(selector).then (el) -> el.getInnerHtml()

  getOuterHTML: (selector) ->

Response:
@find(selector).then (el) -> el.getOuterHtml()

  isPresent: (selector) ->
    @driver.isElementPresent(Driver.By.css(@_selector(selector)))

  isVisible: (selector) ->
    @find(selector).then (elm) ->
      elm.isDisplayed()

  addClass: (className) ->
    @find().then (el) =>
      @driver.executeScript("arguments[0].classList.add(arguments[1])", el, className)

  removeClass: (className) ->
    @find().then (el) =>
      @driver.executeScript("arguments[0].classList.remove(arguments[1])", el, className)

  toggleClass: (className) ->
    @find().then (el) =>
      @driver.executeScript("arguments[0].classList.toggle(arguments[1])", el, className)


Response:
findAll: (selector) ->
    @driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  findByText: (text) ->
    @find().then (el) ->
      el.findElement(
        # WebDriver lets you go out of the child scope
        # if you pass an absolute xpath selector
        # this is a bug in WebDriver and is terrible
        # by passing a `.` this is no longer an issue.
        Driver.By.xpath('.//*[normalize-space(text())=normalize-space("' + text + '")]')
      )

  _ensureElement: (selector) ->
    @driver.wait(
      _.bind(@isPresent, this, selector),
      10000,
      "#{@_selector(selector)} not found"
    )

  _map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results

  sendKeys: ->
    args = arguments
    @find().then (el) =>
      el.sendKeys.apply(el, args)


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
findAll: (selector) ->
    @driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  findByText: (text) ->
    @find().then (el) ->
      el.findElement(
        # WebDriver lets you go out of the child scope
        # if you pass an absolute xpath selector
        # this is a bug in WebDriver and is terrible
        # by passing a `.` this is no longer an issue.
        Driver.By.xpath('.//*[normalize-space(text())=normalize-space("' + text + '")]')
      )

  _ensureElement: (selector) ->
    @driver.wait(
      _.bind(@isPresent, this, selector),
      10000,
      "#{@_selector(selector)} not found"
    )

  _map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results

  sendKeys: ->
    args = arguments
    @find().then (el) =>
      el.sendKeys.apply(el, args)
```

Response:
({
  findAll: function(selector) {
    return this.driver.findElements(Driver.By.css(this._selector(selector)));
  },
  _selector: function(selector) {
    return this.root + (selector ? ` ${selector}` : '');
  },
  findByText: function(text) {
    return this.find().then(function(el) {
      // WebDriver lets you go out of the child scope
      // if you pass an absolute xpath selector
      // this is a bug in WebDriver and is terrible
      // by passing a `.` this is no longer an issue.
      return el.findElement(Driver.By.xpath('.//*[normalize-space(text())=normalize-space("' + text + '")]'));
    });
  },
  _ensureElement: function(selector) {
    return this.driver.wait(_.bind(this.isPresent, this, selector), 10000, `${this._selector(selector)} not found`);
  },
  _map: function(collection, callback) {
    var _reduce, results;
    results = [];
    _reduce = function(p, f, i) {
      return p.then(function() {
        return callback(f, i).then(function(v) {
          return results.push(v);
        });
      });
    };
    return _.reduce(collection, _reduce, Driver.promise.fulfilled()).then(function() {
      return results;
    });
  },
  sendKeys: function() {
    var args;
    args = arguments;
    return this.find().then((el) => {
      return el.sendKeys.apply(el, args);
    });
  }
});


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
({
  findAll: function(selector) {
    return this.driver.findElements(Driver.By.css(this._selector(selector)));
  },
  _selector: function(selector) {
    return this.root + (selector ? ` ${selector}` : '');
  },
  findByText: function(text) {
    return this.find().then(function(el) {
      // WebDriver lets you go out of the child scope
      // if you pass an absolute xpath selector
      // this is a bug in WebDriver and is terrible
      // by passing a `.` this is no longer an issue.
      return el.findElement(Driver.By.xpath('.//*[normalize-space(text())=normalize-space("' + text + '")]'));
    });
  },
  _ensureElement: function(selector) {
    return this.driver.wait(_.bind(this.isPresent, this, selector), 10000, `${this._selector(selector)} not found`);
  },
  _map: function(collection, callback) {
    var _reduce, results;
    results = [];
    _reduce = function(p, f, i) {
      return p.then(function() {
        return callback(f, i).then(function(v) {
          return results.push(v);
        });
      });
    };
    return _.reduce(collection, _reduce, Driver.promise.fulfilled()).then(function() {
      return results;
    });
  },
  sendKeys: function() {
    var args;
    args = arguments;
    return this.find().then((el) => {
      return el.sendKeys.apply(el, args);
    });
  }
});
```

Response:
findAll: (selector) ->
    @driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  findByText: (text) ->
    @find().then (el) ->
      el.findElement(
        # WebDriver lets you go out of the child scope
        # if you pass an absolute xpath selector
        # this is a bug in WebDriver and is terrible
        # by passing a `.` this is no longer an issue.
        Driver.By.xpath('.//*[normalize-space(text())=normalize-space("' + text + '")]')
      )

  _ensureElement: (selector) ->
    @driver.wait(
      _.bind(@isPresent, this, selector),
      10000,
      "#{@_selector(selector)} not found"
    )

  _map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results

  sendKeys: ->
    args = arguments
    @find().then (el) =>
      el.sendKeys.apply(el, args)


Prompt:
findAll: (selector) ->
    @driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  findByText: (text) ->
    @find().then (el) ->
      el.findElement(
        # WebDriver lets you go out of the child scope
        # if you pass an absolute xpath selector
        # this is a bug in WebDriver and is terrible
        # by passing a `.` this is no longer an issue.
        Driver.By.xpath('.//*[normalize-space(text())=normalize-space("' + text + '")]')
      )

  _ensureElement: (selector) ->

Response:
@driver.wait(
      _.bind(@isPresent, this, selector),
      10000,
      "#{@_selector(selector)} not found"
    )

  _map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results

  sendKeys: ->
    args = arguments
    @find().then (el) =>
      el.sendKeys.apply(el, args)


Response:
class @Widget
  @extend: (protoProps, staticProps) ->
    parent = @
    if Object.hasOwnProperty(protoProps, 'constructor')
      child = protoProps.constructor
    else
      child = -> parent.apply(@, arguments)

    child.copyProperties @
    child.copyProperties staticProps

    Surrogate = ->
      @constructor = child
      return undefined

    Surrogate.prototype = @::
    child.prototype = new Surrogate()

    child::.copyProperties(protoProps) if protoProps

    child.__super__ = @::

    child

  @find = (attributes) ->
    _this = _.extend(new this, attributes)

    _this.find().then (el) ->
      _this.el = el
      _this

  constructor: (attributes = {}) ->
    _.extend @, attributes

    @initialize.apply @, arguments

  # Defines a noop initialize method intended to be
  # overridden by the user when extending a Widget base class
  initialize: ->

  world: World

  # use a getter to lazily initialize driver
  @getter 'driver', ->
    @_driver || World.driver

  click: (selector) ->
    @find(selector).then (el) ->
      el.click()


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
class @Widget
  @extend: (protoProps, staticProps) ->
    parent = @
    if Object.hasOwnProperty(protoProps, 'constructor')
      child = protoProps.constructor
    else
      child = -> parent.apply(@, arguments)

    child.copyProperties @
    child.copyProperties staticProps

    Surrogate = ->
      @constructor = child
      return undefined

    Surrogate.prototype = @::
    child.prototype = new Surrogate()

    child::.copyProperties(protoProps) if protoProps

    child.__super__ = @::

    child

  @find = (attributes) ->
    _this = _.extend(new this, attributes)

    _this.find().then (el) ->
      _this.el = el
      _this

  constructor: (attributes = {}) ->
    _.extend @, attributes

    @initialize.apply @, arguments

  # Defines a noop initialize method intended to be
  # overridden by the user when extending a Widget base class
  initialize: ->

  world: World

  # use a getter to lazily initialize driver
  @getter 'driver', ->
    @_driver || World.driver

  click: (selector) ->
    @find(selector).then (el) ->
      el.click()
```

Response:
this.Widget = (function() {
  class Widget {
    static extend(protoProps, staticProps) {
      var Surrogate, child, parent;
      parent = this;
      if (Object.hasOwnProperty(protoProps, 'constructor')) {
        child = protoProps.constructor;
      } else {
        child = function() {
          return parent.apply(this, arguments);
        };
      }
      child.copyProperties(this);
      child.copyProperties(staticProps);
      Surrogate = function() {
        this.constructor = child;
        return void 0;
      };
      Surrogate.prototype = this.prototype;
      child.prototype = new Surrogate();
      if (protoProps) {
        child.prototype.copyProperties(protoProps);
      }
      child.__super__ = this.prototype;
      return child;
    }

    static find(attributes) {
      var _this;
      _this = _.extend(new (this)(), attributes);
      return _this.find().then(function(el) {
        _this.el = el;
        return _this;
      });
    }

    constructor(attributes = {}) {
      _.extend(this, attributes);
      this.initialize.apply(this, arguments);
    }

    // Defines a noop initialize method intended to be
    // overridden by the user when extending a Widget base class
    initialize() {}

    click(selector) {
      return this.find(selector).then(function(el) {
        return el.click();
      });
    }

  };

  Widget.prototype.world = World;

  // use a getter to lazily initialize driver
  Widget.getter('driver', function() {
    return this._driver || World.driver;
  });

  return Widget;

}).call(this);


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
this.Widget = (function() {
  class Widget {
    static extend(protoProps, staticProps) {
      var Surrogate, child, parent;
      parent = this;
      if (Object.hasOwnProperty(protoProps, 'constructor')) {
        child = protoProps.constructor;
      } else {
        child = function() {
          return parent.apply(this, arguments);
        };
      }
      child.copyProperties(this);
      child.copyProperties(staticProps);
      Surrogate = function() {
        this.constructor = child;
        return void 0;
      };
      Surrogate.prototype = this.prototype;
      child.prototype = new Surrogate();
      if (protoProps) {
        child.prototype.copyProperties(protoProps);
      }
      child.__super__ = this.prototype;
      return child;
    }

    static find(attributes) {
      var _this;
      _this = _.extend(new (this)(), attributes);
      return _this.find().then(function(el) {
        _this.el = el;
        return _this;
      });
    }

    constructor(attributes = {}) {
      _.extend(this, attributes);
      this.initialize.apply(this, arguments);
    }

    // Defines a noop initialize method intended to be
    // overridden by the user when extending a Widget base class
    initialize() {}

    click(selector) {
      return this.find(selector).then(function(el) {
        return el.click();
      });
    }

  };

  Widget.prototype.world = World;

  // use a getter to lazily initialize driver
  Widget.getter('driver', function() {
    return this._driver || World.driver;
  });

  return Widget;

}).call(this);
```

Response:
class @Widget
  @extend: (protoProps, staticProps) ->
    parent = @
    if Object.hasOwnProperty(protoProps, 'constructor')
      child = protoProps.constructor
    else
      child = -> parent.apply(@, arguments)

    child.copyProperties @
    child.copyProperties staticProps

    Surrogate = ->
      @constructor = child
      return undefined

    Surrogate.prototype = @::
    child.prototype = new Surrogate()

    child::.copyProperties(protoProps) if protoProps

    child.__super__ = @::

    child

  @find = (attributes) ->
    _this = _.extend(new this, attributes)

    _this.find().then (el) ->
      _this.el = el
      _this

  constructor: (attributes = {}) ->
    _.extend @, attributes

    @initialize.apply @, arguments

  # Defines a noop initialize method intended to be
  # overridden by the user when extending a Widget base class
  initialize: ->

  world: World

  # use a getter to lazily initialize driver
  @getter 'driver', ->
    @_driver || World.driver

  click: (selector) ->
    @find(selector).then (el) ->
      el.click()


Prompt:
class @Widget
  @extend: (protoProps, staticProps) ->
    parent = @
    if Object.hasOwnProperty(protoProps, 'constructor')
      child = protoProps.constructor
    else
      child = -> parent.apply(@, arguments)

    child.copyProperties @
    child.copyProperties staticProps

    Surrogate = ->
      @constructor = child
      return undefined

    Surrogate.prototype = @::
    child.prototype = new Surrogate()

    child::.copyProperties(protoProps) if protoProps

    child.__super__ = @::

    child

Response:
@find = (attributes) ->
    _this = _.extend(new this, attributes)

    _this.find().then (el) ->
      _this.el = el
      _this

  constructor: (attributes = {}) ->
    _.extend @, attributes

    @initialize.apply @, arguments

  # Defines a noop initialize method intended to be
  # overridden by the user when extending a Widget base class
  initialize: ->

  world: World

  # use a getter to lazily initialize driver
  @getter 'driver', ->
    @_driver || World.driver

  click: (selector) ->
    @find(selector).then (el) ->
      el.click()


Response:
fill: ->
    args = arguments
    if (args.length > 1)
      @find(args[0]).then (el) ->
        el.clear().then ->
          el.sendKeys(args[1])
    else
     @find().then (el) ->
      el.sendKeys(args[0])

  read: (selector, transformer) ->
    transformer ||= (value) -> value
    @find(selector).then (el) ->
      return el.getText().then transformer

  getValue: (selector, transformer) ->
    transformer ||= (value) -> value
    @find(selector).then (el) ->
      el.getAttribute('value').then (value) ->
        return transformer(value)

  find: (selector) ->
    deferred = new $.Deferred

    if (@el)
      if !selector
        deferred.fulfill(@el)
      else
        return @el.findElement(Driver.By.css(selector))

      return deferred

    @_ensureElement(selector)
    @driver.findElement(Driver.By.css(@_selector(selector)))

  getHtml: (selector) ->
     @find(selector).then (el) -> el.getOuterHtml()

  getText: (selector) ->
    @find(selector).then (el) -> el.getText()

  getAttribute: (attribute) ->
    @find().then (el) ->
      el.getAttribute(attribute)

  getInnerHTML: (selector) ->
    @find(selector).then (el) -> el.getInnerHtml()

  getOuterHTML: (selector) ->
    @find(selector).then (el) -> el.getOuterHtml()


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
fill: ->
    args = arguments
    if (args.length > 1)
      @find(args[0]).then (el) ->
        el.clear().then ->
          el.sendKeys(args[1])
    else
     @find().then (el) ->
      el.sendKeys(args[0])

  read: (selector, transformer) ->
    transformer ||= (value) -> value
    @find(selector).then (el) ->
      return el.getText().then transformer

  getValue: (selector, transformer) ->
    transformer ||= (value) -> value
    @find(selector).then (el) ->
      el.getAttribute('value').then (value) ->
        return transformer(value)

  find: (selector) ->
    deferred = new $.Deferred

    if (@el)
      if !selector
        deferred.fulfill(@el)
      else
        return @el.findElement(Driver.By.css(selector))

      return deferred

    @_ensureElement(selector)
    @driver.findElement(Driver.By.css(@_selector(selector)))

  getHtml: (selector) ->
     @find(selector).then (el) -> el.getOuterHtml()

  getText: (selector) ->
    @find(selector).then (el) -> el.getText()

  getAttribute: (attribute) ->
    @find().then (el) ->
      el.getAttribute(attribute)

  getInnerHTML: (selector) ->
    @find(selector).then (el) -> el.getInnerHtml()

  getOuterHTML: (selector) ->
    @find(selector).then (el) -> el.getOuterHtml()
```

Response:
({
  fill: function() {
    var args;
    args = arguments;
    if (args.length > 1) {
      return this.find(args[0]).then(function(el) {
        return el.clear().then(function() {
          return el.sendKeys(args[1]);
        });
      });
    } else {
      return this.find().then(function(el) {
        return el.sendKeys(args[0]);
      });
    }
  },
  read: function(selector, transformer) {
    transformer || (transformer = function(value) {
      return value;
    });
    return this.find(selector).then(function(el) {
      return el.getText().then(transformer);
    });
  },
  getValue: function(selector, transformer) {
    transformer || (transformer = function(value) {
      return value;
    });
    return this.find(selector).then(function(el) {
      return el.getAttribute('value').then(function(value) {
        return transformer(value);
      });
    });
  },
  find: function(selector) {
    var deferred;
    deferred = new $.Deferred();
    if (this.el) {
      if (!selector) {
        deferred.fulfill(this.el);
      } else {
        return this.el.findElement(Driver.By.css(selector));
      }
      return deferred;
    }
    this._ensureElement(selector);
    return this.driver.findElement(Driver.By.css(this._selector(selector)));
  },
  getHtml: function(selector) {
    return this.find(selector).then(function(el) {
      return el.getOuterHtml();
    });
  },
  getText: function(selector) {
    return this.find(selector).then(function(el) {
      return el.getText();
    });
  },
  getAttribute: function(attribute) {
    return this.find().then(function(el) {
      return el.getAttribute(attribute);
    });
  },
  getInnerHTML: function(selector) {
    return this.find(selector).then(function(el) {
      return el.getInnerHtml();
    });
  },
  getOuterHTML: function(selector) {
    return this.find(selector).then(function(el) {
      return el.getOuterHtml();
    });
  }
});


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
({
  fill: function() {
    var args;
    args = arguments;
    if (args.length > 1) {
      return this.find(args[0]).then(function(el) {
        return el.clear().then(function() {
          return el.sendKeys(args[1]);
        });
      });
    } else {
      return this.find().then(function(el) {
        return el.sendKeys(args[0]);
      });
    }
  },
  read: function(selector, transformer) {
    transformer || (transformer = function(value) {
      return value;
    });
    return this.find(selector).then(function(el) {
      return el.getText().then(transformer);
    });
  },
  getValue: function(selector, transformer) {
    transformer || (transformer = function(value) {
      return value;
    });
    return this.find(selector).then(function(el) {
      return el.getAttribute('value').then(function(value) {
        return transformer(value);
      });
    });
  },
  find: function(selector) {
    var deferred;
    deferred = new $.Deferred();
    if (this.el) {
      if (!selector) {
        deferred.fulfill(this.el);
      } else {
        return this.el.findElement(Driver.By.css(selector));
      }
      return deferred;
    }
    this._ensureElement(selector);
    return this.driver.findElement(Driver.By.css(this._selector(selector)));
  },
  getHtml: function(selector) {
    return this.find(selector).then(function(el) {
      return el.getOuterHtml();
    });
  },
  getText: function(selector) {
    return this.find(selector).then(function(el) {
      return el.getText();
    });
  },
  getAttribute: function(attribute) {
    return this.find().then(function(el) {
      return el.getAttribute(attribute);
    });
  },
  getInnerHTML: function(selector) {
    return this.find(selector).then(function(el) {
      return el.getInnerHtml();
    });
  },
  getOuterHTML: function(selector) {
    return this.find(selector).then(function(el) {
      return el.getOuterHtml();
    });
  }
});
```

Response:
fill: ->
    args = arguments
    if (args.length > 1)
      @find(args[0]).then (el) ->
        el.clear().then ->
          el.sendKeys(args[1])
    else
     @find().then (el) ->
      el.sendKeys(args[0])

  read: (selector, transformer) ->
    transformer ||= (value) -> value
    @find(selector).then (el) ->
      return el.getText().then transformer

  getValue: (selector, transformer) ->
    transformer ||= (value) -> value
    @find(selector).then (el) ->
      el.getAttribute('value').then (value) ->
        return transformer(value)

  find: (selector) ->
    deferred = new $.Deferred

    if (@el)
      if !selector
        deferred.fulfill(@el)
      else
        return @el.findElement(Driver.By.css(selector))

      return deferred

    @_ensureElement(selector)
    @driver.findElement(Driver.By.css(@_selector(selector)))

  getHtml: (selector) ->
     @find(selector).then (el) -> el.getOuterHtml()

  getText: (selector) ->
    @find(selector).then (el) -> el.getText()

  getAttribute: (attribute) ->
    @find().then (el) ->
      el.getAttribute(attribute)

  getInnerHTML: (selector) ->
    @find(selector).then (el) -> el.getInnerHtml()

  getOuterHTML: (selector) ->
    @find(selector).then (el) -> el.getOuterHtml()


Prompt:
fill: ->
    args = arguments
    if (args.length > 1)
      @find(args[0]).then (el) ->
        el.clear().then ->
          el.sendKeys(args[1])
    else
     @find().then (el) ->
      el.sendKeys(args[0])

  read: (selector, transformer) ->
    transformer ||= (value) -> value
    @find(selector).then (el) ->
      return el.getText().then transformer

  getValue: (selector, transformer) ->
    transformer ||= (value) -> value
    @find(selector).then (el) ->
      el.getAttribute('value').then (value) ->
        return transformer(value)

  find: (selector) ->
    deferred = new $.Deferred

    if (@el)

Response:
if !selector
        deferred.fulfill(@el)
      else
        return @el.findElement(Driver.By.css(selector))

      return deferred

    @_ensureElement(selector)
    @driver.findElement(Driver.By.css(@_selector(selector)))

  getHtml: (selector) ->
     @find(selector).then (el) -> el.getOuterHtml()

  getText: (selector) ->
    @find(selector).then (el) -> el.getText()

  getAttribute: (attribute) ->
    @find().then (el) ->
      el.getAttribute(attribute)

  getInnerHTML: (selector) ->
    @find(selector).then (el) -> el.getInnerHtml()

  getOuterHTML: (selector) ->
    @find(selector).then (el) -> el.getOuterHtml()


Response:
isPresent: (selector) ->
    @driver.isElementPresent(Driver.By.css(@_selector(selector)))

  isVisible: (selector) ->
    @find(selector).then (elm) ->
      elm.isDisplayed()

  addClass: (className) ->
    @find().then (el) =>
      @driver.executeScript("arguments[0].classList.add(arguments[1])", el, className)

  removeClass: (className) ->
    @find().then (el) =>
      @driver.executeScript("arguments[0].classList.remove(arguments[1])", el, className)

  toggleClass: (className) ->
    @find().then (el) =>
      @driver.executeScript("arguments[0].classList.toggle(arguments[1])", el, className)

  findAll: (selector) ->
    @driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  findByText: (text) ->
    @find().then (el) ->
      el.findElement(
        # WebDriver lets you go out of the child scope
        # if you pass an absolute xpath selector
        # this is a bug in WebDriver and is terrible
        # by passing a `.` this is no longer an issue.
        Driver.By.xpath('.//*[normalize-space(text())=normalize-space("' + text + '")]')
      )

  _ensureElement: (selector) ->
    @driver.wait(
      _.bind(@isPresent, this, selector),
      10000,
      "#{@_selector(selector)} not found"
    )

  _map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
isPresent: (selector) ->
    @driver.isElementPresent(Driver.By.css(@_selector(selector)))

  isVisible: (selector) ->
    @find(selector).then (elm) ->
      elm.isDisplayed()

  addClass: (className) ->
    @find().then (el) =>
      @driver.executeScript("arguments[0].classList.add(arguments[1])", el, className)

  removeClass: (className) ->
    @find().then (el) =>
      @driver.executeScript("arguments[0].classList.remove(arguments[1])", el, className)

  toggleClass: (className) ->
    @find().then (el) =>
      @driver.executeScript("arguments[0].classList.toggle(arguments[1])", el, className)

  findAll: (selector) ->
    @driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  findByText: (text) ->
    @find().then (el) ->
      el.findElement(
        # WebDriver lets you go out of the child scope
        # if you pass an absolute xpath selector
        # this is a bug in WebDriver and is terrible
        # by passing a `.` this is no longer an issue.
        Driver.By.xpath('.//*[normalize-space(text())=normalize-space("' + text + '")]')
      )

  _ensureElement: (selector) ->
    @driver.wait(
      _.bind(@isPresent, this, selector),
      10000,
      "#{@_selector(selector)} not found"
    )

  _map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results
```

Response:
({
  isPresent: function(selector) {
    return this.driver.isElementPresent(Driver.By.css(this._selector(selector)));
  },
  isVisible: function(selector) {
    return this.find(selector).then(function(elm) {
      return elm.isDisplayed();
    });
  },
  addClass: function(className) {
    return this.find().then((el) => {
      return this.driver.executeScript("arguments[0].classList.add(arguments[1])", el, className);
    });
  },
  removeClass: function(className) {
    return this.find().then((el) => {
      return this.driver.executeScript("arguments[0].classList.remove(arguments[1])", el, className);
    });
  },
  toggleClass: function(className) {
    return this.find().then((el) => {
      return this.driver.executeScript("arguments[0].classList.toggle(arguments[1])", el, className);
    });
  },
  findAll: function(selector) {
    return this.driver.findElements(Driver.By.css(this._selector(selector)));
  },
  _selector: function(selector) {
    return this.root + (selector ? ` ${selector}` : '');
  },
  findByText: function(text) {
    return this.find().then(function(el) {
      // WebDriver lets you go out of the child scope
      // if you pass an absolute xpath selector
      // this is a bug in WebDriver and is terrible
      // by passing a `.` this is no longer an issue.
      return el.findElement(Driver.By.xpath('.//*[normalize-space(text())=normalize-space("' + text + '")]'));
    });
  },
  _ensureElement: function(selector) {
    return this.driver.wait(_.bind(this.isPresent, this, selector), 10000, `${this._selector(selector)} not found`);
  },
  _map: function(collection, callback) {
    var _reduce, results;
    results = [];
    _reduce = function(p, f, i) {
      return p.then(function() {
        return callback(f, i).then(function(v) {
          return results.push(v);
        });
      });
    };
    return _.reduce(collection, _reduce, Driver.promise.fulfilled()).then(function() {
      return results;
    });
  }
});


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
({
  isPresent: function(selector) {
    return this.driver.isElementPresent(Driver.By.css(this._selector(selector)));
  },
  isVisible: function(selector) {
    return this.find(selector).then(function(elm) {
      return elm.isDisplayed();
    });
  },
  addClass: function(className) {
    return this.find().then((el) => {
      return this.driver.executeScript("arguments[0].classList.add(arguments[1])", el, className);
    });
  },
  removeClass: function(className) {
    return this.find().then((el) => {
      return this.driver.executeScript("arguments[0].classList.remove(arguments[1])", el, className);
    });
  },
  toggleClass: function(className) {
    return this.find().then((el) => {
      return this.driver.executeScript("arguments[0].classList.toggle(arguments[1])", el, className);
    });
  },
  findAll: function(selector) {
    return this.driver.findElements(Driver.By.css(this._selector(selector)));
  },
  _selector: function(selector) {
    return this.root + (selector ? ` ${selector}` : '');
  },
  findByText: function(text) {
    return this.find().then(function(el) {
      // WebDriver lets you go out of the child scope
      // if you pass an absolute xpath selector
      // this is a bug in WebDriver and is terrible
      // by passing a `.` this is no longer an issue.
      return el.findElement(Driver.By.xpath('.//*[normalize-space(text())=normalize-space("' + text + '")]'));
    });
  },
  _ensureElement: function(selector) {
    return this.driver.wait(_.bind(this.isPresent, this, selector), 10000, `${this._selector(selector)} not found`);
  },
  _map: function(collection, callback) {
    var _reduce, results;
    results = [];
    _reduce = function(p, f, i) {
      return p.then(function() {
        return callback(f, i).then(function(v) {
          return results.push(v);
        });
      });
    };
    return _.reduce(collection, _reduce, Driver.promise.fulfilled()).then(function() {
      return results;
    });
  }
});
```

Response:
isPresent: (selector) ->
    @driver.isElementPresent(Driver.By.css(@_selector(selector)))

  isVisible: (selector) ->
    @find(selector).then (elm) ->
      elm.isDisplayed()

  addClass: (className) ->
    @find().then (el) =>
      @driver.executeScript("arguments[0].classList.add(arguments[1])", el, className)

  removeClass: (className) ->
    @find().then (el) =>
      @driver.executeScript("arguments[0].classList.remove(arguments[1])", el, className)

  toggleClass: (className) ->
    @find().then (el) =>
      @driver.executeScript("arguments[0].classList.toggle(arguments[1])", el, className)

  findAll: (selector) ->
    @driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  findByText: (text) ->
    @find().then (el) ->
      el.findElement(
        # WebDriver lets you go out of the child scope
        # if you pass an absolute xpath selector
        # this is a bug in WebDriver and is terrible
        # by passing a `.` this is no longer an issue.
        Driver.By.xpath('.//*[normalize-space(text())=normalize-space("' + text + '")]')
      )

  _ensureElement: (selector) ->
    @driver.wait(
      _.bind(@isPresent, this, selector),
      10000,
      "#{@_selector(selector)} not found"
    )

  _map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results


Prompt:
isPresent: (selector) ->
    @driver.isElementPresent(Driver.By.css(@_selector(selector)))

  isVisible: (selector) ->
    @find(selector).then (elm) ->
      elm.isDisplayed()

  addClass: (className) ->
    @find().then (el) =>
      @driver.executeScript("arguments[0].classList.add(arguments[1])", el, className)

  removeClass: (className) ->
    @find().then (el) =>
      @driver.executeScript("arguments[0].classList.remove(arguments[1])", el, className)

  toggleClass: (className) ->
    @find().then (el) =>
      @driver.executeScript("arguments[0].classList.toggle(arguments[1])", el, className)

  findAll: (selector) ->
    @driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

Response:
findByText: (text) ->
    @find().then (el) ->
      el.findElement(
        # WebDriver lets you go out of the child scope
        # if you pass an absolute xpath selector
        # this is a bug in WebDriver and is terrible
        # by passing a `.` this is no longer an issue.
        Driver.By.xpath('.//*[normalize-space(text())=normalize-space("' + text + '")]')
      )

  _ensureElement: (selector) ->
    @driver.wait(
      _.bind(@isPresent, this, selector),
      10000,
      "#{@_selector(selector)} not found"
    )

  _map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results


Response:
sendKeys: ->
    args = arguments
    @find().then (el) =>
      el.sendKeys.apply(el, args)


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
sendKeys: ->
    args = arguments
    @find().then (el) =>
      el.sendKeys.apply(el, args)
```

Response:
({
  sendKeys: function() {
    var args;
    args = arguments;
    return this.find().then((el) => {
      return el.sendKeys.apply(el, args);
    });
  }
});


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
({
  sendKeys: function() {
    var args;
    args = arguments;
    return this.find().then((el) => {
      return el.sendKeys.apply(el, args);
    });
  }
});
```

Response:
sendKeys: ->
    args = arguments
    @find().then (el) =>
      el.sendKeys.apply(el, args)


Prompt:
sendKeys: ->
    args = arguments

Response:
@find().then (el) =>
      el.sendKeys.apply(el, args)


Response:
fill: ->
    args = arguments
    if (args.length > 1)
      @find(args[0]).then (el) ->
        el.clear().then ->
          el.sendKeys(args[1])
    else
     @find().then (el) ->
      el.sendKeys(args[0])

  read: (selector, transformer) ->
    transformer ||= (value) -> value
    selected = @find(selector)
    selected.getAttribute('value').then (value) ->
      if value
        return transformer(value)
      else
        return selected.getText().then transformer

  find: (selector) ->
    deferred = new $.Deferred

    if (@el)
      if !selector
        deferred.fulfill(@el)
      else
        return @el.findElement(Driver.By.css(selector))

      return deferred

    @_ensureElement(selector)
    @driver.findElement(Driver.By.css(@_selector(selector)))

  getHtml: (selector) ->
     @find(selector).then (el) -> el.getOuterHtml()

  getText: (selector) ->
    @find(selector).then (el) -> el.getText()

  getAttribute: (attribute) ->
    @find().then (el) ->
      el.getAttribute(attribute)

  getInnerHTML: (selector) ->
    @find(selector).then (el) -> el.getInnerHtml()

  getOuterHTML: (selector) ->
    @find(selector).then (el) -> el.getOuterHtml()

  isPresent: (selector) ->


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
fill: ->
    args = arguments
    if (args.length > 1)
      @find(args[0]).then (el) ->
        el.clear().then ->
          el.sendKeys(args[1])
    else
     @find().then (el) ->
      el.sendKeys(args[0])

  read: (selector, transformer) ->
    transformer ||= (value) -> value
    selected = @find(selector)
    selected.getAttribute('value').then (value) ->
      if value
        return transformer(value)
      else
        return selected.getText().then transformer

  find: (selector) ->
    deferred = new $.Deferred

    if (@el)
      if !selector
        deferred.fulfill(@el)
      else
        return @el.findElement(Driver.By.css(selector))

      return deferred

    @_ensureElement(selector)
    @driver.findElement(Driver.By.css(@_selector(selector)))

  getHtml: (selector) ->
     @find(selector).then (el) -> el.getOuterHtml()

  getText: (selector) ->
    @find(selector).then (el) -> el.getText()

  getAttribute: (attribute) ->
    @find().then (el) ->
      el.getAttribute(attribute)

  getInnerHTML: (selector) ->
    @find(selector).then (el) -> el.getInnerHtml()

  getOuterHTML: (selector) ->
    @find(selector).then (el) -> el.getOuterHtml()

  isPresent: (selector) ->
```

Response:
({
  fill: function() {
    var args;
    args = arguments;
    if (args.length > 1) {
      return this.find(args[0]).then(function(el) {
        return el.clear().then(function() {
          return el.sendKeys(args[1]);
        });
      });
    } else {
      return this.find().then(function(el) {
        return el.sendKeys(args[0]);
      });
    }
  },
  read: function(selector, transformer) {
    var selected;
    transformer || (transformer = function(value) {
      return value;
    });
    selected = this.find(selector);
    return selected.getAttribute('value').then(function(value) {
      if (value) {
        return transformer(value);
      } else {
        return selected.getText().then(transformer);
      }
    });
  },
  find: function(selector) {
    var deferred;
    deferred = new $.Deferred();
    if (this.el) {
      if (!selector) {
        deferred.fulfill(this.el);
      } else {
        return this.el.findElement(Driver.By.css(selector));
      }
      return deferred;
    }
    this._ensureElement(selector);
    return this.driver.findElement(Driver.By.css(this._selector(selector)));
  },
  getHtml: function(selector) {
    return this.find(selector).then(function(el) {
      return el.getOuterHtml();
    });
  },
  getText: function(selector) {
    return this.find(selector).then(function(el) {
      return el.getText();
    });
  },
  getAttribute: function(attribute) {
    return this.find().then(function(el) {
      return el.getAttribute(attribute);
    });
  },
  getInnerHTML: function(selector) {
    return this.find(selector).then(function(el) {
      return el.getInnerHtml();
    });
  },
  getOuterHTML: function(selector) {
    return this.find(selector).then(function(el) {
      return el.getOuterHtml();
    });
  },
  isPresent: function(selector) {}
});


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
({
  fill: function() {
    var args;
    args = arguments;
    if (args.length > 1) {
      return this.find(args[0]).then(function(el) {
        return el.clear().then(function() {
          return el.sendKeys(args[1]);
        });
      });
    } else {
      return this.find().then(function(el) {
        return el.sendKeys(args[0]);
      });
    }
  },
  read: function(selector, transformer) {
    var selected;
    transformer || (transformer = function(value) {
      return value;
    });
    selected = this.find(selector);
    return selected.getAttribute('value').then(function(value) {
      if (value) {
        return transformer(value);
      } else {
        return selected.getText().then(transformer);
      }
    });
  },
  find: function(selector) {
    var deferred;
    deferred = new $.Deferred();
    if (this.el) {
      if (!selector) {
        deferred.fulfill(this.el);
      } else {
        return this.el.findElement(Driver.By.css(selector));
      }
      return deferred;
    }
    this._ensureElement(selector);
    return this.driver.findElement(Driver.By.css(this._selector(selector)));
  },
  getHtml: function(selector) {
    return this.find(selector).then(function(el) {
      return el.getOuterHtml();
    });
  },
  getText: function(selector) {
    return this.find(selector).then(function(el) {
      return el.getText();
    });
  },
  getAttribute: function(attribute) {
    return this.find().then(function(el) {
      return el.getAttribute(attribute);
    });
  },
  getInnerHTML: function(selector) {
    return this.find(selector).then(function(el) {
      return el.getInnerHtml();
    });
  },
  getOuterHTML: function(selector) {
    return this.find(selector).then(function(el) {
      return el.getOuterHtml();
    });
  },
  isPresent: function(selector) {}
});
```

Response:
fill: ->
    args = arguments
    if (args.length > 1)
      @find(args[0]).then (el) ->
        el.clear().then ->
          el.sendKeys(args[1])
    else
     @find().then (el) ->
      el.sendKeys(args[0])

  read: (selector, transformer) ->
    transformer ||= (value) -> value
    selected = @find(selector)
    selected.getAttribute('value').then (value) ->
      if value
        return transformer(value)
      else
        return selected.getText().then transformer

  find: (selector) ->
    deferred = new $.Deferred

    if (@el)
      if !selector
        deferred.fulfill(@el)
      else
        return @el.findElement(Driver.By.css(selector))

      return deferred

    @_ensureElement(selector)
    @driver.findElement(Driver.By.css(@_selector(selector)))

  getHtml: (selector) ->
     @find(selector).then (el) -> el.getOuterHtml()

  getText: (selector) ->
    @find(selector).then (el) -> el.getText()

  getAttribute: (attribute) ->
    @find().then (el) ->
      el.getAttribute(attribute)

  getInnerHTML: (selector) ->
    @find(selector).then (el) -> el.getInnerHtml()

  getOuterHTML: (selector) ->
    @find(selector).then (el) -> el.getOuterHtml()

  isPresent: (selector) ->


Prompt:
fill: ->
    args = arguments
    if (args.length > 1)
      @find(args[0]).then (el) ->
        el.clear().then ->
          el.sendKeys(args[1])
    else
     @find().then (el) ->
      el.sendKeys(args[0])

  read: (selector, transformer) ->
    transformer ||= (value) -> value
    selected = @find(selector)
    selected.getAttribute('value').then (value) ->
      if value
        return transformer(value)
      else
        return selected.getText().then transformer

  find: (selector) ->
    deferred = new $.Deferred

    if (@el)
      if !selector
        deferred.fulfill(@el)

Response:
else
        return @el.findElement(Driver.By.css(selector))

      return deferred

    @_ensureElement(selector)
    @driver.findElement(Driver.By.css(@_selector(selector)))

  getHtml: (selector) ->
     @find(selector).then (el) -> el.getOuterHtml()

  getText: (selector) ->
    @find(selector).then (el) -> el.getText()

  getAttribute: (attribute) ->
    @find().then (el) ->
      el.getAttribute(attribute)

  getInnerHTML: (selector) ->
    @find(selector).then (el) -> el.getInnerHtml()

  getOuterHTML: (selector) ->
    @find(selector).then (el) -> el.getOuterHtml()

  isPresent: (selector) ->


Response:
@driver.isElementPresent(Driver.By.css(@_selector(selector)))

  isVisible: (selector) ->
    @find(selector).then (elm) ->
      elm.isDisplayed()

  addClass: (className) ->
    @find().then (el) =>
      @driver.executeScript("arguments[0].classList.add(arguments[1])", el, className)

  removeClass: (className) ->
    @find().then (el) =>
      @driver.executeScript("arguments[0].classList.remove(arguments[1])", el, className)

  toggleClass: (className) ->
    @find().then (el) =>
      @driver.executeScript("arguments[0].classList.toggle(arguments[1])", el, className)

  findAll: (selector) ->
    @driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  findByText: (text) ->
    @find().then (el) ->
      el.findElement(
        # WebDriver lets you go out of the child scope
        # if you pass an absolute xpath selector
        # this is a bug in WebDriver and is terrible
        # by passing a `.` this is no longer an issue.
        Driver.By.xpath('.//*[normalize-space(text())=normalize-space("' + text + '")]')
      )

  _ensureElement: (selector) ->
    @driver.wait(
      _.bind(@isPresent, this, selector),
      10000,
      "#{@_selector(selector)} not found"
    )

  _map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results

  sendKeys: ->


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
@driver.isElementPresent(Driver.By.css(@_selector(selector)))

  isVisible: (selector) ->
    @find(selector).then (elm) ->
      elm.isDisplayed()

  addClass: (className) ->
    @find().then (el) =>
      @driver.executeScript("arguments[0].classList.add(arguments[1])", el, className)

  removeClass: (className) ->
    @find().then (el) =>
      @driver.executeScript("arguments[0].classList.remove(arguments[1])", el, className)

  toggleClass: (className) ->
    @find().then (el) =>
      @driver.executeScript("arguments[0].classList.toggle(arguments[1])", el, className)

  findAll: (selector) ->
    @driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  findByText: (text) ->
    @find().then (el) ->
      el.findElement(
        # WebDriver lets you go out of the child scope
        # if you pass an absolute xpath selector
        # this is a bug in WebDriver and is terrible
        # by passing a `.` this is no longer an issue.
        Driver.By.xpath('.//*[normalize-space(text())=normalize-space("' + text + '")]')
      )

  _ensureElement: (selector) ->
    @driver.wait(
      _.bind(@isPresent, this, selector),
      10000,
      "#{@_selector(selector)} not found"
    )

  _map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results

  sendKeys: ->
```

Response:
this.driver.isElementPresent(Driver.By.css(this._selector(selector)))({
  isVisible: function(selector) {
    return this.find(selector).then(function(elm) {
      return elm.isDisplayed();
    });
  },
  addClass: function(className) {
    return this.find().then((el) => {
      return this.driver.executeScript("arguments[0].classList.add(arguments[1])", el, className);
    });
  },
  removeClass: function(className) {
    return this.find().then((el) => {
      return this.driver.executeScript("arguments[0].classList.remove(arguments[1])", el, className);
    });
  },
  toggleClass: function(className) {
    return this.find().then((el) => {
      return this.driver.executeScript("arguments[0].classList.toggle(arguments[1])", el, className);
    });
  },
  findAll: function(selector) {
    return this.driver.findElements(Driver.By.css(this._selector(selector)));
  },
  _selector: function(selector) {
    return this.root + (selector ? ` ${selector}` : '');
  },
  findByText: function(text) {
    return this.find().then(function(el) {
      // WebDriver lets you go out of the child scope
      // if you pass an absolute xpath selector
      // this is a bug in WebDriver and is terrible
      // by passing a `.` this is no longer an issue.
      return el.findElement(Driver.By.xpath('.//*[normalize-space(text())=normalize-space("' + text + '")]'));
    });
  },
  _ensureElement: function(selector) {
    return this.driver.wait(_.bind(this.isPresent, this, selector), 10000, `${this._selector(selector)} not found`);
  },
  _map: function(collection, callback) {
    var _reduce, results;
    results = [];
    _reduce = function(p, f, i) {
      return p.then(function() {
        return callback(f, i).then(function(v) {
          return results.push(v);
        });
      });
    };
    return _.reduce(collection, _reduce, Driver.promise.fulfilled()).then(function() {
      return results;
    });
  },
  sendKeys: function() {}
});


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
this.driver.isElementPresent(Driver.By.css(this._selector(selector)))({
  isVisible: function(selector) {
    return this.find(selector).then(function(elm) {
      return elm.isDisplayed();
    });
  },
  addClass: function(className) {
    return this.find().then((el) => {
      return this.driver.executeScript("arguments[0].classList.add(arguments[1])", el, className);
    });
  },
  removeClass: function(className) {
    return this.find().then((el) => {
      return this.driver.executeScript("arguments[0].classList.remove(arguments[1])", el, className);
    });
  },
  toggleClass: function(className) {
    return this.find().then((el) => {
      return this.driver.executeScript("arguments[0].classList.toggle(arguments[1])", el, className);
    });
  },
  findAll: function(selector) {
    return this.driver.findElements(Driver.By.css(this._selector(selector)));
  },
  _selector: function(selector) {
    return this.root + (selector ? ` ${selector}` : '');
  },
  findByText: function(text) {
    return this.find().then(function(el) {
      // WebDriver lets you go out of the child scope
      // if you pass an absolute xpath selector
      // this is a bug in WebDriver and is terrible
      // by passing a `.` this is no longer an issue.
      return el.findElement(Driver.By.xpath('.//*[normalize-space(text())=normalize-space("' + text + '")]'));
    });
  },
  _ensureElement: function(selector) {
    return this.driver.wait(_.bind(this.isPresent, this, selector), 10000, `${this._selector(selector)} not found`);
  },
  _map: function(collection, callback) {
    var _reduce, results;
    results = [];
    _reduce = function(p, f, i) {
      return p.then(function() {
        return callback(f, i).then(function(v) {
          return results.push(v);
        });
      });
    };
    return _.reduce(collection, _reduce, Driver.promise.fulfilled()).then(function() {
      return results;
    });
  },
  sendKeys: function() {}
});
```

Response:
@driver.isElementPresent(Driver.By.css(@_selector(selector)))

  isVisible: (selector) ->
    @find(selector).then (elm) ->
      elm.isDisplayed()

  addClass: (className) ->
    @find().then (el) =>
      @driver.executeScript("arguments[0].classList.add(arguments[1])", el, className)

  removeClass: (className) ->
    @find().then (el) =>
      @driver.executeScript("arguments[0].classList.remove(arguments[1])", el, className)

  toggleClass: (className) ->
    @find().then (el) =>
      @driver.executeScript("arguments[0].classList.toggle(arguments[1])", el, className)

  findAll: (selector) ->
    @driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  findByText: (text) ->
    @find().then (el) ->
      el.findElement(
        # WebDriver lets you go out of the child scope
        # if you pass an absolute xpath selector
        # this is a bug in WebDriver and is terrible
        # by passing a `.` this is no longer an issue.
        Driver.By.xpath('.//*[normalize-space(text())=normalize-space("' + text + '")]')
      )

  _ensureElement: (selector) ->
    @driver.wait(
      _.bind(@isPresent, this, selector),
      10000,
      "#{@_selector(selector)} not found"
    )

  _map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results

  sendKeys: ->


Prompt:
@driver.isElementPresent(Driver.By.css(@_selector(selector)))

  isVisible: (selector) ->
    @find(selector).then (elm) ->
      elm.isDisplayed()

  addClass: (className) ->
    @find().then (el) =>
      @driver.executeScript("arguments[0].classList.add(arguments[1])", el, className)

  removeClass: (className) ->
    @find().then (el) =>
      @driver.executeScript("arguments[0].classList.remove(arguments[1])", el, className)

  toggleClass: (className) ->
    @find().then (el) =>
      @driver.executeScript("arguments[0].classList.toggle(arguments[1])", el, className)

  findAll: (selector) ->
    @driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  findByText: (text) ->

Response:
@find().then (el) ->
      el.findElement(
        # WebDriver lets you go out of the child scope
        # if you pass an absolute xpath selector
        # this is a bug in WebDriver and is terrible
        # by passing a `.` this is no longer an issue.
        Driver.By.xpath('.//*[normalize-space(text())=normalize-space("' + text + '")]')
      )

  _ensureElement: (selector) ->
    @driver.wait(
      _.bind(@isPresent, this, selector),
      10000,
      "#{@_selector(selector)} not found"
    )

  _map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results

  sendKeys: ->


Response:
args = arguments
    @find().then (el) =>
      el.sendKeys.apply(el, args)


Response:
@driver.isElementPresent(Driver.By.css(@_selector(selector)))

  isVisible: (selector) ->
    @find(selector).then (elm) ->
      elm.isDisplayed()

  findAll: (selector) ->
    @driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  findByText: (text) ->
    @find().then (el) ->
      el.findElement(
        # WebDriver lets you go out of the child scope
        # if you pass an absolute xpath selector
        # this is a bug in WebDriver and is terrible
        # by passing a `.` this is no longer an issue.
        Driver.By.xpath('.//*[normalize-space(text())=normalize-space("' + text + '")]')
      )

  _ensureElement: (selector) ->
    @driver.wait(
      _.bind(@isPresent, this, selector),
      10000,
      "#{@_selector(selector)} not found"
    )

  _map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results

  sendKeys: ->
    args = arguments
    @find().then (el) =>
      el.sendKeys.apply(el, args)


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
@driver.isElementPresent(Driver.By.css(@_selector(selector)))

  isVisible: (selector) ->
    @find(selector).then (elm) ->
      elm.isDisplayed()

  findAll: (selector) ->
    @driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  findByText: (text) ->
    @find().then (el) ->
      el.findElement(
        # WebDriver lets you go out of the child scope
        # if you pass an absolute xpath selector
        # this is a bug in WebDriver and is terrible
        # by passing a `.` this is no longer an issue.
        Driver.By.xpath('.//*[normalize-space(text())=normalize-space("' + text + '")]')
      )

  _ensureElement: (selector) ->
    @driver.wait(
      _.bind(@isPresent, this, selector),
      10000,
      "#{@_selector(selector)} not found"
    )

  _map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results

  sendKeys: ->
    args = arguments
    @find().then (el) =>
      el.sendKeys.apply(el, args)
```

Response:
this.driver.isElementPresent(Driver.By.css(this._selector(selector)))({
  isVisible: function(selector) {
    return this.find(selector).then(function(elm) {
      return elm.isDisplayed();
    });
  },
  findAll: function(selector) {
    return this.driver.findElements(Driver.By.css(this._selector(selector)));
  },
  _selector: function(selector) {
    return this.root + (selector ? ` ${selector}` : '');
  },
  findByText: function(text) {
    return this.find().then(function(el) {
      // WebDriver lets you go out of the child scope
      // if you pass an absolute xpath selector
      // this is a bug in WebDriver and is terrible
      // by passing a `.` this is no longer an issue.
      return el.findElement(Driver.By.xpath('.//*[normalize-space(text())=normalize-space("' + text + '")]'));
    });
  },
  _ensureElement: function(selector) {
    return this.driver.wait(_.bind(this.isPresent, this, selector), 10000, `${this._selector(selector)} not found`);
  },
  _map: function(collection, callback) {
    var _reduce, results;
    results = [];
    _reduce = function(p, f, i) {
      return p.then(function() {
        return callback(f, i).then(function(v) {
          return results.push(v);
        });
      });
    };
    return _.reduce(collection, _reduce, Driver.promise.fulfilled()).then(function() {
      return results;
    });
  },
  sendKeys: function() {
    var args;
    args = arguments;
    return this.find().then((el) => {
      return el.sendKeys.apply(el, args);
    });
  }
});


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
this.driver.isElementPresent(Driver.By.css(this._selector(selector)))({
  isVisible: function(selector) {
    return this.find(selector).then(function(elm) {
      return elm.isDisplayed();
    });
  },
  findAll: function(selector) {
    return this.driver.findElements(Driver.By.css(this._selector(selector)));
  },
  _selector: function(selector) {
    return this.root + (selector ? ` ${selector}` : '');
  },
  findByText: function(text) {
    return this.find().then(function(el) {
      // WebDriver lets you go out of the child scope
      // if you pass an absolute xpath selector
      // this is a bug in WebDriver and is terrible
      // by passing a `.` this is no longer an issue.
      return el.findElement(Driver.By.xpath('.//*[normalize-space(text())=normalize-space("' + text + '")]'));
    });
  },
  _ensureElement: function(selector) {
    return this.driver.wait(_.bind(this.isPresent, this, selector), 10000, `${this._selector(selector)} not found`);
  },
  _map: function(collection, callback) {
    var _reduce, results;
    results = [];
    _reduce = function(p, f, i) {
      return p.then(function() {
        return callback(f, i).then(function(v) {
          return results.push(v);
        });
      });
    };
    return _.reduce(collection, _reduce, Driver.promise.fulfilled()).then(function() {
      return results;
    });
  },
  sendKeys: function() {
    var args;
    args = arguments;
    return this.find().then((el) => {
      return el.sendKeys.apply(el, args);
    });
  }
});
```

Response:
@driver.isElementPresent(Driver.By.css(@_selector(selector)))

  isVisible: (selector) ->
    @find(selector).then (elm) ->
      elm.isDisplayed()

  findAll: (selector) ->
    @driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  findByText: (text) ->
    @find().then (el) ->
      el.findElement(
        # WebDriver lets you go out of the child scope
        # if you pass an absolute xpath selector
        # this is a bug in WebDriver and is terrible
        # by passing a `.` this is no longer an issue.
        Driver.By.xpath('.//*[normalize-space(text())=normalize-space("' + text + '")]')
      )

  _ensureElement: (selector) ->
    @driver.wait(
      _.bind(@isPresent, this, selector),
      10000,
      "#{@_selector(selector)} not found"
    )

  _map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results

  sendKeys: ->
    args = arguments
    @find().then (el) =>
      el.sendKeys.apply(el, args)


Prompt:
@driver.isElementPresent(Driver.By.css(@_selector(selector)))

  isVisible: (selector) ->
    @find(selector).then (elm) ->
      elm.isDisplayed()

  findAll: (selector) ->
    @driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  findByText: (text) ->
    @find().then (el) ->
      el.findElement(
        # WebDriver lets you go out of the child scope
        # if you pass an absolute xpath selector
        # this is a bug in WebDriver and is terrible
        # by passing a `.` this is no longer an issue.
        Driver.By.xpath('.//*[normalize-space(text())=normalize-space("' + text + '")]')

Response:
)

  _ensureElement: (selector) ->
    @driver.wait(
      _.bind(@isPresent, this, selector),
      10000,
      "#{@_selector(selector)} not found"
    )

  _map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results

  sendKeys: ->
    args = arguments
    @find().then (el) =>
      el.sendKeys.apply(el, args)


Response:
class @Widget
  @extend: (protoProps, staticProps) ->
    parent = @
    if Object.hasOwnProperty(protoProps, 'constructor')
      child = protoProps.constructor
    else
      child = -> parent.apply(@, arguments)

    child.copyProperties @
    child.copyProperties staticProps

    Surrogate = ->
      @constructor = child
      return undefined

    Surrogate.prototype = @::
    child.prototype = new Surrogate()

    child::.copyProperties(protoProps) if protoProps

    child.__super__ = @::

    child

  @find = (attributes) ->
    _this = _.extend(new this, attributes)

    _this.find().then (el) ->
      _this.el = el
      _this

  constructor: (attributes = {}) ->
    _.extend @, attributes

    @initialize.apply @, arguments

  # Defines a noop initialize method intended to be
  # overridden by the user when extending a Widget base class
  initialize: ->

  world: World

  # use a getter to lazily initialize driver
  @getter 'driver', ->
    @_driver || World.driver

  click: (selector) ->
    @find(selector).click()

  fill: ->


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
class @Widget
  @extend: (protoProps, staticProps) ->
    parent = @
    if Object.hasOwnProperty(protoProps, 'constructor')
      child = protoProps.constructor
    else
      child = -> parent.apply(@, arguments)

    child.copyProperties @
    child.copyProperties staticProps

    Surrogate = ->
      @constructor = child
      return undefined

    Surrogate.prototype = @::
    child.prototype = new Surrogate()

    child::.copyProperties(protoProps) if protoProps

    child.__super__ = @::

    child

  @find = (attributes) ->
    _this = _.extend(new this, attributes)

    _this.find().then (el) ->
      _this.el = el
      _this

  constructor: (attributes = {}) ->
    _.extend @, attributes

    @initialize.apply @, arguments

  # Defines a noop initialize method intended to be
  # overridden by the user when extending a Widget base class
  initialize: ->

  world: World

  # use a getter to lazily initialize driver
  @getter 'driver', ->
    @_driver || World.driver

  click: (selector) ->
    @find(selector).click()

  fill: ->
```

Response:
this.Widget = (function() {
  class Widget {
    static extend(protoProps, staticProps) {
      var Surrogate, child, parent;
      parent = this;
      if (Object.hasOwnProperty(protoProps, 'constructor')) {
        child = protoProps.constructor;
      } else {
        child = function() {
          return parent.apply(this, arguments);
        };
      }
      child.copyProperties(this);
      child.copyProperties(staticProps);
      Surrogate = function() {
        this.constructor = child;
        return void 0;
      };
      Surrogate.prototype = this.prototype;
      child.prototype = new Surrogate();
      if (protoProps) {
        child.prototype.copyProperties(protoProps);
      }
      child.__super__ = this.prototype;
      return child;
    }

    static find(attributes) {
      var _this;
      _this = _.extend(new (this)(), attributes);
      return _this.find().then(function(el) {
        _this.el = el;
        return _this;
      });
    }

    constructor(attributes = {}) {
      _.extend(this, attributes);
      this.initialize.apply(this, arguments);
    }

    // Defines a noop initialize method intended to be
    // overridden by the user when extending a Widget base class
    initialize() {}

    click(selector) {
      return this.find(selector).click();
    }

    fill() {}

  };

  Widget.prototype.world = World;

  // use a getter to lazily initialize driver
  Widget.getter('driver', function() {
    return this._driver || World.driver;
  });

  return Widget;

}).call(this);


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
this.Widget = (function() {
  class Widget {
    static extend(protoProps, staticProps) {
      var Surrogate, child, parent;
      parent = this;
      if (Object.hasOwnProperty(protoProps, 'constructor')) {
        child = protoProps.constructor;
      } else {
        child = function() {
          return parent.apply(this, arguments);
        };
      }
      child.copyProperties(this);
      child.copyProperties(staticProps);
      Surrogate = function() {
        this.constructor = child;
        return void 0;
      };
      Surrogate.prototype = this.prototype;
      child.prototype = new Surrogate();
      if (protoProps) {
        child.prototype.copyProperties(protoProps);
      }
      child.__super__ = this.prototype;
      return child;
    }

    static find(attributes) {
      var _this;
      _this = _.extend(new (this)(), attributes);
      return _this.find().then(function(el) {
        _this.el = el;
        return _this;
      });
    }

    constructor(attributes = {}) {
      _.extend(this, attributes);
      this.initialize.apply(this, arguments);
    }

    // Defines a noop initialize method intended to be
    // overridden by the user when extending a Widget base class
    initialize() {}

    click(selector) {
      return this.find(selector).click();
    }

    fill() {}

  };

  Widget.prototype.world = World;

  // use a getter to lazily initialize driver
  Widget.getter('driver', function() {
    return this._driver || World.driver;
  });

  return Widget;

}).call(this);
```

Response:
class @Widget
  @extend: (protoProps, staticProps) ->
    parent = @
    if Object.hasOwnProperty(protoProps, 'constructor')
      child = protoProps.constructor
    else
      child = -> parent.apply(@, arguments)

    child.copyProperties @
    child.copyProperties staticProps

    Surrogate = ->
      @constructor = child
      return undefined

    Surrogate.prototype = @::
    child.prototype = new Surrogate()

    child::.copyProperties(protoProps) if protoProps

    child.__super__ = @::

    child

  @find = (attributes) ->
    _this = _.extend(new this, attributes)

    _this.find().then (el) ->
      _this.el = el
      _this

  constructor: (attributes = {}) ->
    _.extend @, attributes

    @initialize.apply @, arguments

  # Defines a noop initialize method intended to be
  # overridden by the user when extending a Widget base class
  initialize: ->

  world: World

  # use a getter to lazily initialize driver
  @getter 'driver', ->
    @_driver || World.driver

  click: (selector) ->
    @find(selector).click()

  fill: ->


Prompt:
class @Widget
  @extend: (protoProps, staticProps) ->
    parent = @
    if Object.hasOwnProperty(protoProps, 'constructor')
      child = protoProps.constructor
    else
      child = -> parent.apply(@, arguments)

    child.copyProperties @
    child.copyProperties staticProps

    Surrogate = ->
      @constructor = child
      return undefined

    Surrogate.prototype = @::
    child.prototype = new Surrogate()

    child::.copyProperties(protoProps) if protoProps

    child.__super__ = @::

    child

  @find = (attributes) ->

Response:
_this = _.extend(new this, attributes)

    _this.find().then (el) ->
      _this.el = el
      _this

  constructor: (attributes = {}) ->
    _.extend @, attributes

    @initialize.apply @, arguments

  # Defines a noop initialize method intended to be
  # overridden by the user when extending a Widget base class
  initialize: ->

  world: World

  # use a getter to lazily initialize driver
  @getter 'driver', ->
    @_driver || World.driver

  click: (selector) ->
    @find(selector).click()

  fill: ->


Response:
args = arguments
    if (args.length > 1)
      @find(args[0]).then (el) ->
        el.clear().then ->
          el.sendKeys(args[1])
    else
     @find().then (el) ->
      el.sendKeys(args[0])

  read: (selector, transformer) ->
    transformer ||= (value) -> value
    selected = @find(selector)
    selected.getAttribute('value').then (value) ->
      if value
        return transformer(value)
      else
        return selected.getText().then transformer

  find: (selector) ->
    deferred = new $.Deferred

    if (@el)
      if !selector
        deferred.fulfill(@el)
      else
        return @el.findElement(Driver.By.css(selector))

      return deferred

    @_ensureElement(selector)
    @driver.findElement(Driver.By.css(@_selector(selector)))

  getHtml: (selector) ->
     @find(selector).then (el) -> el.getOuterHtml()

  getText: (selector) ->
    @find(selector).then (el) -> el.getText()

  getAttribute: (attribute) ->
    @find().then (el) ->
      el.getAttribute(attribute)

  getInnerHTML: (selector) ->
    @find(selector).then (el) -> el.getInnerHtml()

  getOuterHTML: (selector) ->
    @find(selector).then (el) -> el.getOuterHtml()

  isPresent: (selector) ->
    @driver.isElementPresent(Driver.By.css(@_selector(selector)))


Prompt:
args = arguments
    if (args.length > 1)
      @find(args[0]).then (el) ->
        el.clear().then ->
          el.sendKeys(args[1])
    else
     @find().then (el) ->
      el.sendKeys(args[0])

  read: (selector, transformer) ->
    transformer ||= (value) -> value
    selected = @find(selector)
    selected.getAttribute('value').then (value) ->
      if value
        return transformer(value)
      else
        return selected.getText().then transformer

  find: (selector) ->
    deferred = new $.Deferred

    if (@el)
      if !selector
        deferred.fulfill(@el)
      else

Response:
return @el.findElement(Driver.By.css(selector))

      return deferred

    @_ensureElement(selector)
    @driver.findElement(Driver.By.css(@_selector(selector)))

  getHtml: (selector) ->
     @find(selector).then (el) -> el.getOuterHtml()

  getText: (selector) ->
    @find(selector).then (el) -> el.getText()

  getAttribute: (attribute) ->
    @find().then (el) ->
      el.getAttribute(attribute)

  getInnerHTML: (selector) ->
    @find(selector).then (el) -> el.getInnerHtml()

  getOuterHTML: (selector) ->
    @find(selector).then (el) -> el.getOuterHtml()

  isPresent: (selector) ->
    @driver.isElementPresent(Driver.By.css(@_selector(selector)))