public class SPJVMInjector extends SeleniumPlus
When properly invoked via the inject() Method an instance of SeleniumPlus is launched in a separate daemon Thread. That instance can be used directly along with all the traditional classes and methods available via SeleniumPlus.
When the application is expected to shutdown--or whenever the SeleniumPlus instance is no longer needed-- the caller should invoke the shutdown() method to allow the SeleniumPlus daemon Thread to gracefully shutdown.
Configuring your Java application to use SeleniumPlus:
Example: "MyInjector.INI"
[SAFS_DRIVER]
DriverRoot="%SELENIUM_PLUS%\extra\automation"
[SAFS_PROJECT]
ProjectRoot="C:\Automation\MySePlusProject"
[SAFS_TEST]
TestName="MyInjectorTest"
CycleLogMode="TEXTLOG CONSOLELOG XMLLOG"
[STAF]
EmbedDebug="MyInjectorDebug.log"
Having configured your Java project/application and INI files, a sample invocation of your app using SeleniumPlus might look like:
set CLASSPATH=<YourJarFiles>;<SeleniumPlusJarFiles>
java -cp %CLASSPATH% -Dsafs.project.config=C:/Automation/MySePlusProject/MyInjector.INI MyJavaApplicationClass
And the code inside your Java app to instantiate and then use SeleniumPlus:
< your application code >
SPJVMInjector seleniumplus = SPJVMInjector.inject(new String[0]);
< do more stuff with or without SeleniumPlus >
seleniumplus.StartWebBrowser("https://www.google.com", "Google", "chrome");
< do more stuff until it's time to shutdown SeleniumPlus >
seleniumplus.shutdown();
< allow your application to exit >
FEB 11, 2019 (Carl Nagle) Initial Release
inject(String[])
,
shutdown()
SeleniumPlus.Assert, SeleniumPlus.CheckBox, SeleniumPlus.ComboBox, SeleniumPlus.Component, SeleniumPlus.Counters, SeleniumPlus.EditBox, SeleniumPlus.Files, SeleniumPlus.ListView, SeleniumPlus.Logging, SeleniumPlus.Menu, SeleniumPlus.Misc, SeleniumPlus.Rest, SeleniumPlus.ScrollBar, SeleniumPlus.Strings, SeleniumPlus.TabControl, SeleniumPlus.Tree, SeleniumPlus.WDTimeOut, SeleniumPlus.Window
SAFSPlus.DriverCommand
Modifier and Type | Field and Description |
---|---|
(package private) static java.lang.String |
BROWSER_ID_ROOT |
(package private) static java.lang.String |
PRODUCT_DESCRIPTION |
(package private) static java.lang.String |
PRODUCT_NAME |
(package private) static java.lang.String |
PRODUCT_VERSION |
(package private) WebDriverGUIUtilities |
utils
Provide access to WebDriverGUIUtilities used by the running instance.
|
Runner, TEMP_SELENIUM_PLUS_RS_VAR
_autorun, _autorunClassProvided, _injectDataAwareness, _isInjected, _isSPC, _junit, allowExit, ARG_AUTORUN, ARG_AUTORUN_CLASS, ARG_JUNIT, ARG_SAFSVAR, DefaultRunner, exitCode, normalizeTextForInput, prevResults, RELATIVE_TO_PARENT, RELATIVE_TO_SCREEN, springApplicationContext
Constructor and Description |
---|
SPJVMInjector()
Used internally.
|
SPJVMInjector(WebDriverGUIUtilities utils)
Used internally.
|
Modifier and Type | Method and Description |
---|---|
WebDriverGUIUtilities |
getUtils()
Only viable AFTER the call to inject() has produced a running instance of SeleniumPlus.
|
static SPJVMInjector |
inject(java.lang.String[] args)
Primary user entry point.
Use this to inject SeleniumPlus into your running JVM. SeleniumPlus will be launched in a separate daemon Thread and the instance will be returned to the caller. |
void |
runTest()
Used internally.
|
void |
shutdown()
Clears the "running" flag signaling the separate SeleniumPlus Thread to shutdown.
The routine provides a short delay before returning giving SeleniumPlus some time to shutdown. |
AbortTest, AltLeftDrag, Click, ClickUnverified, CtrlAltLeftDrag, CtrlClick, CtrlLeftDrag, CtrlRightClick, CtrlShiftLeftDrag, deduceFilterAreas, DoubleClick, executeAsyncScript, ExecuteScript, executeScript, GetGUIImage, GetGUIImage, getObject, getObject, GetVariableValue, Highlight, HoverScreenLocation, LeftDrag, main, Pause, PrintTestCaseSummary, PrintTestSuiteSummary, RightClick, RightDrag, SetVariableValue, ShiftClick, ShiftLeftDrag, StartTestCase, StartTestSuite, StartWebBrowser, StopTestCase, StopWebBrowser, SwitchWebBrowser, TypeChars, TypeEncryption, TypeKeys, VerifyBinaryFileToFile, VerifyFileToFile, VerifyGUIImageToFile, VerifyTextFileToFile, VerifyValueContains, VerifyValueContainsIgnoreCase, VerifyValueDoesNotContain, VerifyValues, VerifyValuesIgnoreCase, VerifyValuesNotEqual, WaitForGUI, WebDriver
_getMappedValue, _getVariable, _processArgs, _resolveDDVariables, _setVariable, action, actionGUILess, autorun, back, combineParams, command, debug, error, forward, getAllowExit, getExitCode, getRunner, iDriver, normalizeTextForInput, quote, quotePath, replaceSeparator, setAllowExit, setExitCode, setLeveledTest, setNormalizeTextForInput, setRunner, testStatusCode
WebDriverGUIUtilities utils
getUtils()
static final java.lang.String BROWSER_ID_ROOT
static final java.lang.String PRODUCT_NAME
static final java.lang.String PRODUCT_VERSION
static final java.lang.String PRODUCT_DESCRIPTION
public SPJVMInjector()
public SPJVMInjector(WebDriverGUIUtilities utils)
utils
- public WebDriverGUIUtilities getUtils()
public void runTest() throws java.lang.Throwable
runTest
in class SAFSPlus
java.lang.Throwable
inject(String[])
,
shutdown()
public static SPJVMInjector inject(java.lang.String[] args)
args
- String[] as might be desired to initialize SeleniumPlus.shutdown()
public void shutdown()
Copyright © SAS Institute. All Rights Reserved.