• function

click FuncUnit.prototype.click

 

click(options [,success])

Clicks an element. This issues a:

  • mousedown
  • focus - if the element is focusable
  • mouseup
  • click

If no clientX/Y or pageX/Y is provided as options, the click happens at the center of the element.

For a right click or double click use FuncUnit.prototype.rightClick or FuncUnit.prototype.dblclick.

Example

//clicks the bar element
S("#bar").click()

Parameters

  1. options {Object}Optional

    options to pass to the click event. Typically, this is clientX/Y or pageX/Y:

    $('#foo').click({pageX: 200, pageY: 100});

    You can pass it any of the serializable parameters you'd send to initMouseEvent, but command keys are controlled by FuncUnit.prototype.type.

  2. success {function()}Optional

    a callback that runs after the click, but before the next action.

Returns

{funcUnit}

returns the funcunit object for chaining.