Marionette

Marionette is a Crystal shard that replaces the functionality of Selenium (Firefox only for now) by communicating directly with an instance of the browser. It provides a simple, but powerful API which allows everything from navigation to screenshots to executing JavaScript.

Installation

Add this to your application's shard.yml:

dependencies:
  marionette:
    github: watzon/marionette

Usage

require "marionette"

# Marionette.launch launches a Firefox browser and exposes
# it to the block. The browser automatically closes after
# the block is finished.
Marionette.launch do
  goto("https://watzon.tech")
  save_screenshot("watzon-tech.jpg")
end

# Marionette.launch can also be used without a block. This
# method requires that you close the browser yourself.
browser = Marionette.launch
browser.goto("https://watzon.tech")
browser.save_screenshot("watzon-tech.jpg")
browser.quit

Launch options

Marionette.launch accepts all the same arguments as Launcher#launch. These arguments are:

Browser

Launcher#launch returns a Browser instance which is responsible for most of Marionette's functionality. It includes a number of methods which can be found here.

Contributing

  1. Fork it ( https://github.com/watzon/marionette/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors