com.opera.core.systems.scope.services.ums
Class OperaExec

java.lang.Object
  extended by com.opera.core.systems.scope.AbstractService
      extended by com.opera.core.systems.scope.services.ums.OperaExec
All Implemented Interfaces:
IOperaExec

public class OperaExec
extends AbstractService
implements IOperaExec

The exec service handles user interactions such as key presses, mouse clicks, screenshot grabbing and executing actions on Opera.

Author:
Deniz Turkoglu , Andreas Tolf Tolfsen

Constructor Summary
OperaExec(ScopeServices services, String version)
           
 
Method Summary
 void action(String using, int windowID, String... params)
           
 void action(String using, int data, String dataString, String dataStringParam)
           
 void action(String using, String... params)
          Execute an opera action with parameters (parameters are sent with commas).
 ScreenShotReply containsColor(Canvas canvas, long timeout, OperaColors... colors)
          Check if the page contains color(s) as specified in OperaColors.
 Set<String> getActionList()
          Returns the list of possible Opera Actions on host.
 void init()
           
 void key(String key)
          Execute a key press (immediately send key down and up).
 void key(String key, boolean up)
          Create a key event, this event controls if the key has been previously pressed before allowing key up.
 boolean keyIsPressed(String key)
          Whether the given key is currently pressed down.
 void mouseAction(int x, int y, int count, OperaMouseKeys... keys)
          Create one or more mouse actions on coordinates x,y with key(s) as specified in OperaMouseKeys and the number of repeated events as an integer.
 void mouseAction(int x, int y, OperaMouseKeys... keys)
          Create a mouse action on coordinates x,y with key(s) as specified in OperaMouseKeys.
 void releaseKeys()
          Release all the pressed keys
 ScreenShotReply screenWatcher(Canvas canvas, long timeout, boolean includeImage, String... hashes)
          Take a screenshot of specified ExecProtos.Area and compare it with the given hashes (keys).
 void type(String using)
          Type a string, preserving space, sent to active window This command doesn't return a response in STP/0 hence we sleep to be on the safe side.
 
Methods inherited from class com.opera.core.systems.scope.AbstractService
buildPayload, executeCommand, executeCommand, getVersion, isVersionInRange, sleep, xpathIterator, xpathPointer, xpathQuery
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OperaExec

public OperaExec(ScopeServices services,
                 String version)
Method Detail

init

public void init()
Specified by:
init in interface IOperaExec

type

public void type(String using)
Description copied from interface: IOperaExec
Type a string, preserving space, sent to active window This command doesn't return a response in STP/0 hence we sleep to be on the safe side.

Specified by:
type in interface IOperaExec

mouseAction

public void mouseAction(int x,
                        int y,
                        OperaMouseKeys... keys)
Description copied from interface: IOperaExec
Create a mouse action on coordinates x,y with key(s) as specified in OperaMouseKeys.

Specified by:
mouseAction in interface IOperaExec

mouseAction

public void mouseAction(int x,
                        int y,
                        int count,
                        OperaMouseKeys... keys)
Description copied from interface: IOperaExec
Create one or more mouse actions on coordinates x,y with key(s) as specified in OperaMouseKeys and the number of repeated events as an integer.

Specified by:
mouseAction in interface IOperaExec

getActionList

public Set<String> getActionList()
Description copied from interface: IOperaExec
Returns the list of possible Opera Actions on host.

Specified by:
getActionList in interface IOperaExec

action

public void action(String using,
                   int windowID,
                   String... params)
Specified by:
action in interface IOperaExec

action

public void action(String using,
                   int data,
                   String dataString,
                   String dataStringParam)
Specified by:
action in interface IOperaExec

action

public void action(String using,
                   String... params)
Description copied from interface: IOperaExec
Execute an opera action with parameters (parameters are sent with commas).

Specified by:
action in interface IOperaExec

key

public void key(String key)
Description copied from interface: IOperaExec
Execute a key press (immediately send key down and up).

Specified by:
key in interface IOperaExec

key

public void key(String key,
                boolean up)
Description copied from interface: IOperaExec
Create a key event, this event controls if the key has been previously pressed before allowing key up.

Specified by:
key in interface IOperaExec
up - down if false

keyIsPressed

public boolean keyIsPressed(String key)
Description copied from interface: IOperaExec
Whether the given key is currently pressed down.

Specified by:
keyIsPressed in interface IOperaExec
Returns:
true if the key is currently down, false if not.

releaseKeys

public void releaseKeys()
Description copied from interface: IOperaExec
Release all the pressed keys

Specified by:
releaseKeys in interface IOperaExec

containsColor

public ScreenShotReply containsColor(Canvas canvas,
                                     long timeout,
                                     OperaColors... colors)
Description copied from interface: IOperaExec
Check if the page contains color(s) as specified in OperaColors.

TODO: Needs abstraction layer

Specified by:
containsColor in interface IOperaExec

screenWatcher

public ScreenShotReply screenWatcher(Canvas canvas,
                                     long timeout,
                                     boolean includeImage,
                                     String... hashes)
Description copied from interface: IOperaExec
Take a screenshot of specified ExecProtos.Area and compare it with the given hashes (keys).

Specified by:
screenWatcher in interface IOperaExec


Copyright © 2012. All Rights Reserved.