EVENT

From iMacros
Jump to: navigation, search

EVENT is a new command to automate web controls that the classic TAG command can not automate:

  • Drag & Drop
  • Sliders
  • Tricky date control
  • Dynamic drop-down boxes

To test the EVENT recording, change the recording / click mode in the iMacros settings.

EVENTS commands are collections of EVENT commands of the same type, target, etc.

Syntax iMacros Browser IE Plug-in Firefox Chrome

EVENT TYPE=type [SELECTOR|XPATH]=localizer [BUTTON|POINT|CHAR|KEY]=[button|point|char|key] [MODIFIERS=modifiers]

Parameters

  • TYPE
    The event type to be fired by the command. Allowed values are:
    Mouse events
    • MOUSEDOWN,
    • MOUSEMOVE,
    • MOUSEUP,
    • CLICK,
    • DBLCLICK
    Keyboard events
    • KEYDOWN
    • KEYUP
    • KEYPRESS
  • SELECTOR or XPATH
    The query string to localize the target element on the page. This can be either an XPATH expression, or a CSS selectors query
  • BUTTON, POINT, CHAR, or KEY
    It depends on which event type is being used. Mouse events need a BUTTON or a POINT. Keyboard events need CHAR or KEY
    MOUSEDOWN, CLICK and DBLCLICK need a BUTTON (0, meaning default or left mouse button, 1 for the middle mouse button, or 2 for the secondary or right mouse button)
    MOUSEUP and MOUSEMOVE use a POINT like in "(245,186)"
    KEYDOWN, KEYUP, and KEYPRESS use CHAR (printable characters, like "a" or "Q") or KEY (non-printable keys, like arrow up as in KEY=40)
  • MODIFIERS
    A combination of CTRL, ALT, SHIFT, META. Keys held pressed during the mouse events. Separate multiple modifiers with a comma, e.g. MODIFIERS="ctrl,shift".

Remarks

  • Keyboard events using KEY are only supported in iMacros for Firefox
  • EVENTS commands are collections of EVENT commands of the same type and on the same target element, so moving the mouse over a path records one single EVENTS command, where the points defining the path are given as a list of points: POINTS="(27,154),(26,154),(25,154)"


Examples

URL GOTO=http://demo.imacros.net/TestPages/ForceDirectedGraph.aspx
FRAME NAME=iframeFDgraph
EVENT TYPE=MOUSEDOWN SELECTOR="HTML>BODY>svg>g:nth-of-type(10)>circle" BUTTON=0
EVENTS TYPE=MOUSEMOVE SELECTOR="HTML>BODY>svg>g:nth-of-type(10)>circle" POINTS="(559,222),(558,222),(557,222),(555,223), (554,224),(551,224)"
EVENTS TYPE=MOUSEMOVE SELECTOR="HTML>BODY>svg" POINTS="(546,227),(536,232),(534,234),(523,243),(515,255),(512,259),(510,263),(500,282),(499,285),(493,300),(492,304),(492,306),(488,321),(487,323),(487,324),(487,326),(486,327),(483,336)"
EVENTS TYPE=MOUSEMOVE SELECTOR="HTML>BODY>svg>line:nth-of-type(4)" POINTS="(481,338),(481,339)"
EVENTS TYPE=MOUSEMOVE SELECTOR="HTML>BODY>svg" POINTS="(480,340),(479,342),(475,347),(475,348)"
EVENT TYPE=MOUSEMOVE SELECTOR="HTML>BODY>svg>g:nth-of-type(10)>circle" POINT="(474,350)"
EVENT TYPE=MOUSEMOVE SELECTOR="HTML>BODY>svg" POINT="(473,351)"
EVENTS TYPE=MOUSEMOVE SELECTOR="HTML>BODY>svg>g:nth-of-type(10)>circle" POINTS="(472,353),(470,355),(469,357),(468,359),(467,360),(466,360)"
EVENT TYPE=MOUSEUP SELECTOR="HTML>BODY>svg>g:nth-of-type(10)>circle" POINT="(466,360)"

Use the CLEAR command so that times of website response measurements are not influenced by using local cache data:

 URL GOTO=https://moqups.com/#!/
 EVENT TYPE=MOUSEDOWN SELECTOR="#preview-svg>svg>svg>svg>foreignObject>DIV" BUTTON=0
 EVENTS TYPE=MOUSEMOVE SELECTOR="#preview-svg>svg>svg>svg>foreignObject>DIV" POINTS="(131,254),(132,254),(134,254),(136,255),(139,256),(142,256),(147,256),(153,257),(160,257),(169,258),(190,258)"
 EVENT TYPE=MOUSEMOVE SELECTOR="#containment" POINT="(204,257)"
 EVENT TYPE=MOUSEUP POINT="(386,254)"

Enable the EVENT recording mode

Enable the EVENT recording mode

Record drag & drop events

Record drag & drop events

Record date and time selection

Record date and time selection ("date picker")

Record the selection from within an "ajaxy" drop-down

Record the selection from within an "ajaxy" drop-down

Related Forum Posts

See Also

TAG DS