public class CFComponent extends ComponentFunction
ComponentFunction.Window| Modifier and Type | Field and Description |
|---|---|
protected org.openqa.selenium.WebElement |
compObject |
static int |
DEFAULT_MAX_RETRY_ENTER
5, the default maximum time to retry enter text if verification fails.
|
static java.lang.String |
INDENT_MARK |
protected Component |
libComponent |
protected static java.util.Map<org.openqa.selenium.WebElement,Component> |
libComponentCache
A cache, which stores a pair(WebElement, Component)
|
protected boolean |
ready
Boolean value indicates if the web-element is "ready" for processing.
The "ready" has different meanings for different component and different keywords. |
static java.lang.String |
SAFS_JAVASCRIPT_RESULT |
protected org.openqa.selenium.support.ui.WebDriverWait |
waiter
The WebDriverWait used to wait 'ready' of a WebElement.
It is assigned in waitReady(WebElement), which should be called in sub-class if overridden. |
protected WDTestRecordHelper |
wdHelper |
protected WebDriverGUIUtilities |
wdUtils |
protected org.openqa.selenium.WebElement |
winObject |
action, ALTCLICK, ALTLEFTDRAG, altText, ASSIGNPROPERTYVARIABLE, CAPTUREOBJECTDATATOFILE, CAPTUREPROPERTIESTOFILE, CAPTUREPROPERTYTOFILE, CLEARAPPMAPCACHE, CLICK, CLOSEWINDOW, compName, COMPONENTCLICK, CTRLALTLEFTDRAG, CTRLCLICK, CTRLLEFTDRAG, CTRLRIGHTCLICK, CTRLSHIFTLEFTDRAG, DOUBLECLICK, GETGUIIMAGE, GETTEXTFROMGUI, GUIDOESEXIST, GUIDOESNOTEXIST, HOVERMOUSE, HSCROLLTO, INPUTCHARACTERS, INPUTKEYS, ISPROPERTYEXIST, iterator, LEFTDRAG, LOCATESCREENIMAGE, mapname, MAXIMIZE, MINIMIZE, MOUSECLICK, OBJECT_DATA, PARAM_FILTER, PARAM_UUID, PROPERTY_DOT_itemText, PROPERTY_innerHTML, PROPERTY_innerText, PROPERTY_Items, PROPERTY_text, PROPERTY_textContent, RELATIVE_TO_PARENT, RELATIVE_TO_SCREEN, RESTORE, RIGHTCLICK, RIGHTDRAG, SAVETEXTFROMGUI, SELECTMENUITEM, SELECTMENUITEMCONTAINS, SENDEVENT, SETPOSITION, SETPROPERTYVALUE, SHIFTCLICK, SHIFTLEFTDRAG, TEST_DATA_SUFFIX, utils, VERIFYARRAYPROPERTYTOFILE, VERIFYBINARYFILETOFILE, VERIFYCLIPBOARDTOFILE, VERIFYFILETOFILE, VERIFYGUIIMAGETOFILE, VERIFYMENUITEM, VERIFYMENUITEMCONTAINS, VERIFYOBJECTDATATOFILE, VERIFYPROPERTY, VERIFYPROPERTYCONTAINS, VERIFYPROPERTYTOFILE, VERIFYTEXTFILETOFILE, VERIFYVALUECONTAINS, VERIFYVALUEEQUALS, VERIFYVALUES, VERIFYVALUESIGNORECASE, VSCROLLTO, WAITFORGUI, windowNamebreakpointsOn, 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, RFSMCache, RFSMOnly, RFT_FIND_SEARCH_MODE_ALGORITHM, RFT_FIND_SEARCH_MODE_CACHE, 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, testrecordStackable, 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, unexpectedAlertBehaviour, WARNING_MESSAGE, WARNING_OK_MESSAGE, warningStr, warningText| Constructor and Description |
|---|
CFComponent() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
_close()
Close the window.
|
protected void |
_maximize()
Maximize the window.
|
protected void |
_minimize()
Minimize the window.
|
void |
_setFocus() |
protected void |
_setPosition(java.awt.Point position)
Subclass should give its own implementation
|
protected void |
_setSize(java.awt.Dimension size)
Subclass should give its own implementation
|
protected void |
action_ComputedStyle(boolean verification)
Purpose: verifyComputedStyle() |
static void |
captureHierarchicalData(java.util.Collection<java.lang.String> contents,
HierarchicalElement[] nodes,
java.lang.String indentMark,
int level)
Caputre the content of hierarchical structure like tree or menu.
|
protected java.util.Collection<java.lang.String> |
captureObjectData()
Sub class may override this method to get its own data.
|
void |
clearCache()
clear the cache 'libComponentCache'
|
static void |
clearInternalCache()
clear the cache 'libComponentCache'
|
protected void |
componentClick()
Purpose: componentClick |
static java.util.List<java.lang.String> |
convertElementArrayToList(Element[] elements)
Get the text of each element object in an array, and add it to a list, then return the list.
|
protected void |
doSetText(java.lang.String libName,
boolean isCharacter,
boolean needVerify)
Set the text of Component box.
|
protected void |
dragTo()
perform dragTo from component1 to component2 with offset.
|
protected void |
executeScript()
Purpose: executeScript |
protected boolean |
exist()
To test if the component exists or not.
The sub class may test the component's visibility also. |
protected java.awt.Rectangle |
getComponentRectangle()
Do nothing method returns null.
|
protected java.awt.Rectangle |
getComponentRectangleOnScreen()
Get the absolute 'Rectangle bounds' of the Component, which means the rectangle is relative to the
whole screen, NOT to a window/browser. |
protected java.util.Map<java.lang.String,java.lang.Object> |
getProperties() |
protected java.lang.Object |
getPropertyObject(java.lang.String propertyName) |
protected java.awt.image.BufferedImage |
getRectangleImage(java.awt.Rectangle imageRect)
Get BufferedImage within a rectangle.
The rectangle may be absolute on screen, Or it may be relative to a browser or something. It depends on what is returned by ComponentFunction.getComponentRectangle().This method assume the rectangle is absolute on screen, so get the image on screen within the rectangle. Sub class may override this method to get its own image. |
protected java.awt.Rectangle |
getWindowRectangleOnScreen()
Get the absolute 'Rectangle bounds' of the Window, which means the rectangle is relative to the
whole screen. |
protected void |
inputKeystrokes()
handles InputKeys and InputCharacters.
|
protected void |
localProcess()
Handle the cache for component-library.
In this class CFComponent, component-library is not required for some keywords like Maximize, Minimize etc. So in the method process() of this class, when calling localProcess(), if any Exception is caught, just ignore it. But for subclass, component-library is required, so if this method is overrided, user needs to call super.localProcess() in a try-catch clause like following: |
protected Component |
newLibComponent(org.openqa.selenium.WebElement webelement)
sub class MUST to override this method and provide its own library Component.
|
protected void |
performDrag()
perform LeftDrag or RightDrag on component moving from (x1,y1) to (x2,y2).
|
protected boolean |
performHoverMouse(java.awt.Point point,
int milliseconds)
Purpose: perform hovering mouse at 'point' for 'milliseconds' period on a Component.
Subclass may need to give a specific implementation by tools (RJ, Selenium etc.) API. |
void |
process()
The primary method that all subclasses must implement.
|
protected void |
refresh(boolean includingWinObject)
Refresh the winObject/compObject if stable.
|
protected void |
refresh(boolean includingWinObject,
boolean checkStable)
Refresh the winObject/compObject if stable or refresh is forced by setting parameter 'checkStale' to false.
|
static org.openqa.selenium.WebElement |
refresh(org.openqa.selenium.WebElement webelement)
Try to get a fresh WebElement.
When the page change, the WebElement may be stale, or the information (like its location, size etc.) may be stale, so we need to get the fresh WebElement on the page to get latest information. Note: This method may consume some time for getting refreshed WebElement. |
static org.openqa.selenium.WebElement |
refresh(org.openqa.selenium.WebElement webelement,
boolean checkStale)
Try to get a fresh WebElement if it is stale.
When the page change, the WebElement may be stale, or the information (like its location, size etc.) may be stale, so we need to get the fresh WebElement on the page to get latest information. Note: This method may consume some time for getting refreshed WebElement. |
void |
setMaxRetry(int maxRetry) |
protected void |
setText(java.lang.String libName,
boolean isCharacter,
java.lang.String text)
Clear the content of Component box first, and then enter the text into it.
|
protected boolean |
showComponentAsMuchPossible(boolean verify,
boolean refresh)
Show the component in the browser's viewport as much as possible.
|
protected org.openqa.selenium.WebElement |
waitReady(org.openqa.selenium.WebElement element)
Wait for the component to be "ready": "ready" has different meanings for different components and different types.
|
_restore, action_getGuiImage, action_GetSaveTextFromGUI, action_showOnPage, action_verifyGuiImageToFile, assignPropertyVariable, captureObjectDataToFile, capturePropertiesToFile, capturePropertyToFile, checkForCoord, checkForCoord, clearAppMapCache, close, closeWindow, componentExecutedFailureMessage, componentFailureMessage, componentProcess, componentSuccessMessage, convertCoords, convertLine, convertNum, convertWindowPosition, ConvertWindowPosition, deduceImageRect, getAlternateParams, getHelpers, getHelpersWorker, getPossibleMapItem, getProperty, getPropertyCollection, getPropertyCollection, getStringValue, getUUIDBoolean, guiDoesExist, hoverMouse, hoverScreenLocation, isClickAction, isPropertyExist, issueFileErrorFailure, issueParameterCountFailure, issueParameterCountFailure, issueParameterValueFailure, issuePassedSuccess, issuePassedSuccessUsing, issueUnknownErrorFailure, isSupportedRecordType, locateScreenImage, lookupAppMapCoordReference, lookupAppMapLineReference, lookupAppMapNumReference, lookupAppMapReference, maximize, minimize, normalizeFileEncoding, normalizePropertyCollection, performScorll, restore, selectMenuItem, sendEvent, setIterator, setPosition, setPropertyValue, setRectVars, updateFromTestRecordData, verifyClipboardToFile, verifyFileToFile, verifyMenuItem, verifyObjectDataToFile, verifyPropertiesToFile, verifyProperty, verifyPropertyContains, verifyPropertyToFile, verifyValueContains, verifyValues, waitForGUI, waitForObjectactivateBreakpoint, checkBreakpoints, checkMyBreakpoints, deduceBenchFile, deduceDiffFile, deduceProjectFile, deduceTestFile, delay, distributeConfigInformation, getAbsolutFileName, getAppMapItem, getChainedProcessor, getClassInstance, getClearProxiesAlways, getCustomProcClassNames, getCustomProcInstancePath, getLogUtilities, getParams, getProcClassNames, getProcInstance, getProcInstancePath, getRequiredField, getSecsWaitForComponent, getSecsWaitForWindow, getStandardErrorMessage, getTestRecordData, getUnexpectedAlertBehaviour, getVariable, hasChainedProcessor, initProcessorAndProcess, instanceProcessorAndProcess, isBreakpointsOn, isComponentFunctionRecord, isDriverCommandRecord, isEngineCommandRecord, isMyBreakpointsOn, isRecordProcessed, isRFSMCache, isRFSMOnly, issueActionFailure, issueActionOnXFailure, issueErrorPerformingAction, issueErrorPerformingActionOnX, issueErrorPerformingActionUsing, issueInputRecordFailure, issueInputRecordFailure, issuePassedSuccess, logFailureMessage, normalizeTestFileName, paramsFailedMsg, paramsFailedMsg, popTestRecord, processCustomProcessor, processSubclassProcessor, pushTestRecord, setAtEndOfProcess, setBreakpointsOn, setChainedProcessor, setClearProxiesAlways, setCommandLineBreakpoint, setCustomProcInstancePath, setLogUtilities, setMyBreakpointsOn, setParams, setProcInstance, setProcInstancePath, setRecordProcessed, setRFSMCache, setRFSMOnly, setSecsWaitForComponent, setSecsWaitForWindow, setTestDomains, setTestRecordData, setUnexpectedAlertBehaviour, setVariable, standardFailureMessage, substituteVariable, validateParamSize, validProcessorClassNamepublic static final java.lang.String SAFS_JAVASCRIPT_RESULT
public static final java.lang.String INDENT_MARK
protected WebDriverGUIUtilities wdUtils
protected WDTestRecordHelper wdHelper
protected org.openqa.selenium.WebElement winObject
protected org.openqa.selenium.WebElement compObject
protected Component libComponent
protected static java.util.Map<org.openqa.selenium.WebElement,Component> libComponentCache
public static int DEFAULT_MAX_RETRY_ENTER
protected boolean ready
protected org.openqa.selenium.support.ui.WebDriverWait waiter
waitReady(WebElement), which should be called in sub-class if overridden.public void setMaxRetry(int maxRetry)
maxRetry - int, the max times to retry 'enter the text' into Component box if the verification fails.public void process()
ProcessorThus, 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.
protected org.openqa.selenium.WebElement waitReady(org.openqa.selenium.WebElement element)
element - WebElement the web-element to be checkedprotected void localProcess()
throws SeleniumPlusException
process() of this class, when calling localProcess(),
try{
super.localProcess();
subLibrary = (SubComponentLibrary) libComponent;
}catch(SeleniumPlusException se){
testRecordData.setStatusCode(StatusCodes.GENERAL_SCRIPT_FAILURE);
}
SeleniumPlusExceptionprotected Component newLibComponent(org.openqa.selenium.WebElement webelement) throws SeleniumPlusException
SeleniumPlusExceptionpublic static void clearInternalCache()
public void _setFocus()
throws SAFSException
SAFSExceptionpublic void clearCache()
clearCache in class ComponentFunctionprotected void inputKeystrokes()
throws SAFSException
inputKeystrokes in class ComponentFunctionSAFSExceptionprotected void _setPosition(java.awt.Point position)
throws SAFSException
_setPosition in class ComponentFunctionSAFSExceptionprotected void _setSize(java.awt.Dimension size)
throws SAFSException
_setSize in class ComponentFunctionSAFSExceptionprotected void _maximize()
throws SeleniumPlusException
_maximize in class ComponentFunctionSeleniumPlusExceptionprotected void _close()
throws SeleniumPlusException
_close in class ComponentFunctionSeleniumPlusExceptionprotected void _minimize()
throws SeleniumPlusException
_minimize in class ComponentFunctionSeleniumPlusExceptionprotected void componentClick()
throws SAFSException
componentClick in class ComponentFunctionSAFSExceptionprotected void executeScript()
throws SAFSException
executeScript in class ComponentFunctionSAFSExceptionprotected void action_ComputedStyle(boolean verification)
throws SAFSException
action_ComputedStyle in class ComponentFunctionSAFSExceptionprotected java.lang.Object getPropertyObject(java.lang.String propertyName)
throws SAFSException
getPropertyObject in class ComponentFunctionSAFSException - "Not supported yet."protected java.util.Map<java.lang.String,java.lang.Object> getProperties()
throws SAFSException
getProperties in class ComponentFunctionSAFSException - "Not supported yet."protected java.util.Collection<java.lang.String> captureObjectData()
throws SAFSException
captureObjectData in class ComponentFunctionSAFSException - "Not supported yet."public static java.util.List<java.lang.String> convertElementArrayToList(Element[] elements)
elements - Element[], an array of element objectpublic static void captureHierarchicalData(java.util.Collection<java.lang.String> contents,
HierarchicalElement[] nodes,
java.lang.String indentMark,
int level)
throws SeleniumPlusException
contents - Collectionnodes - HierarchicalElement[], an array of hierarchical structure's nodesindentMark - String, The character(s) to indent the child nodes from the parent branch.level - int, the level of the node in the whole hierarchical structure. 0 at root level.SeleniumPlusExceptionprotected java.awt.Rectangle getWindowRectangleOnScreen()
ComponentFunctiongetWindowRectangleOnScreen in class ComponentFunctionprotected java.awt.Rectangle getComponentRectangleOnScreen()
ComponentFunctiongetComponentRectangleOnScreen in class ComponentFunctionprotected boolean showComponentAsMuchPossible(boolean verify,
boolean refresh)
throws SeleniumPlusException
showComponentAsMuchPossible in class ComponentFunctionverify - boolean, verify that the component is shown on page if verify is true.refresh - boolean, the component may need to be refreshed after scrolling into view.SeleniumPlusExceptionprotected void refresh(boolean includingWinObject)
includingWinObject - boolean, if true this method will also refresh window object.
if false, only refresh component object.protected void refresh(boolean includingWinObject,
boolean checkStable)
includingWinObject - boolean, if true this method will also refresh window object.
if false, only refresh component object.checkStale - boolean, whether to check if the webelement is stable before refresh.
true, check stable; false, force refresh directly without check.public static org.openqa.selenium.WebElement refresh(org.openqa.selenium.WebElement webelement)
webelement - WebElement, to be refreshed.refresh(WebElement, boolean)public static org.openqa.selenium.WebElement refresh(org.openqa.selenium.WebElement webelement,
boolean checkStale)
webelement - WebElement, to be refreshed.checkStale - boolean, whether to check if the webelement is stable before refresh.
true, check stable; false, force refresh directly without check.protected java.awt.Rectangle getComponentRectangle()
ComponentFunctionComponentFunction.getRectangleImage(Rectangle) SHOULD be overridden in subclass to provide appropriate implementation.
ComponentFunction.deduceImageRect(String) to get a subarea rectangle.
getComponentRectangle in class ComponentFunctiongetRectangleImage(Rectangle).ComponentFunction.deduceImageRect(String)protected java.awt.image.BufferedImage getRectangleImage(java.awt.Rectangle imageRect)
throws SAFSException
ComponentFunctionComponentFunction.getComponentRectangle().getRectangleImage in class ComponentFunctionimageRect - Rectangle, within the rectangle to get image. SAFSExceptionComponentFunction.getComponentRectangle(),
ComponentFunction.deduceImageRect(String)protected boolean exist()
throws SAFSException
ComponentFunctionexist in class ComponentFunctionSAFSExceptionprotected boolean performHoverMouse(java.awt.Point point,
int milliseconds)
throws SAFSException
ComponentFunctionperformHoverMouse in class ComponentFunctionpoint - Point, coordinate relative to the component to hover at. null if hover the center.milliseconds - int, time to hover, in millisecondsSAFSExceptionprotected void performDrag()
throws SAFSException
performDrag in class ComponentFunctionSAFSExceptionprotected void dragTo()
throws SAFSException
dragTo in class ComponentFunctionSAFSExceptionprotected void doSetText(java.lang.String libName,
boolean isCharacter,
boolean needVerify)
libName - String, the concrete Component name of class, which calls 'doSetText()' method,
like 'EditBox', 'ComboBox'.isCharacter - boolean, if true, the text'll be treated as plain text, without special key dealing; needVerify - boolean, if true, verify if the text has been correctly entered.(But if the text contains special keys,
i.e. isCharacter is false, there's no verification.)
if false, no verification.protected void setText(java.lang.String libName,
boolean isCharacter,
java.lang.String text)
throws SeleniumPlusException
libName - String, the concrete Component name of class, which calls 'setText()' method,
like 'EditBox', 'ComboBox'.isCharacter - boolean, if true, the text'll be treated as plain text, without special key dealing; text - String, the content to be entered into Component box.SeleniumPlusExceptionCopyright © SAS Institute. All Rights Reserved.