org.safs.selenium
Class CFComponent

java.lang.Object
  extended by org.safs.Processor
      extended by org.safs.ComponentFunction
          extended by org.safs.selenium.CFComponent
Direct Known Subclasses:
CFCheckBox, CFComboBox, CFEditBox, CFHTMLDocument, CFHTMLTable, CFListBox

public class CFComponent
extends ComponentFunction

Component Functions for Selenium.

For some functionality we use the java.awt.Robot and our own InputKeysParser classes.

InputKeysParser requires the availability of a SAFSKeycodeMap.dat file which is normally located in the SAFS\lib directory. This file will be loaded through ClassLoader.getSystemResourceAsStream.

Since:
OCT 10, 2006
OCT 10, 2006 (PHSABO) Original Release
JAN 16, 2007 (CANAGL) Removed Java 1.5 dependency.
AUG 01, 2007 (CANAGL) Made search for SAFSKeycodeMap.dat use the whole System CLASSPATH.
See Also:
Robot, InputKeysParser, CreateUnicodeMap, ClassLoader.getSystemResourceAsStream(java.lang.String)

Field Summary
static java.lang.String ALTCLICK
           
static java.lang.String ASSIGNPROPERTYVARIABLE
           
static java.lang.String CAPTUREOBJECTDATATOFILE
           
static java.lang.String CLICK
           
static java.lang.String CLOSEWINDOW
           
static java.lang.String COMPONENTCLICK
           
static java.lang.String CTRLCLICK
           
static java.lang.String CTRLRIGHTCLICK
           
static java.lang.String DOUBLECLICK
           
static java.lang.String GETGUIIMAGE
           
static java.lang.String GUIDOESEXIST
           
static java.lang.String GUIDOESNOTEXIST
           
static java.lang.String INPUTCHARACTERS
           
static java.lang.String INPUTKEYS
           
static InputKeysParser keysparser
           
static java.lang.String MAXIMIZE
           
static java.lang.String MINIMIZE
           
static java.lang.String RESTORE
           
static java.lang.String RIGHTCLICK
           
static java.awt.Robot robot
           
protected  Selenium selenium
           
static java.lang.String SETPOSITION
           
protected  STestRecordHelper sHelper
           
static java.lang.String SHIFTCLICK
           
protected  SeleniumGUIUtilities sUtils
           
static java.lang.String VERIFYGUIIMAGE
           
static java.lang.String VERIFYPROPERTY
           
static java.lang.String VERIFYPROPERTYCONTAINS
           
static java.lang.String WAITFORGUI
           
 
Fields inherited from class org.safs.ComponentFunction
action, compName, mapname, utils, windowName
 
Fields inherited from class org.safs.Processor
breakpointsOn, CASE_INSENSITIVE_FLAG, CASEINSENSITIVE_FLAG, clearProxiesAlways, commandLineBreakpoint, customStr, customText, DEBUG_MESSAGE, debugStr, debugText, DEFAULT_CUSTOM_PROCESSOR_PACKAGE, DEFAULT_CUSTOM_PROCESSOR_SUBPACKAGE, DEFAULT_PROCESSOR_PACKAGE, FAILED_MESSAGE, FAILED_OK_MESSAGE, failedStr, failedText, FAILURE_DETAIL, GENERIC_MESSAGE, genericStr, genericText, LINE_FAILURE_4, log, myBreakpointsOn, otherStr, otherText, PARAM_SIZE_1, PARAM_SIZE_2, PARAM_SIZE_3, PARAM_SIZE_4, params, PASSED_MESSAGE, passedStr, passedText, PRE_TXT_SUCCESS_4, PRE_TXT_SUCCESS_5, processorConfigSet, processorMap, recordProcessed, RECTYPE_DRIVER_COMMAND, RECTYPE_DRIVER_COMMAND_F, RECTYPE_DRIVER_COMMAND_W, RECTYPE_TEST_STEP, RECTYPE_TEST_STEP_F, RECTYPE_TEST_STEP_W, SAFS_CLEARPROXIESALWAYS_ITEM, SAFS_COMMANDLINEBREAKPOINT_ITEM, SAFS_COMMANDLINEBREAKPOINT_VARIABLE, SAFS_PARAMS_FILE, SAFS_RESBUN_NAME, SAFS_SECSWAITFORCOMPONENT_ITEM, SAFS_SECSWAITFORCOMPONENT_VARIABLE, SAFS_SECSWAITFORWINDOW_ITEM, SAFS_SECSWAITFORWINDOW_VARIABLE, SAFS_TESTDOMAINS_ITEM, SAFS_TESTDOMAINS_VARIABLE, secsWaitForComponent, secsWaitForWindow, SENT_MSG_3, testDomains, testRecordData, TXT_FAILURE_1, TXT_FAILURE_2, TXT_FAILURE_3, TXT_FAILURE_4, TXT_FAILURE_5, TXT_SUCCESS_1, TXT_SUCCESS_2, TXT_SUCCESS_2a, TXT_SUCCESS_3, TXT_SUCCESS_3a, TXT_SUCCESS_4, TXT_SUCCESS_5, WARNING_MESSAGE, WARNING_OK_MESSAGE, warningStr, warningText
 
Constructor Summary
CFComponent()
           
 
Method Summary
protected  void componentClick()
          
Purpose: componentClick
protected  java.awt.Rectangle getComponentBounds(java.lang.String s)
          Gets the size of the component
protected  java.awt.Rectangle getComponentRectangle()
          Gets a screenshot of either the whole page or a component on the page.
protected  void localProcess()
           
 void process()
          The primary method that all subclasses must implement.
protected  void scrollToAndClickComponent(SGuiObject o)
          Scrolls to a component then left clicks on it.
protected  void scrollToComponent(SGuiObject o)
          Scrolls to a component on the page
 
Methods inherited from class org.safs.ComponentFunction
action_getGuiImage, action_verifyGuiImageToFile, componentExecutedFailureMessage, componentFailureMessage, componentSuccessMessage, convertCoords, convertNum, getAlternateParams, getHelpers, getHelpersWorker, issueActionFailure, issueActionOnXFailure, issueErrorPerformingAction, issueErrorPerformingActionOnX, issueFileErrorFailure, issueInputRecordFailure, issueParameterCountFailure, issueParameterCountFailure, issueParameterValueFailure, issuePassedSuccess, issuePassedSuccessUsing, issueUnknownErrorFailure, isSupportedRecordType, lookupAppMapCoordReference, lookupAppMapNumReference, lookupAppMapReference, updateFromTestRecordData
 
Methods inherited from class org.safs.Processor
activateBreakpoint, checkBreakpoints, checkMyBreakpoints, delay, distributeConfigInformation, getAppMapItem, getChainedProcessor, getClassInstance, getClearProxiesAlways, getCustomProcClassNames, getCustomProcInstancePath, getLogUtilities, getParams, getProcClassNames, getProcInstance, getProcInstancePath, getRequiredField, getSecsWaitForComponent, getSecsWaitForWindow, getStandardErrorMessage, getTestRecordData, getVariable, hasChainedProcessor, initProcessorAndProcess, instanceProcessorAndProcess, isBreakpointsOn, isComponentFunctionRecord, isDriverCommandRecord, isEngineCommandRecord, isMyBreakpointsOn, isRecordProcessed, paramsFailedMsg, paramsFailedMsg, processCustomProcessor, processSubclassProcessor, setBreakpointsOn, setChainedProcessor, setClearProxiesAlways, setCommandLineBreakpoint, setCustomProcInstancePath, setLogUtilities, setMyBreakpointsOn, setParams, setProcInstance, setProcInstancePath, setRecordProcessed, setSecsWaitForComponent, setSecsWaitForWindow, setTestDomains, setTestRecordData, setVariable, standardFailureMessage, substituteVariable, validateParamSize, validProcessorClassName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WAITFORGUI

public static final java.lang.String WAITFORGUI
See Also:
Constant Field Values

ASSIGNPROPERTYVARIABLE

public static final java.lang.String ASSIGNPROPERTYVARIABLE
See Also:
Constant Field Values

GUIDOESEXIST

public static final java.lang.String GUIDOESEXIST
See Also:
Constant Field Values

GUIDOESNOTEXIST

public static final java.lang.String GUIDOESNOTEXIST
See Also:
Constant Field Values

GETGUIIMAGE

public static final java.lang.String GETGUIIMAGE
See Also:
Constant Field Values

VERIFYGUIIMAGE

public static final java.lang.String VERIFYGUIIMAGE
See Also:
Constant Field Values

INPUTCHARACTERS

public static final java.lang.String INPUTCHARACTERS
See Also:
Constant Field Values

INPUTKEYS

public static final java.lang.String INPUTKEYS
See Also:
Constant Field Values

VERIFYPROPERTY

public static final java.lang.String VERIFYPROPERTY
See Also:
Constant Field Values

VERIFYPROPERTYCONTAINS

public static final java.lang.String VERIFYPROPERTYCONTAINS
See Also:
Constant Field Values

CAPTUREOBJECTDATATOFILE

public static final java.lang.String CAPTUREOBJECTDATATOFILE
See Also:
Constant Field Values

CLICK

public static final java.lang.String CLICK
See Also:
Constant Field Values

CTRLCLICK

public static final java.lang.String CTRLCLICK
See Also:
Constant Field Values

DOUBLECLICK

public static final java.lang.String DOUBLECLICK
See Also:
Constant Field Values

RIGHTCLICK

public static final java.lang.String RIGHTCLICK
See Also:
Constant Field Values

CTRLRIGHTCLICK

public static final java.lang.String CTRLRIGHTCLICK
See Also:
Constant Field Values

SHIFTCLICK

public static final java.lang.String SHIFTCLICK
See Also:
Constant Field Values

ALTCLICK

public static final java.lang.String ALTCLICK
See Also:
Constant Field Values

COMPONENTCLICK

public static final java.lang.String COMPONENTCLICK
See Also:
Constant Field Values

CLOSEWINDOW

public static final java.lang.String CLOSEWINDOW
See Also:
Constant Field Values

SETPOSITION

public static final java.lang.String SETPOSITION
See Also:
Constant Field Values

MAXIMIZE

public static final java.lang.String MAXIMIZE
See Also:
Constant Field Values

MINIMIZE

public static final java.lang.String MINIMIZE
See Also:
Constant Field Values

RESTORE

public static final java.lang.String RESTORE
See Also:
Constant Field Values

selenium

protected Selenium selenium

sUtils

protected SeleniumGUIUtilities sUtils

sHelper

protected STestRecordHelper sHelper

robot

public static java.awt.Robot robot

keysparser

public static InputKeysParser keysparser
Constructor Detail

CFComponent

public CFComponent()
Method Detail

process

public void process()
Description copied from class: Processor
The primary method that all subclasses must implement. The implementation here simply checks for any chainedProcessor,
invokes chainedProcessor.setParams(this.getParams()),
invokes chainedProcessor.process(),
invokes setRecordProcessed(chainedProcessor.isRecordProcessed()).

Thus, any subclassing Processor should attempt to process it's own commands and then invoke super.process() to try any chained Processor(s).

Otherwise, by default executes setRecordProcessed(false) if no chainedProcessor is present.

Overrides:
process in class Processor

localProcess

protected void localProcess()

componentClick

protected void componentClick()

Purpose: componentClick


getComponentRectangle

protected java.awt.Rectangle getComponentRectangle()
Gets a screenshot of either the whole page or a component on the page.

Overrides:
getComponentRectangle in class ComponentFunction
Returns:
Rectangle bounds of the Component or null. If null is received the class assumes relevant error logging and testRecordData.statuscode changes have already been performed.
Throws:
SAFSException

scrollToAndClickComponent

protected void scrollToAndClickComponent(SGuiObject o)
Scrolls to a component then left clicks on it.

Parameters:
o - component to be clicked

scrollToComponent

protected void scrollToComponent(SGuiObject o)
Scrolls to a component on the page

Parameters:
o - component to be scrolled to

getComponentBounds

protected java.awt.Rectangle getComponentBounds(java.lang.String s)
Gets the size of the component

Parameters:
s - component
Returns:
size of the component