public class SeleniumHook extends JavaHook
The STAF name predefined for this Selenium Engine is "SAFS/Selenium".
As of this writing, this hook uses the ApacheLogUtilities subclass of LogUtilities. This allows us to use additional WebDriver and Selenium Builder/Interpreter features that require an apache.commons.logging.Log Interface.
The TestStepProcessor is the standard org.safs.TestStepProcessor.
The SAFS/Selenium engine does require Selenium-specific implementations of
If the engine is being launched manually or via a batch file or script then the following Java System property must be set on the Java command line:
testpath is the file path to the test configuration INI file,
projectpath is the file path to the project configuration INI file,
driverpath is the file path to the SAFS driver configuration INI file.
At least one INI file path must be specified or the engine will abort due to insufficient configuration information being provided.
The configuration file(s) can provide default target browser information:
The configuration file(s) can optionally also contain:
You can refer to the [SAFS_SELENIUM] setion in SAFSDRIVER Configuration. (See Settings for Selnium2.0 WebDriver)
Assuming everything is properly CLASSPATHed and the config file(s) have proper settings then the Engine can then be launched with:
%SAFSDIR%/jre/bin/java -Dsafs.config.paths=<paths> org.safs.selenium.webdriver.SeleniumHook
JAN 16, 2007 (Carl Nagle) Initial Release.
WebDriverGUIUtilities
,
WDTestRecordHelper
,
SPC
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
SAFS_SELENIUM_SERVER_BOOTUP_READY |
static java.lang.String |
SAFS_USER_EXTENSIONS |
static java.lang.String |
SELENIUM_COMMANDS
Our predefined STAF process name: "SAFS/Selenium"
|
data, DEBUG_MESSAGE, errorText, FAILED_MESSAGE, FAILED_OK_MESSAGE, GENERIC_ERROR, GENERIC_MESSAGE, helper, hookconfig, log, PASSED_MESSAGE, PAUSE_EXECUTION, PAUSE_SWITCH_OFF, PAUSE_SWITCH_ON, process_name, processor, REQUEST_PROCEED_TESTING, REQUEST_USER_STOPPED_SCRIPT_REQUEST, RUNNING_EXECUTION, semaphore_name, SHUTDOWN_RECORD, STAF_ERROR, STEP_EXECUTION, STEP_RETRY_EXECUTION, STEPPING_EXECUTION, STEPPING_RETRY_EXECUTION, trd_name, utils, WARNING_MESSAGE, WARNING_OK_MESSAGE
Constructor and Description |
---|
SeleniumHook()
No-arg constructor for SeleniumHook
Simply calls the super()
|
SeleniumHook(java.lang.String process_name)
Constructor for SeleniumHook
Simply calls super(process_name)
|
SeleniumHook(java.lang.String process_name,
ApacheLogUtilities logs)
Constructor for SeleniumHook
Simply calls super(process_name, logs)
|
SeleniumHook(java.lang.String process_name,
java.lang.String trd_name)
Constructor for SeleniumHook
Simply calls super(process_name, trd_name)
|
SeleniumHook(java.lang.String process_name,
java.lang.String trd_name,
LogUtilities logs)
Constructor for SeleniumHook
Simply calls super(process_name, trd_name, logs)
|
SeleniumHook(java.lang.String process_name,
java.lang.String trd_name,
LogUtilities logs,
TestRecordHelper trd_data,
DDGUIUtilities gui_utils,
ProcessRequest aprocessor)
Advanced Constructor for SeleniumHook.
|
Modifier and Type | Method and Description |
---|---|
Processor |
getEngineDriverCommandProcessor()
Subclasses should instantiate an engine-specific DriverCommands Processor here.
|
protected Processor |
getEngineEngineCommandProcessor()
Subclasses should instantiate an engine-specific EngineCommandProcessor Processor here, if any.
|
protected Processor |
getEngineTestStepProcessor()
Subclasses should instantiate an engine-specific TestStepProcessor Processor here, if any.
|
DDGUIUtilities |
getGUIUtilities()
Use this method to retrieve/create the current/default DDGUIUtilities instance.
|
LogUtilities |
getLogUtilities()
Use this method to retrieve/create the current/default LogUtilities instance.
|
ProcessRequest |
getRequestProcessor()
This method to retrieve/create the current/default ProcessRequest instance.
|
TestRecordHelper |
getTRDData()
Use this method to retrieve/create the current/default TestRecordHelper instance.
|
protected boolean |
hook_shutdown()
Perform final hook shutdown activities.
|
protected void |
instantiateHookConfig()
Instantiate the HookConfig, used to get settings from ConfigureInterface.
|
static void |
main(java.lang.String[] args)
Launches a default instance of the SAFS/Selenium engine.
|
static void |
setSystemProperties(ConfigureInterface config)
Deprecated.
|
void |
start()
Insert this SAFS Engine hook into the STAF system.
|
void |
stopJavaHOOK()
Used by SPC to imitate sending a SHUTDOWN_RECORD to JavaHook
who is waiting in getNextHookTestEvent() for a record-dispatched event. |
allowSystemExit, checkConfiguration, driverShutdownRequest, evaluateRuntimeException, getHelper, getProcessName, getSemaphoreName, getTRDName, initConfigPaths, setGUIUtilities, setHelper, setLogUtilities, setProcessName, setRequestProcessor, setSemaphoreName, setTRDData, setTRDName
public static final java.lang.String SELENIUM_COMMANDS
public static final java.lang.String SAFS_USER_EXTENSIONS
public static java.lang.String SAFS_SELENIUM_SERVER_BOOTUP_READY
public SeleniumHook()
public SeleniumHook(java.lang.String process_name)
process_name
- the ID to use when registering with STAF.
Normally this would be our predefined name "SAFS/Selenium".public SeleniumHook(java.lang.String process_name, ApacheLogUtilities logs)
process_name
- the ID to use when registering with STAF.
Normally this would be our predefined name "SAFS/Selenium".logs
- the LogUtilities to be used by the Engine. Currently we can
use the default org.safs.LogUtilitiesorg.safs.LogUtilites
public SeleniumHook(java.lang.String process_name, java.lang.String trd_name)
process_name
- the ID to use when registering with STAF.
Normally this would be our predefined name "SAFS/Selenium".trd_name
- -- The root name for specific TestRecordData to reference
in STAF. This should typically be STAFHelper.SAFS_HOOK_TRD which is used
by default.STAFHelper.SAFS_HOOK_TRD
public SeleniumHook(java.lang.String process_name, java.lang.String trd_name, LogUtilities logs)
process_name
- the ID to use when registering with STAF.
Normally this would be our predefined name "SAFS/Selenium".trd_name
- -- The root name for specific TestRecordData to reference
in STAF. This should typically be STAFHelper.SAFS_HOOK_TRD which is used
by default.logs
- the LogUtilities to be used by the Engine. Currently we can
use the default org.safs.LogUtilitiesSTAFHelper.SAFS_HOOK_TRD
,
org.safs.LogUtilites
public SeleniumHook(java.lang.String process_name, java.lang.String trd_name, LogUtilities logs, TestRecordHelper trd_data, DDGUIUtilities gui_utils, ProcessRequest aprocessor)
process_name
- the ID to use when registering with STAF.
Normally this would be our predefined name "SAFS/Selenium".trd_name
- -- The root name for specific TestRecordData to reference
in STAF. This should typically be STAFHelper.SAFS_HOOK_TRD which is used
by default.logs
- the LogUtilities to be used by the Engine. Currently we can
use the default org.safs.LogUtilitiestrd_data
- -- ATestRecordHelper to hold TestRecordData.
The Selenium engine expects an instance of ATestRecordHelper.gui_utils
- -- WebDriverGUIUtilities the hook will use for handling components.
The Selenium engine expects an instance of WebDriverGUIUtilities.aprocessor
- -- ProcessRequest object the hook will use for routing records.
The Selenium engine uses the standard ProcessRequest class and a standard TestStepProcessor.STAFHelper.SAFS_HOOK_TRD
,
org.safs.LogUtilites
,
WDTestRecordHelper
,
WebDriverGUIUtilities
,
ProcessRequest
,
TestStepProcessor
public TestRecordHelper getTRDData()
Note that there is a known circular execution between getTRDData and getGUIUtilities if neither was previously set. Each routine calls the other which may result in a second call to the other. This has not been a problem.
getTRDData
in class JavaHook
WDTestRecordHelper
,
JavaHook.getHelper()
,
getGUIUtilities()
,
JavaHook.getTRDData()
public DDGUIUtilities getGUIUtilities()
The WebDriverGUIUtilities talk with our embedded proxies over a SAFS RMI bridge. The local RMI server (AServerImpl) is instanced if not already set.
Note that there is a known circular execution between getTRDData and getGUIUtilities if neither was previously set. Each routine calls the other which may result in a second call to the other. This has not been a problem.
getGUIUtilities
in class JavaHook
JavaHook.getGUIUtilities()
,
JavaHook.getHelper()
,
getTRDData()
,
WebDriverGUIUtilities
,
SServerImpl
public LogUtilities getLogUtilities()
getLogUtilities
in class JavaHook
JavaHook.getLogUtilities()
,
LogUtilities
public Processor getEngineDriverCommandProcessor()
protected Processor getEngineTestStepProcessor()
protected Processor getEngineEngineCommandProcessor()
public ProcessRequest getRequestProcessor()
If the ProcessRequest has not been set this routine will instance a new org.safs.ProcessRequest and populate it with the LogUtilities via getLogUtilities(), a TestRecordHelper via getTRDData(), and all Processors.
Any newly created ProcessRequest instance will invoke:
and attempt to initialize all Processors with the getLogUtilities() and getTRDData() calls and then chain all Processors appropriately.
Note that the first call to getTRDData() may force the instantiation of the default TestRecordHelper for the subclass, if one has not already been set.
The first call to getLogUtilities() may also force the instantiation of the default LogUtilities, if one has not already been set.
getRequestProcessor
in class JavaHook
TestRecordHelper
,
getTRDData()
,
getLogUtilities()
,
org.safs.LogUtilities
,
getEngineDriverCommandProcessor()
,
getEngineTestStepProcessor()
,
getEngineEngineCommandProcessor()
@Deprecated public static void setSystemProperties(ConfigureInterface config)
SeleniumHookConfig.setSystemProperties(ConfigureInterface)
instead.SelectBrowser.SYSTEM_PROPERTY_BROWSER_NAME
SelectBrowser.SYSTEM_PROPERTY_BROWSER_REMOTE
SelectBrowser.SYSTEM_PROPERTY_SELENIUM_HOST
SelectBrowser.SYSTEM_PROPERTY_SELENIUM_PORT
SelectBrowser.SYSTEM_PROPERTY_PROXY_HOST
SelectBrowser.SYSTEM_PROPERTY_PROXY_PORT
SelectBrowser.SYSTEM_PROPERTY_PROXY_BYPASS
DriverConstant.SeleniumConfigConstant.SELENIUMSERVER_JVM_Xmx
DriverConstant.SeleniumConfigConstant.SELENIUMSERVER_JVM_Xms
DriverConstant.SeleniumConfigConstant.SELENIUMSERVER_JVM_OPTIONS
DriverConstant.SeleniumConfigConstant.SELENIUMSERVER_JVM
config
- ConfigureInterface, containing the configuration initial parametersprotected void instantiateHookConfig()
JavaHook
JavaHook.initConfigPaths()
. instantiateHookConfig
in class JavaHook
JavaHook.initConfigPaths()
public void start()
JavaHook
public void stopJavaHOOK()
protected boolean hook_shutdown()
hook_shutdown
in class JavaHook
JavaHook.hook_shutdown()
,
JavaHook.allowSystemExit()
public static void main(java.lang.String[] args)
Assuming everything is properly CLASSPATHed, the default SAFS/Selenium Engine can be launched simply with:
args
- --Typically, there are no Class-specific command-line args.
These are different than the JVM Arguments passed to the JVM invocation preceding the classname on the command-line.
Copyright © SAS Institute. All Rights Reserved.