The Opera Exec protocol can be used to control an Opera instance from the outside, and various operations can be initiated. This functionality is mainly useful for QA testing.
Examples
The following example will do a spatial navigation down:
.. code-block:: javascript
Exec([ [ ["_keydown","shift"], ["_keydown","down"], ["_keyup","down"], ["_keyup","shift"] ] ])The following will type the text "Hello":
.. code-block:: javascript
Exec([ [ ["_type","Hello"] ] ])Take note that shift-modifier key-presses are neither generated nor taken into account when processing the letters of the _type
operation. This means that no shift key will be pressed around the "H" in "Hello" above, and the text typed would still be "Hello" if the shift key was pressed (with a _keydown
operation) before the _type
operation.
The following will trigger an Action of "Page down":
.. code-block:: javascript
Exec([ [ ["Page Down"] ] ])Error handling
There are currently no error messages or other reports of a failed operation. Incorrect syntax, unknown keys, or other invalid input will be silently dropped.
Exec
Executes a series of actions in the opera host, each action consists of a name identifying the action and optionally a value for the action. The value depends on the type of action.
command Exec( )
returns ( )
= 1;
GetActionInfoList
Request a list of valid actions.
command GetActionInfoList( )
returns ( )
= 2;
SendMouseAction
Move mouse to the given position on the screen/window. Note that the mouse cursor is not moved visibly.
The coordinates are relative to the upper left corner of the tab (not including chrome).
command SendMouseAction( )
returns ( )
= 5;
SetupScreenWatcher
command SetupScreenWatcher( )
returns ( )
= 3;