Mosquito Users Guide
Visual site verification tool

Mosquito Script

To run mosquito you should first create a mosquito script which tells mosquito which urls to visit and what to do with them. A mosquito script is a plain ruby script, which invokes mosquito_run function. An empty script looks like:

require 'mosquito'

mosquito_run([
#mosquito commands here
])

You should put your commands separated by ',' at the comment location.

Mosquito Commands

  • set_image_dir(string) - sets the location of a directory which will be used to store images. It can be overriden be '-i' command line option. Defaults to './img'.
  • open(url) - opens the specified URL in mosquito hidden browser. This commands waits while page load is complete before processing other commands.
  • shoot(file_name) - makes a screenshots of page loaded in browser.
  • open_and_shoot(url, file_name) - opens a page, waits for load and makes a screenshot. A shortcut for 'open(url), shoot(file_name) sequence.
  • type(element_id, value) - enters a specified value into the input element with passed id.
  • click(element_id) - clicks a button with given id.

Working With DOM

Mosquito lets you manipulate/analyze page's DOM with following commands:

  • document(block, wait = false) - passes page's HTMLDocument instance to a block. If wait is true, mosquito waits for page load before processing next command. Sample.
  • element(element_id, block, wait = false) - passes an element with given id to the block.

Running Mosquito Script

You can run your mosquito script by invoking 'ruby <your_script_name>' command. The behavior of the script is controlled by several command line parameters:

  • -h - prints help
  • -a - accepts screenshots being produced as reference. Reference screenshots are used to calculate difference from.
  • -i [PATH] - specifies images path. 
  • -d - produces debug output. Use it if you have any problems with mosquito and mail me the output.

Mosquito Home

Mosquito Blog

View RSS feed

Download Mosquito

mosquito-0.2.zip