public class WDLibrary extends SearchObject
Modifier and Type | Class and Description |
---|---|
static class |
WDLibrary.RBT
This class represents a Robot, which can do work locally (thru local org.safs.robot.Robot) or remotely (thru a RMI agent).
|
static class |
WDLibrary.WD_XMLHttpRequest
Implements
XMLHttpRequest , through WDLibrary to execute javascript
JavaScriptFunctions.sendHttpRequest(Map) to handle HTTP Request. |
SearchObject.BrowserWindow, SearchObject.DefaultJSEventListener, SearchObject.DOJO, SearchObject.FrameElement, SearchObject.GenericJSEventListener, SearchObject.HTML, SearchObject.SAP, SearchObject.SwitchFramesResults
Modifier and Type | Field and Description |
---|---|
static WDLibrary.WD_XMLHttpRequest |
AJAX
An instance of WD_XMLHttpRequest, used to send HTTP request.
|
static java.lang.String |
BROWSER_DRIVER_IMPLEMENTATION_JSON |
static java.lang.String |
BROWSER_DRIVER_IMPLEMENTATION_W3C |
protected static boolean |
debug |
static java.lang.String |
DEFAULT_BROWSER_DRIVER_IMPLEMENTATION |
static int |
DEFAULT_TIMEOUT_WAIT_ALERT
The timeout in seconds to wait for the alert's presence.
The default value is 2 seconds. |
static int |
DEFAULT_TIMEOUT_WAIT_CLICK
2 seconds to wait for a click action finished on page.
|
static int |
DEFAULT_TIMEOUT_WAIT_ROBOT_CLICK
10 seconds to wait for a Robot click action finished on page.
|
static boolean |
DEFAUT_AUTOSCROLL
'true', the default value for scrolling the web-element into view automatically before performing click ation on it.
|
static boolean |
enableClickListenerFailures
Default true.
|
static boolean |
enableForceScroll
The indicator to tell SeleniumPlus to scroll an item (an item inside a scroll-able container) to make it visible.
It is recommended to turn it off if the force-auto-scroll is not needed anymore, it may cause the page jump up and down. The default value is false. |
static boolean |
isW3Cimplementation
If the browser's driver is implemented by W3C protocol
|
protected static InputKeysParser |
keysparser |
static int |
MOUSE_BUTTON_LEFT
InputEvent.BUTTON1_MASK |
static int |
MOUSE_BUTTON_MIDDLE
InputEvent.BUTTON2_MASK |
static int |
MOUSE_BUTTON_RIGHT
InputEvent.BUTTON3_MASK |
static int |
TIMEOUT_NOWAIT
0, means no waiting.
|
static int |
TIMEOUT_WAIT_FOREVER
-1, means wait for ever
|
static int |
timeoutCheckAlertForClick
time (in seconds) to check if an Alert is present on page before clicking.
|
static int |
timeoutWaitAlert
time (in seconds) to wait for an Alert appear on page.
|
static int |
timeoutWaitClick
time (in seconds) to wait for a click action finished on page.
|
static int |
timeoutWaitRobotClick
time (in seconds) to wait for a Robot click action finished on page.
|
assignSeparator, checkCurrentFrameContext, childSeparator, CSS_CLASS_DOJO_DIJIT_PREFIX, CSS_CLASS_SAP_PREFIX, CSS_CLASS_SEPARATOR, CSS_SELECTOR_BY_CLASSNAME, CSS_SELECTOR_BY_ID, DEFAULT_IGNORE_CASE, DEFAULT_JS_EXECUTION_DELAY, DEFAULT_JS_TIMEOUT, DEFAULT_PARTIAL_MATCH, DOMAIN_DOJO, DOMAIN_HTML, DOMAIN_SAP, escapeChar, IGNORED_NONUI_TAGS, INVALID_INDEX, jsEventListenerMap, jsEventListenerWaitingThreadMap, lastBrowserWindow, lastFrame, lastJS, lastUsedWD, lastVisitedURL, MATCHED_ONE_TIME, MATCHED_ZERO_TIMES, propertySeparator, qulifierSeparator, SEARCH_CRITERIA_CLASS, SEARCH_CRITERIA_CLASS_CONTAINS, SEARCH_CRITERIA_CONTAINS_SUFFIX, SEARCH_CRITERIA_CSS, SEARCH_CRITERIA_FRAMEID, SEARCH_CRITERIA_FRAMEINDEX, SEARCH_CRITERIA_FRAMENAME, SEARCH_CRITERIA_FRAMEXPATH, SEARCH_CRITERIA_ID, SEARCH_CRITERIA_IFRAMEID, SEARCH_CRITERIA_INDEX, SEARCH_CRITERIA_ITEMINDEX, SEARCH_CRITERIA_LINK, SEARCH_CRITERIA_NAME, SEARCH_CRITERIA_PARTIALLINK, SEARCH_CRITERIA_PATH, SEARCH_CRITERIA_PROPERTY, SEARCH_CRITERIA_PROPERTY_CONTAINS, SEARCH_CRITERIA_TAG, SEARCH_CRITERIA_TEXT, SEARCH_CRITERIA_TITLE, SEARCH_CRITERIA_TYPE, SEARCH_CRITERIA_XPATH, TAG_FRAME, TAG_IFRAME, TEXT_VALUE_ATTRIBUTES, TOP_DOCUMENT_ID, XPATH_CHILD_SEPARATOR
Constructor and Description |
---|
WDLibrary() |
Modifier and Type | Method and Description |
---|---|
static void |
alignToBottom(org.openqa.selenium.WebElement element)
Align the bottom of webelement to the bottom of browser.
|
static void |
alignToTop(org.openqa.selenium.WebElement element)
Align the top of webelement to the top of browser.
|
static void |
altLeftDrag(org.openqa.selenium.WebElement we,
java.awt.Point start,
java.awt.Point end)
Perform a left-drag from start point to end point relative to webelement (LeftUp corner)
with the "ALT" key pressed during the drag.
|
static java.awt.image.BufferedImage |
captureBrowserArea(java.awt.Rectangle rectangle)
Capture the image on browser according to the rectangle relative to the browser.
|
static void |
captureScreen(java.lang.String image)
Capture entire current HTML page
|
static void |
captureScreen(org.openqa.selenium.WebElement we,
java.lang.String imgName,
java.lang.String fileformat)
Capture component image
|
static void |
checkKnownIssue(java.lang.String keyword)
Check some known issue for a certain keyword.
NOTE: We should call startBrowser(String, String, String, int, boolean, Map) before calling this method. |
static void |
clearClipboard()
Clear the clipboard on local machine or on machine where the RMI server is running.
|
static void |
click(org.openqa.selenium.WebElement clickable,
org.openqa.selenium.Keys specialKey,
java.lang.String... optional)
Click(Mouse Left Button) the WebElement at center with a special key pressed.
|
static void |
click(org.openqa.selenium.WebElement clickable,
java.awt.Point offset,
org.openqa.selenium.Keys specialKey,
int mouseButtonNumber,
java.lang.String... optional)
Click the WebElement at a certain coordination with a special key pressed.
Firstly it will try to get webelement's location and use Robot to click. |
static void |
click(org.openqa.selenium.WebElement clickable,
java.awt.Point offset,
java.lang.String... optional)
Click(Mouse Left Button) the WebElement at a certain coordination.
|
static void |
click(org.openqa.selenium.WebElement clickable,
java.lang.String... optional)
Click(Mouse Left Button) - Click on WebElement or WebDriver object at the center
|
static boolean |
clickUnverified(org.openqa.selenium.WebElement component,
java.awt.Point offset,
java.lang.String... optional)
Click a component with an offset.
|
static void |
closeAlert(boolean accept,
java.lang.String... optionals)
Close the Alert-Modal-Dialog associated with a certain browser identified by ID.
It will get the cached webdriver according to the browser's id, and close the 'alert' through that webdriver. Note:This API will NOT change the current WebDriver. |
static void |
closeBrowser()
Close the Browser/WebDriver associated with the last WebElement accessed.
|
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.
|
(package private) static java.lang.CharSequence |
convertToCharacter(RobotKeyEvent event)
Convert a SAFS RobotKeyEvent to a standard CharSequence character.
|
static org.openqa.selenium.Keys |
convertToKeys(int keycode)
Convert a Java KEYCODE to a Selenium WebDriver Keys Enum
|
static org.openqa.selenium.Keys |
convertToKeys(RobotKeyEvent event)
Convert a SAFS RobotKeyEvent to a Selenium WebDriver Keys Enum
|
static void |
ctrlAltLeftDrag(org.openqa.selenium.WebElement we,
java.awt.Point start,
java.awt.Point end)
Perform a left-drag from start point to end point relative to webelement (LeftUp corner)
with the "CONTROL" and "ALT" key pressed during the drag.
|
static void |
ctrlLeftDrag(org.openqa.selenium.WebElement we,
java.awt.Point start,
java.awt.Point end)
Perform a left-drag from start point to end point relative to webelement (LeftUp corner)
with the "CONTROL" key pressed during the drag.
|
static void |
ctrlShiftLeftDrag(org.openqa.selenium.WebElement we,
java.awt.Point start,
java.awt.Point end)
Perform a left-drag from start point to end point relative to webelement (LeftUp corner)
with the "CONTROL" and "SHIFT" key pressed during the drag.
|
static boolean |
deleteNetworkConditions()
NOTE: This only works for Chrome browser started with option 'setNetworkConditions'.
|
static void |
doubleClick(org.openqa.selenium.WebElement clickable,
org.openqa.selenium.Keys specialKey,
java.lang.String... optional)
Double-Click(Mouse Left Button) the WebElement at the center with a special key pressed.
|
static void |
doubleClick(org.openqa.selenium.WebElement clickable,
java.awt.Point offset,
org.openqa.selenium.Keys specialKey,
int mouseButtonNumber,
java.lang.String... optional)
Double-Click the WebElement at a certain coordination with a special key pressed.
Firstly it will try to get webelement's location and use Robot to double click. |
static void |
doubleClick(org.openqa.selenium.WebElement clickable,
java.awt.Point offset,
java.lang.String... optional)
Double-Click(Mouse Left Button) the WebElement at a certain coordination.
|
static void |
doubleClick(org.openqa.selenium.WebElement clickable,
java.lang.String... optional)
Double-Click(Mouse Left Button) the WebElement at the center.
|
static java.awt.Point[] |
dragTo(org.openqa.selenium.WebElement fromElem,
org.openqa.selenium.WebElement toElem,
java.lang.String[] offsets,
int dndReleaseDelay) |
static void |
fireMouseEvent(MouseEvent event)
Attempts to fire (dispatchEvent) a MouseEvent.
|
static boolean |
focus(org.openqa.selenium.WebElement element)
Attempt to SetFocus on the WebElement.
|
static java.lang.String |
getBrowserName() |
static java.lang.String |
getBrowserName(org.openqa.selenium.WebDriver driver) |
static java.lang.String |
getBrowserVersion() |
static org.openqa.selenium.WebDriver |
getBrowserWithID(java.lang.String id)
Retrieves the WebDriver/Browser with the given id.
|
static org.openqa.selenium.WebDriver |
getBrowserWithTitle(java.lang.String title)
Retrieves the WebDriver/Browser with the given title.
|
static java.lang.Object |
getClipboard(java.awt.datatransfer.DataFlavor dataFlavor)
Get the content from the clipboard on local machine or on machine where the RMI server is running.
|
static int |
getDelayBetweenKeystrokes()
Gets the current delay in milliseconds between Robot keystrokes for both local and remote servers.
|
static java.lang.String |
getDriverVersion() |
static java.awt.Point |
getElementOffsetScreenLocation(org.openqa.selenium.WebElement element,
java.lang.String offsetX,
java.lang.String offsetY)
Given the element, and the (offsetX, offsetY) relative to element.
|
static java.awt.Point |
getLocation(org.openqa.selenium.WebElement webelement)
Get the web-element's location relative to the browser.
|
static java.awt.Point |
getLocation(org.openqa.selenium.WebElement webelement,
boolean useOnPageFirstly)
Get the web-element's location relative to the browser client area.
|
static java.lang.Object |
getNetworkConditions()
NOTE: This only works for Chrome browser started with option 'setNetworkConditions'.
|
static java.lang.String |
getPlatform() |
static java.awt.Rectangle |
getRectangleOnScreen(org.openqa.selenium.WebElement we)
Get the screen rectangle for a WebElement object.
|
static java.awt.Point |
getScreenLocation(org.openqa.selenium.WebElement webelement)
Get the absolute coordination on the screen of the webelement object.
Hope Selenium will give this function one day! |
static com.sebuilder.interpreter.Script |
getSeleniumBuilderScript(java.lang.String path)
Load a SeBuilder JSON Script from the provided path so it can be started or run.
|
static int |
getTimeoutCheckAlertForClick() |
static com.sebuilder.interpreter.webdriverfactory.WebDriverFactory |
getWebDriverAsWebDriverFactory() |
static void |
handleBasicAuthentication(java.lang.String user,
java.lang.String password,
int delayInSecond)
This method will input 'user', 'password' and '{Enter}' into a Basic Authentication dialog.
But the input action will be delayed amount of time, which is specified by parameter 'delayInSecond'. Note: It is supposed that the focus is on the 'user name' input box. |
static void |
highlightElement(org.openqa.selenium.WebElement element)
Deprecated.
it is replaced by
SearchObject.highlight(WebElement) . |
static void |
inputChars(org.openqa.selenium.WebElement we,
java.lang.String keystrokes)
Does NOT clear any existing text in the control, but does attempt to insure the window/control has focus.
|
static void |
inputKeys(org.openqa.selenium.WebElement we,
java.lang.String keystrokes)
Does NOT clear any existing text in the control, but does attempt to insure the window/control has focus.
|
static void |
inputKeysSAFS2Selenium(org.openqa.selenium.WebElement we,
java.lang.String keystrokes)
Does NOT clear any existing text in the control, but does attempt to insure the window/control has focus.
|
static boolean |
inside(org.openqa.selenium.WebElement element,
java.awt.Point p)
Check if the point is inside of the boundary of WebElement.
|
static boolean |
isAlertPresent(java.lang.String... optionals)
Test the presence of Alert-Modal-Dialog associated with a certain browser identified by ID.
It will get the cached webdriver according to the browser's id, and get the 'alert' through that webdriver. Note:This API will NOT change the current WebDriver. |
static boolean |
isChrome(org.openqa.selenium.WebDriver driver) |
static boolean |
isFireFox(org.openqa.selenium.WebDriver driver) |
static boolean |
isHtmlUnit(org.openqa.selenium.WebDriver driver) |
static boolean |
isInternetExplorer(org.openqa.selenium.WebDriver driver) |
static boolean |
isLeftMouseButton(int buttonNumber) |
static boolean |
isLocationInBounds(org.openqa.selenium.Point p,
org.openqa.selenium.Dimension bounds)
Check if the point p locates in the Dimension.
|
static boolean |
isMiddleMouseButton(int buttonNumber) |
static boolean |
isRightMouseButton(int buttonNumber) |
static boolean |
isSafari(org.openqa.selenium.WebDriver driver) |
static boolean |
isShowOnPage(org.openqa.selenium.WebElement element) |
static boolean |
isShowOnPage(org.openqa.selenium.WebElement element,
org.openqa.selenium.Point offset)
To check if a certain point of web-element is shown on the page.
If the point is not given or it is out of boundary of web-element, method will check if the web-element is fully shown on the page. |
static void |
keyDown(org.openqa.selenium.Keys keycode)
Press down a Key by Selenium's Actions API.
|
static void |
keyPress(int keycode)
Press down a Key.
|
static void |
keyRelease(int keycode)
Release a Key.
|
static void |
keyUp(org.openqa.selenium.Keys keycode)
Release a Key by Selenium's Actions API.
|
static java.util.List<GenericProcessMonitor.ProcessInfo> |
killBrowserDriver(java.lang.String host,
java.lang.String browserName)
Deprecated.
Please use
UtilsIndependent.killBrowserDriver(String, String) instead. |
static java.util.List<GenericProcessMonitor.ProcessInfo> |
killChromeDriver(java.lang.String host)
Deprecated.
Please use
UtilsIndependent.killChromeDriver(String) instead. |
static java.util.List<GenericProcessMonitor.ProcessInfo> |
killExtraProcess(java.lang.String host,
java.lang.String processName)
Deprecated.
Please use UtilsIndependent instead.
|
static java.util.List<GenericProcessMonitor.ProcessInfo> |
killGeckoDriver(java.lang.String host)
Deprecated.
Please use
UtilsIndependent.killGeckoDriver(String) instead. |
static java.util.List<GenericProcessMonitor.ProcessInfo> |
killIEDriverServer(java.lang.String host)
Deprecated.
Please use
UtilsIndependent.killIEDriverServer(String) instead. |
static java.util.List<GenericProcessMonitor.ProcessInfo> |
killMicrosoftWebDriver(java.lang.String host)
Deprecated.
Please use
UtilsIndependent.killMicrosoftWebDriver(String) instead. |
static java.util.List<GenericProcessMonitor.ProcessInfo> |
killMSEdgeDriver(java.lang.String host)
Deprecated.
Please use
UtilsIndependent.killMSEdgeDriver(String) instead. |
static java.util.List<GenericProcessMonitor.ProcessInfo> |
killProcess(java.lang.String host,
java.lang.String processName,
java.lang.String commandline)
Deprecated.
Please use
UtilsIndependent.killProcess(String, String, String) instead. |
static java.util.List<GenericProcessMonitor.ProcessInfo> |
killProcess(java.lang.String host,
java.lang.String processName,
java.lang.String commandline,
java.lang.String notCommandline)
Deprecated.
Please use
UtilsIndependent.killProcess(String, String, String, String) instead. |
static void |
leftDrag(org.openqa.selenium.WebElement we,
java.awt.Point start,
java.awt.Point end)
Perform a left-drag from start point to end point relative to webelement (LeftUp corner).
|
static void |
loadModHeaderProfile(org.openqa.selenium.WebDriver driver,
java.lang.Object modheaderProfile)
Prerequisite: the extension "ModHeader" should have been installed into the chrome browser.
This method is going to load ModHeader's profile. Currently it opens the ModHeader's setting page to load the profile. In the furture we probably find a better way to set profile. |
static void |
main(java.lang.String[] args)
Before running this method, please read java doc of
test_ajax_call(String) |
static void |
maximizeBrowserWindow()
Maximize current browser window
|
static void |
minimizeBrowserWindow()
This implementation does NOT really minimize the window, it is a workaround.
Note: set the size to (0,0) can NOT minimize the window. |
static void |
mouseHover(org.openqa.selenium.WebElement we,
java.awt.Point point,
int millisStay) |
static void |
mouseWheel(int wheelAmt)
Scroll the mouse wheel.
|
static void |
resizeBrowserWindow(int width,
int height)
Resize current browser window
|
static void |
rightclick(org.openqa.selenium.WebElement clickable,
org.openqa.selenium.Keys specialKey,
java.lang.String... optional)
Click(Mouse Right Button) the WebElement at center with a special key pressed.
|
static void |
rightclick(org.openqa.selenium.WebElement clickable,
java.awt.Point offset,
java.lang.String... optional)
Click(Mouse Right Button) the WebElement at a certain coordination.
|
static void |
rightclick(org.openqa.selenium.WebElement clickable,
java.lang.String... optional)
Click(Mouse Right Button) - Click on WebElement or WebDriver object at the center
|
static void |
rightDrag(org.openqa.selenium.WebElement we,
java.awt.Point start,
java.awt.Point end)
Perform a right-drag from start point to end point relative to webelement (LeftUp corner).
|
static boolean |
runSeleniumBuilderScript(java.lang.String path,
org.apache.commons.logging.Log log,
boolean allowClose)
Run a SeBuilder JSON Script explicitly using the existing WebDriver instance.
|
static boolean |
runSeleniumBuilderScript(java.lang.String path,
org.apache.commons.logging.Log log,
com.sebuilder.interpreter.webdriverfactory.WebDriverFactory driverFactory,
java.util.HashMap<java.lang.String,java.lang.String> webDriverConfig,
java.util.Map<java.lang.String,java.lang.String> initialVars,
boolean allowClose)
Run a SeBuilder JSON Script.
|
static void |
scrollBrowserWindowBy(int x,
int y,
org.openqa.selenium.WebElement element)
scroll browser window by x and/or y number of pixels.
|
static void |
scrollBrowserWindowTo(int x,
int y,
org.openqa.selenium.WebElement element)
scroll browser window to x and/or y scroll position.
|
static void |
setClipboard(java.lang.String content)
Set content to the clipboard on local machine or on machine where the RMI server is running.
|
static void |
setDelayBetweenKeystrokes(int millisDelay)
Sets a delay in milliseconds between Robot keystrokes for both local and remote servers.
|
static boolean |
setNetworkConditions(java.util.Map<?,?> networkConditions)
NOTE: This only works for Chrome browser started with option 'setNetworkConditions'.
|
static boolean |
setNetworkConditions(java.lang.String networkConditions)
NOTE: This only works for Chrome browser started with option 'setNetworkConditions'.
|
static boolean |
setNetworkConditions(org.openqa.selenium.WebDriver webdriver,
java.lang.String networkConditions)
NOTE: This only works for Chrome browser started with option 'setNetworkConditions'.
|
static void |
setPositionBrowserWindow(int x,
int y)
Set position of current browser window.
|
static void |
setTimeoutCheckAlertForClick(int timeoutCheckAlertForClick) |
static void |
setWaitReaction(boolean wait)
Set if wait for reaction to "input keys/chars" for both local and remote servers.
|
static void |
setWaitReaction(boolean wait,
int tokenLength,
int dealyForToken,
int dealy)
Set if wait for reaction to "input keys/chars" for both local and remote servers.
|
static void |
shiftLeftDrag(org.openqa.selenium.WebElement we,
java.awt.Point start,
java.awt.Point end)
Perform a left-drag from start point to end point relative to webelement (LeftUp corner)
with the "SHIFT" key pressed during the drag.
|
static boolean |
showOnPage(org.openqa.selenium.WebElement element,
java.lang.String... optional)
Try to show the webelement on the browser's page.
Within this method, we try several ways to scroll the element into view: If the parameter 'verify' is true then we will stop try other ways if the element is already shown on the page. Else if 'verify' parameter is false then we will try all ways to show the element: our isShowOnPage() is not so reliable all the time. |
static void |
startBrowser(java.lang.String BrowserName,
java.lang.String Url,
java.lang.String Id,
int timeout,
boolean isRemote)
Start browser
|
static void |
startBrowser(java.lang.String browserName,
java.lang.String Url,
java.lang.String Id,
int timeout,
boolean isRemote,
java.util.Map<java.lang.String,java.lang.Object> extraParameters)
Start browser
|
static void |
stopBrowser(java.lang.String ID)
Close browser (close all windows associated) indicated by ID.
|
static void |
stopSeleniumServer(java.lang.String host)
Clean up the SeleniumSever and browser-drivers left behind the SeleniumPlus testing.
|
(package private) static int |
toJavaKeyCode(org.openqa.selenium.Keys key) |
static java.awt.Rectangle |
toJavaRectangle(org.openqa.selenium.Rectangle rect) |
static boolean |
windowSetFocus(java.lang.String titleRegExp)
Set a specific Window matching the provided title to be the foreground window.
|
static boolean |
windowSetFocus(org.openqa.selenium.WebDriver adriver)
Attempt to SetFocus on the topmost window for the provided WebDriver.
|
static boolean |
windowSetFocus(org.openqa.selenium.WebElement element)
Attempt to SetFocus on the topmost window containing the WebElement.
|
_getCurrentFrame, _switchByFrameElement, _switchFrames, addJavaScriptEventListener, addWebDriver, back, checkCSSClassName, checkNotNull, checkWindowRS, clearHighlight, containFrameRS, containTagRS, executeAsyncScript, executeJavaScriptOnWebElement, executeScript, executeScript, findElement, findElements, forward, generateFullGenericXPath, generateGenericXPath, generateSAFSFrameRecognition, generateSAFSFrameRecognition, generateUniqueName, getAllWindowTitles, getBoolean, getBypassFramesReset, getBypassRobot, getCssSelector, getCssValues, getCurrentFrame, getCurrentFrameID, getCurrentFrameName, getDescription, getFirstQualifierPair, getFrames, getFrameTree, getFrameWebElement, getIDForWebDriver, getJS, getJsExecutionDelay, getJsTimeout, getLastBrowserWindow, getLastFrame, getLastVisitedURL, getMatchedObject, getMatchedObjects, getNthWebElement, getObject, getObject, getObjectByMultiAttributes, getObjectByQualifier, getObjectByText, getObjectByTitle, getObjectByXpathAndQualifiers, getObjectForDomain, getObjects, getObjectsByMultiAttributes, getObjectsByQualifier, getObjectsByText, getObjectsByTitle, getObjectsByXpathAndQualifiers, getObjectsForDomain, getParentWebElement, getProperties, getProperty, getSubItem, getTagQualifierValue, getText, getThrowableMessages, getValue, getWebDriver, getWebDriver, getWebDriverContainsTitle, getWebDriverWithTitle, getWebElement, getWebElementProperty, getXpathCondition, highlight, highlight, highlightThenClear, initializeBrowserWindow, isDisplayed, isDojoDomain, isFrameRS, isFrameWebElement, isIgnoredNonUITag, isNeedFreshWindow, isSAPDomain, isStale, isValidBrowserID, isValidFrameRS, isVisible, js_cleanError, js_executeWithTimeout, js_getErrorCode, js_getErrorObject, js_getGlobalBoolVariable, js_getGlobalVariable, js_initError, js_initialize, js_setErrorCode, js_setErrorObject, js_setGlobalBoolVariable, js_setGlobalVariable, pageHasChanged, reconnectLastWebDriver, refreshJSExecutor, removeJavaScriptEventListener, removeWebDriver, resetLastFrame, resetXPathObjectCache, retrieveFrameRS, setBypassFramesReset, setBypassRobot, setJsExecutionDelay, setJsTimeout, setLastFrame, setNeedFreshWindow, shutdown, switchFrame, switchFrameAsLastFrame, switchFrames, switchToDefaultContent, switchToFrame, switchToParentFrame, switchWindow, switchWindow, switchWindow, switchWindow, traverseFrameTree, useBrowser
public static final int MOUSE_BUTTON_LEFT
InputEvent.BUTTON1_MASK
public static final int MOUSE_BUTTON_MIDDLE
InputEvent.BUTTON2_MASK
public static final int MOUSE_BUTTON_RIGHT
InputEvent.BUTTON3_MASK
protected static boolean debug
public static final int DEFAULT_TIMEOUT_WAIT_CLICK
public static final int DEFAULT_TIMEOUT_WAIT_ALERT
public static final int TIMEOUT_NOWAIT
public static final int TIMEOUT_WAIT_FOREVER
public static final int DEFAULT_TIMEOUT_WAIT_ROBOT_CLICK
public static int timeoutWaitClick
public static int timeoutWaitAlert
public static int timeoutCheckAlertForClick
TIMEOUT_NOWAIT
, means we check immediately
without waiting for presence of Alert.public static int timeoutWaitRobotClick
protected static InputKeysParser keysparser
public static boolean enableClickListenerFailures
Set to 'false' when you wish to avoid these types of failures.
public static boolean enableForceScroll
public static final boolean DEFAUT_AUTOSCROLL
public static final java.lang.String BROWSER_DRIVER_IMPLEMENTATION_JSON
public static final java.lang.String BROWSER_DRIVER_IMPLEMENTATION_W3C
public static final java.lang.String DEFAULT_BROWSER_DRIVER_IMPLEMENTATION
public static boolean isW3Cimplementation
public static WDLibrary.WD_XMLHttpRequest AJAX
public static boolean isLeftMouseButton(int buttonNumber)
public static boolean isMiddleMouseButton(int buttonNumber)
public static boolean isRightMouseButton(int buttonNumber)
public static int getTimeoutCheckAlertForClick()
public static void setTimeoutCheckAlertForClick(int timeoutCheckAlertForClick)
public static void click(org.openqa.selenium.WebElement clickable, java.lang.String... optional) throws SeleniumPlusException
clickable
- WebElement, as WebElement objoptional
- String[], the optional parameters
SeleniumPlusException
public static void click(org.openqa.selenium.WebElement clickable, org.openqa.selenium.Keys specialKey, java.lang.String... optional) throws SeleniumPlusException
clickable
- WebElement, the WebElement to click onspecialKey
- Keys, the special key to press during the clickoptional
- String[], the optional parameters
SeleniumPlusException
public static void click(org.openqa.selenium.WebElement clickable, java.awt.Point offset, java.lang.String... optional) throws SeleniumPlusException
clickable
- WebElement, the WebElement to click onoffset
- Point, the coordination relative to this WebElement to click atoptional
- String[], the optional parameters
SeleniumPlusException
public static void rightclick(org.openqa.selenium.WebElement clickable, java.lang.String... optional) throws SeleniumPlusException
clickable
- WebElement, as WebElement objoptional
- String[], the optional parameters
SeleniumPlusException
public static void rightclick(org.openqa.selenium.WebElement clickable, org.openqa.selenium.Keys specialKey, java.lang.String... optional) throws SeleniumPlusException
clickable
- WebElement, the WebElement to click onspecialKey
- Keys, the special key to presse during the clickoptional
- String[], the optional parameters
SeleniumPlusException
public static void rightclick(org.openqa.selenium.WebElement clickable, java.awt.Point offset, java.lang.String... optional) throws SeleniumPlusException
clickable
- WebElement, the WebElement to click onoffset
- Point, the coordination relative to this WebElement to click atoptional
- String[], the optional parameters
SeleniumPlusException
public static boolean inside(org.openqa.selenium.WebElement element, java.awt.Point p)
element
- WebElement, The element to get boundary to check with.p
- Point, The point to check.public static void click(org.openqa.selenium.WebElement clickable, java.awt.Point offset, org.openqa.selenium.Keys specialKey, int mouseButtonNumber, java.lang.String... optional) throws SeleniumPlusException
clickable
- WebElement, the WebElement to click onoffset
- Point, the coordination relative to this WebElement to click at.specialKey
- Keys, the special key to press during the clickmouseButtonNumber
- int, the mouse-button-number representing right, middle, or left button.
it can be MOUSE_BUTTON_LEFT
or MOUSE_BUTTON_RIGHT
.MOUSE_BUTTON_MIDDLE
NOT supported yet.optional
- String[], the optional parameters
SeleniumPlusException
public static void doubleClick(org.openqa.selenium.WebElement clickable, java.awt.Point offset, org.openqa.selenium.Keys specialKey, int mouseButtonNumber, java.lang.String... optional) throws SeleniumPlusException
clickable
- WebElement, the WebElement to click onoffset
- Point, the coordination relative to this WebElement to click at.specialKey
- Keys, the special key to press during the clickmouseButtonNumber
- int, the mouse-button-number representing right, middle, or left button.
it can be MOUSE_BUTTON_LEFT
MOUSE_BUTTON_MIDDLE
and MOUSE_BUTTON_RIGHT
NOT supported yet.optional
- String[], the optional parameters
SeleniumPlusException
public static void doubleClick(org.openqa.selenium.WebElement clickable, java.lang.String... optional) throws SeleniumPlusException
clickable
- WebElement, the WebElement to click onoptional
- String[], the optional parameters
SeleniumPlusException
public static void doubleClick(org.openqa.selenium.WebElement clickable, org.openqa.selenium.Keys specialKey, java.lang.String... optional) throws SeleniumPlusException
clickable
- WebElement, the WebElement to click onspecialKey
- Keys, the special key to press during the clickoptional
- String[], the optional parameters
SeleniumPlusException
public static void doubleClick(org.openqa.selenium.WebElement clickable, java.awt.Point offset, java.lang.String... optional) throws SeleniumPlusException
clickable
- WebElement, the WebElement to click onoffset
- Point, the coordination relative to this WebElement to click atoptional
- String[], the optional parameters
SeleniumPlusException
public static java.awt.Point getLocation(org.openqa.selenium.WebElement webelement) throws SeleniumPlusException
getLocation(WebElement, boolean)
with 2th parameter
given as false.webelement
- WebElement, the element to get locationSeleniumPlusException
#getLocation(WebElement, boolean)}
public static java.awt.Point getLocation(org.openqa.selenium.WebElement webelement, boolean useOnPageFirstly) throws SeleniumPlusException
webelement
- WebElement, the element to get locationuseOnPageFirstly
- boolean, There are 2 ways to get element's location relative to the page:
one is Coordinates.onPage()
, the other is WebElement.getLocation()
.
it seems that the 2th method (WebElement.getLocation()
) is more accurate.
But historically, we called Coordinates.onPage()
in first place.Coordinates.onPage()
will be used firstly as before.WebElement.getLocation()
will be used directlySeleniumPlusException
public static java.awt.Point getScreenLocation(org.openqa.selenium.WebElement webelement) throws SeleniumPlusException
webelement
- WebElement, a selenium webelement objectSeleniumPlusException
public static org.openqa.selenium.Keys convertToKeys(RobotKeyEvent event)
event
- RobotKeyEventpublic static org.openqa.selenium.Keys convertToKeys(int keycode)
keycode
- int, a java keycodestatic java.lang.CharSequence convertToCharacter(RobotKeyEvent event)
event
- public static void inputKeysSAFS2Selenium(org.openqa.selenium.WebElement we, java.lang.String keystrokes) throws SeleniumPlusException
Bypasses attempts to use AWT Robot for keystrokes.
Attempts to convert SAFS keystrokes to Selenium low-level Actions keystrokes.
Note: This method doesn't work well with the Firefox 55/56 and geckodriver 0.18.0/0.19.0.
Note: This method doesn't work well with the IE 11 and IEDriverServer 3.4.0.
we
- WebElement to send SAFS keystrokes (or plain text).keystrokes
- SAFS keystrokes or plain text to type.SeleniumPlusException
- if we are unable to process the keystrokes successfully.public static void keyPress(int keycode) throws SeleniumPlusException
keyRelease(int)
to release the key.keycode
- int, Java keycode to press (e.g. KeyEvent.VK_A
)SeleniumPlusException
- if failkeyRelease(int)
public static void keyRelease(int keycode) throws SeleniumPlusException
keyPress(int)
.keycode
- int, Java keycode to release (e.g. KeyEvent.VK_A
)SeleniumPlusException
- if failkeyPress(int)
public static void mouseWheel(int wheelAmt) throws SeleniumPlusException
wheelAmt
- int, the wheel amount to scroll.SeleniumPlusException
- if failpublic static void keyDown(org.openqa.selenium.Keys keycode) throws SeleniumPlusException
keyUp(Keys)
to release the key.keycode
- Keys, keycode to press (e.g. Keys.CONTROL
)SeleniumPlusException
- if failkeyUp(Keys)
public static void keyUp(org.openqa.selenium.Keys keycode) throws SeleniumPlusException
keyDown(Keys)
.keycode
- Keys, keycode to release (e.g. Keys.CONTROL
)SeleniumPlusException
- if failkeyDown(Keys)
public static void setDelayBetweenKeystrokes(int millisDelay) throws SeleniumPlusException
millisDelay
- between keystrokes.SeleniumPlusException
- if we are unable to process the keystrokes successfully.Robot.setMillisBetweenKeystrokes(int)
public static int getDelayBetweenKeystrokes() throws SeleniumPlusException
SeleniumPlusException
- if we are unable to process the keystrokes successfully.Robot.setMillisBetweenKeystrokes(int)
public static void setWaitReaction(boolean wait) throws SeleniumPlusException
wait
- boolean if wait or not.SeleniumPlusException
- if fail.Robot.setWaitReaction(boolean)
public static void setWaitReaction(boolean wait, int tokenLength, int dealyForToken, int dealy) throws SeleniumPlusException
wait
- boolean, if wait or not.tokenLength
- int, the length of a token. Only if the string is longer than this
then we wait the reaction after input-keys a certain time
indicated by the parameter dealyForToken.dealyForToken
- int, The delay in millisecond to wait the reaction after input-keys
for the string as long as a token.dealy
- int, The constant delay in millisecond to wait the reaction after input-keys.SeleniumPlusException
- if fail.Robot.setWaitReaction(boolean, int, int, int)
public static void inputKeys(org.openqa.selenium.WebElement we, java.lang.String keystrokes) throws SeleniumPlusException
Attempts to use AWT Robot for keystrokes for both local and remote servers. If the remote server does NOT have an RMI Server running to receive the request, then we will attempt to convert SAFS keystrokes to Selenium Actions keystrokes and try that way.
we
- WebElement to send SAFS keystrokes; if null, the keystrokes will be sent to the focused element.keystrokes
- in SAFS format to type.SeleniumPlusException
- if we are unable to process the keystrokes successfully.Robot.inputKeys(String)
,
#inputKeysSAFS2Selenium(WebElement)
public static void inputChars(org.openqa.selenium.WebElement we, java.lang.String keystrokes) throws SeleniumPlusException
we
- WebElement to send characters; if null, the keystrokes will be sent to the focused element.keystrokes/plain
- text to type.SeleniumPlusException
- if we are unable to process the keystrokes successfully.Robot.inputKeys(String)
public static void clearClipboard() throws SeleniumPlusException
SeleniumPlusException
public static void setClipboard(java.lang.String content) throws SeleniumPlusException
content
- String, the content to set to clipboardSeleniumPlusException
public static java.lang.Object getClipboard(java.awt.datatransfer.DataFlavor dataFlavor) throws SeleniumPlusException
dataFlavor
- DataFlavor, the data flavor for the content in clipboardSeleniumPlusException
public static java.awt.Rectangle getRectangleOnScreen(org.openqa.selenium.WebElement we) throws SeleniumPlusException
we
- WebElement, the webelement object to get screen rectangleSeleniumPlusException
static int toJavaKeyCode(org.openqa.selenium.Keys key) throws SeleniumPlusException
key
- Keys, the selenium Keys valueSeleniumPlusException
public static void captureScreen(java.lang.String image) throws SeleniumPlusException
image
- - Image full path with name.SeleniumPlusException
public static void mouseHover(org.openqa.selenium.WebElement we, java.awt.Point point, int millisStay) throws SeleniumPlusException
we
- WebElement, the component to hover mousepoint
- Point, the position relative to the component to hover the mousemillisStay
- int, in milliseconds, the period to hover the mouse; the mouse will
be moved out of screen if it expires.Constants.TIMEOUT_HOVERMOUSE_STAY_FOREVER
, then
the mouse will always stay there forever.SeleniumPlusException
- if the hover failpublic static void altLeftDrag(org.openqa.selenium.WebElement we, java.awt.Point start, java.awt.Point end) throws SeleniumPlusException
we
- WebElement, the component relative to which to dragstart
- Point, the start point relative to the webelementend
- Point, the end point relative to the webelementSeleniumPlusException
public static void ctrlAltLeftDrag(org.openqa.selenium.WebElement we, java.awt.Point start, java.awt.Point end) throws SeleniumPlusException
we
- WebElement, the component relative to which to dragstart
- Point, the start point relative to the webelementend
- Point, the end point relative to the webelementSeleniumPlusException
public static void ctrlLeftDrag(org.openqa.selenium.WebElement we, java.awt.Point start, java.awt.Point end) throws SeleniumPlusException
we
- WebElement, the component relative to which to dragstart
- Point, the start point relative to the webelementend
- Point, the end point relative to the webelementSeleniumPlusException
public static void ctrlShiftLeftDrag(org.openqa.selenium.WebElement we, java.awt.Point start, java.awt.Point end) throws SeleniumPlusException
we
- WebElement, the component relative to which to dragstart
- Point, the start point relative to the webelementend
- Point, the end point relative to the webelementSeleniumPlusException
public static void shiftLeftDrag(org.openqa.selenium.WebElement we, java.awt.Point start, java.awt.Point end) throws SeleniumPlusException
we
- WebElement, the component relative to which to dragstart
- Point, the start point relative to the webelementend
- Point, the end point relative to the webelementSeleniumPlusException
public static void rightDrag(org.openqa.selenium.WebElement we, java.awt.Point start, java.awt.Point end) throws SeleniumPlusException
we
- WebElement, the component relative to which to dragstart
- Point, the start point relative to the webelementend
- Point, the end point relative to the webelementSeleniumPlusException
public static void leftDrag(org.openqa.selenium.WebElement we, java.awt.Point start, java.awt.Point end) throws SeleniumPlusException
we
- WebElement, the component relative to which to dragstart
- Point, the start point relative to the webelementend
- Point, the end point relative to the webelementSeleniumPlusException
public static java.awt.Point[] dragTo(org.openqa.selenium.WebElement fromElem, org.openqa.selenium.WebElement toElem, java.lang.String[] offsets, int dndReleaseDelay) throws SeleniumPlusException
fromElem
- WebElement, from where the drag beginstoElem
- WebElement, to where the drag stopsoffsets
- String, the offsets relative to 'fromElem' and to 'toElem'dndReleaseDelay
- int, in milliseconds, the delay before releasing the mouseSeleniumPlusException
public static java.awt.Rectangle toJavaRectangle(org.openqa.selenium.Rectangle rect)
public static java.awt.Point getElementOffsetScreenLocation(org.openqa.selenium.WebElement element, java.lang.String offsetX, java.lang.String offsetY)
element
- WebElement, the element relative to which the coordination will be calculated.offsetX
- String, the offset on x axis, in pixel or in percentage, for example 15 or 30%.offsetX
- String, the offset on y axis, in pixel or in percentage, for example 45 or 50%.public static void captureScreen(org.openqa.selenium.WebElement we, java.lang.String imgName, java.lang.String fileformat) throws SeleniumPlusException
we
- - WebElement object.imgName
- - Image full path with namejava.lang.Exception
SeleniumPlusException
public static java.awt.image.BufferedImage captureBrowserArea(java.awt.Rectangle rectangle) throws SeleniumPlusException
rectangle
- Rectangle, within which to capture the image.SeleniumPlusException
public static void startBrowser(java.lang.String BrowserName, java.lang.String Url, java.lang.String Id, int timeout, boolean isRemote) throws SeleniumPlusException
BrowserName
- String, Browser name such as InternetExplorer, Chrome and FireFox.Url
- String, Url including HTTP protocol prefix.Id
- String, Id or Title of the Browser in case of two instances needs.timeout
- String, Implicit time out to be waited before throw exception.isRemote
- String, Start interactive testcase development mode.SeleniumPlusException
#startBrowser(String, String, String, int, boolean, Map)}
public static void startBrowser(java.lang.String browserName, java.lang.String Url, java.lang.String Id, int timeout, boolean isRemote, java.util.Map<java.lang.String,java.lang.Object> extraParameters) throws SeleniumPlusException
Expects System Properties 'selenium.host' and 'selenium.port' to be set.
Otherwise, defaults to 'localhost' on port '4444'.
browserName
- String, Browser name such as InternetExplorer, Chrome and FireFox.Url
- String, Url including HTTP protocol prefix.Id
- String, Id or Title of the Browser in case of two instances needs.timeout
- String, Implicit time out to be waited before throw exception.isRemote
- String, Start interactive testcase development mode.extraParameters
- MapSeleniumPlusException
public static void loadModHeaderProfile(org.openqa.selenium.WebDriver driver, java.lang.Object modheaderProfile) throws SeleniumPlusException
driver
- WebDrivermodheaderProfile
- String, the "ModHeader" profile. It can be
SeleniumPlusException
public static boolean deleteNetworkConditions()
public static java.lang.Object getNetworkConditions()
public static boolean setNetworkConditions(java.lang.String networkConditions)
networkConditions
- String, JSON string contains the 'network conditions' to set.public static boolean setNetworkConditions(org.openqa.selenium.WebDriver webdriver, java.lang.String networkConditions)
webdriver
- WebDriver, used to execute this command.networkConditions
- String, JSON string contains the 'network conditions' to set.public static boolean setNetworkConditions(java.util.Map<?,?> networkConditions)
networkConditions
- Map, contains the 'network conditions' to set.public static void stopBrowser(java.lang.String ID) throws java.lang.IllegalArgumentException
ID
- String, the id to identify the browserjava.lang.IllegalArgumentException
- if the provided browser ID is NOT SearchObject.isValidBrowserID(String)
or not known as a running instance.SearchObject.removeWebDriver(String)
public static void resizeBrowserWindow(int width, int height) throws SeleniumPlusException
width
- int, width in pixelsheight
- int, height in pixelsSeleniumPlusException
public static void stopSeleniumServer(java.lang.String host) throws SAFSException
host
- String, the name of the machine on which the process will be killedSAFSException
@Deprecated public static java.util.List<GenericProcessMonitor.ProcessInfo> killGeckoDriver(java.lang.String host) throws SAFSException
UtilsIndependent.killGeckoDriver(String)
instead.host
- String, the name of the machine on which the process 'geckodriver.exe' will be killed.SAFSException
@Deprecated public static java.util.List<GenericProcessMonitor.ProcessInfo> killChromeDriver(java.lang.String host) throws SAFSException
UtilsIndependent.killChromeDriver(String)
instead.host
- String, the name of the machine on which the process 'chromedriver.exe' will be killed.SAFSException
@Deprecated public static java.util.List<GenericProcessMonitor.ProcessInfo> killIEDriverServer(java.lang.String host) throws SAFSException
UtilsIndependent.killIEDriverServer(String)
instead.host
- String, the name of the machine on which the process 'IEDriverServer.exe' will be killed.SAFSException
@Deprecated public static java.util.List<GenericProcessMonitor.ProcessInfo> killMicrosoftWebDriver(java.lang.String host) throws SAFSException
UtilsIndependent.killMicrosoftWebDriver(String)
instead.host
- String, the name of the machine on which the process 'MicrosoftWebDriver.exe' will be killed.SAFSException
@Deprecated public static java.util.List<GenericProcessMonitor.ProcessInfo> killMSEdgeDriver(java.lang.String host) throws SAFSException
UtilsIndependent.killMSEdgeDriver(String)
instead.host
- String, the name of the machine on which the process 'msedgedriver.exe' will be killed.SAFSException
@Deprecated public static java.util.List<GenericProcessMonitor.ProcessInfo> killBrowserDriver(java.lang.String host, java.lang.String browserName) throws SAFSException
UtilsIndependent.killBrowserDriver(String, String)
instead.host
- String, the name of the machine on which the driver process will be killed.browserName
- String, the name of the browser for which the driver process should be killed.SAFSException
@Deprecated public static java.util.List<GenericProcessMonitor.ProcessInfo> killExtraProcess(java.lang.String host, java.lang.String processName) throws SAFSException
host
- String, the name of machine on which the process will be killed.processName
- String, the name of process to kill. like chromedriver.exe, IEDriverServer.exe etc.SAFSException
@Deprecated public static java.util.List<GenericProcessMonitor.ProcessInfo> killProcess(java.lang.String host, java.lang.String processName, java.lang.String commandline) throws SAFSException
UtilsIndependent.killProcess(String, String, String)
instead.host
- String, the name of machine on which the process will be killed.processName
- String, the name of process to kill. like chromedriver.exe, IEDriverServer.exe, java.exe etc.commandline
- String, the partial commandline of the process to be killed.SAFSException
@Deprecated public static java.util.List<GenericProcessMonitor.ProcessInfo> killProcess(java.lang.String host, java.lang.String processName, java.lang.String commandline, java.lang.String notCommandline) throws SAFSException
UtilsIndependent.killProcess(String, String, String, String)
instead.host
- String, the name of machine on which the process will be killed.processName
- String, the name of process to kill. like chromedriver.exe, IEDriverServer.exe, java.exe etc.commandline
- String, the partial commandline of the process to be killed.notCommandline
- String, the partial commandline of the process NOT to be killed.SAFSException
public static void scrollBrowserWindowBy(int x, int y, org.openqa.selenium.WebElement element) throws SeleniumPlusException
x
- int, horizontal scrolling in pixelsy
- int, vertical scrolling in pixelselement,
- scroll the topmost window containing this element.SeleniumPlusException
public static void scrollBrowserWindowTo(int x, int y, org.openqa.selenium.WebElement element) throws SeleniumPlusException
x
- int, horizontal position in pixelsy
- int, vertical position in pixelselement,
- scroll the topmost window containing this element.SeleniumPlusException
public static void alignToTop(org.openqa.selenium.WebElement element) throws SeleniumPlusException
element
- WebElement, the element to scroll to align with browser's topSeleniumPlusException
public static void alignToBottom(org.openqa.selenium.WebElement element) throws SeleniumPlusException
element
- WebElement, the element to scroll to align with browser's bottomSeleniumPlusException
public static boolean showOnPage(org.openqa.selenium.WebElement element, java.lang.String... optional)
element
- WebElement, the webelement to show.params
- optionalpublic static boolean isShowOnPage(org.openqa.selenium.WebElement element)
element
- WebElement, to check if it is shown on the pagepublic static boolean isShowOnPage(org.openqa.selenium.WebElement element, org.openqa.selenium.Point offset)
element
- WebElement, to check if it is shown on the pageoffset
- Point, the offset from Left-Top of web-element; the point to check. can be nullpublic static boolean isLocationInBounds(org.openqa.selenium.Point p, org.openqa.selenium.Dimension bounds)
p
- Point, relative to the Dimension. see if the Point is inside bounds of 0,0,bounds.width, bounds.height.bounds
- Dimension, the boundarypublic static void setPositionBrowserWindow(int x, int y) throws SeleniumPlusException
x
- int, x-coordination in pixelsy
- int, y-coordination in pixelsSeleniumPlusException
public static void maximizeBrowserWindow() throws SeleniumPlusException
SeleniumPlusException
public static void minimizeBrowserWindow() throws SeleniumPlusException
SeleniumPlusException
public static org.openqa.selenium.WebDriver getBrowserWithTitle(java.lang.String title) throws SeleniumPlusException
title
- SeleniumPlusException
public static void closeBrowser() throws SeleniumPlusException
SeleniumPlusException
- if the lastUsed WebDriver is not valid or is null.stopBrowser(String)
public static org.openqa.selenium.WebDriver getBrowserWithID(java.lang.String id) throws SeleniumPlusException
id
- SeleniumPlusException
@Deprecated public static void highlightElement(org.openqa.selenium.WebElement element) throws SeleniumPlusException
SearchObject.highlight(WebElement)
.element
- to be highlightedSeleniumPlusException
public static java.lang.String getBrowserName(org.openqa.selenium.WebDriver driver)
driver
- -- can be null to use the last used WebDriver session.SelectBrowser.BROWSER_NAME_CHROME
,
SelectBrowser.BROWSER_NAME_FIREFOX
,
SelectBrowser.BROWSER_NAME_HTMLUNIT
,
SelectBrowser.BROWSER_NAME_IE
,
SelectBrowser.BROWSER_NAME_SAFARI
public static boolean isHtmlUnit(org.openqa.selenium.WebDriver driver)
driver
- -- can be null to use last used webdriver session.getBrowserName(WebDriver)
,
SelectBrowser.BROWSER_NAME_HTMLUNIT
public static boolean isSafari(org.openqa.selenium.WebDriver driver)
driver
- -- can be null to use last used webdriver session.getBrowserName(WebDriver)
,
SelectBrowser.BROWSER_NAME_SAFARI
public static boolean isFireFox(org.openqa.selenium.WebDriver driver)
driver
- -- can be null to use last used webdriver session.getBrowserName(WebDriver)
,
SelectBrowser.BROWSER_NAME_FIREFOX
public static boolean isInternetExplorer(org.openqa.selenium.WebDriver driver)
driver
- -- can be null to use last used webdriver session.getBrowserName(WebDriver)
,
SelectBrowser.BROWSER_NAME_IE
public static boolean isChrome(org.openqa.selenium.WebDriver driver)
driver
- -- can be null to use last used webdriver session.getBrowserName(WebDriver)
,
SelectBrowser.BROWSER_NAME_CHROME
public static com.sebuilder.interpreter.Script getSeleniumBuilderScript(java.lang.String path) throws java.io.FileNotFoundException
path
- -- full path to the JSON script.java.io.FileNotFoundException
- -- if a provided path is null or otherwise invalidpublic static com.sebuilder.interpreter.webdriverfactory.WebDriverFactory getWebDriverAsWebDriverFactory()
public static boolean runSeleniumBuilderScript(java.lang.String path, org.apache.commons.logging.Log log, com.sebuilder.interpreter.webdriverfactory.WebDriverFactory driverFactory, java.util.HashMap<java.lang.String,java.lang.String> webDriverConfig, java.util.Map<java.lang.String,java.lang.String> initialVars, boolean allowClose) throws java.io.FileNotFoundException, java.lang.RuntimeException
path
- - fullpath to JSON script file.
log
- - An appropriate logging interface--such as the ApacheLogUtilities we instantiate
when launching our Selenium engine.
driverFactory
- -- if null, we will use a default Factory that does NOT instantiate a new
WebDriver but uses the "current" or "lastUsed" WebDriver ignoring any webDriverConfig that may
or may not be provided.
Consult the Selenium Interpreter documentation for any additional info on using the Selenium Builder Interpreter if you are NOT intending to use the current or lastUsed WebDriver.
webDriverConfig
- -- can be null if driverFactory is null and we will be using an existing
WebDriver.initialVars
- -- can be null.allowClose
- -- set to false to prevent the script from closing the Driver.java.io.FileNotFoundException
java.lang.RuntimeException
public static boolean runSeleniumBuilderScript(java.lang.String path, org.apache.commons.logging.Log log, boolean allowClose) throws java.io.FileNotFoundException, java.lang.RuntimeException
path
- - fullpath to JSON script file.
log
- - An appropriate logging interface--such as the ApacheLogUtilities we instantiate
when launching our Selenium engine.
allowClose
- -- set to false to prevent the script from closing the Driver.java.io.FileNotFoundException
java.lang.RuntimeException
public static boolean windowSetFocus(org.openqa.selenium.WebElement element) throws SeleniumPlusException
element
- WebElement from which to get the proper RemoteWebDriverSeleniumPlusException
- if an error occured during the execution attempt.windowSetFocus(WebDriver)
public static boolean windowSetFocus(org.openqa.selenium.WebDriver adriver) throws SeleniumPlusException
adriver
- WebDriver from which to get the window titleSeleniumPlusException
- if an error occured during the execution attempt.windowSetFocus(String)
public static boolean windowSetFocus(java.lang.String titleRegExp) throws SeleniumPlusException
titleRegExp
- -- title or regular expression matching the target window's caption.SeleniumPlusException
NativeWrapper#SetForegroundWindow(String)}
public static boolean focus(org.openqa.selenium.WebElement element) throws SeleniumPlusException
element
- WebElement, to get focus.SeleniumPlusException
public static void fireMouseEvent(MouseEvent event) throws SeleniumPlusException
event
- SeleniumPlusException
- on an execution error.java.lang.NullPointerException
- if required parameters in the MouseEvent are null.public static java.lang.String getBrowserName()
public static java.lang.String getBrowserVersion()
public static java.lang.String getPlatform()
public static java.lang.String getDriverVersion()
public static void checkKnownIssue(java.lang.String keyword) throws SeleniumPlusException
startBrowser(String, String, String, int, boolean, Map)
before calling this method.
so that we can get the browser's name and browser's version to check.keyword
- String, the keyword to check for, such like "GetURL"SeleniumPlusException
- will be thrown out if a known issue is checked.public static boolean clickUnverified(org.openqa.selenium.WebElement component, java.awt.Point offset, java.lang.String... optional)
#click(WebElement, Point)
instead.#click(WebElement, Point)
will callcomponent
- WebElement, the component to clickoffset
- Point, the offset (relative to component) to click atoptional
- String[], the optional parameters
#click(WebElement, Point)
public static java.util.List<java.lang.String> convertElementArrayToList(Element[] elements)
elements
- Element[], an array of element objectpublic static void closeAlert(boolean accept, java.lang.String... optionals) throws SeleniumPlusException
SearchObject.getWebDriver()
will still return the same object.accept
- boolean, if true then accept (click OK) the alert; otherwise dismiss (click Cancel) the alert.optionals
- String
SeleniumPlusException,
- if WebDriver cannot be got according to the parameter browserID.SeleniumPlusException
public static boolean isAlertPresent(java.lang.String... optionals) throws SeleniumPlusException
SearchObject.getWebDriver()
will still return the same object.optionals
- String...
TIMEOUT_NOWAIT
, this method will try to get Alert without waiting.SeleniumPlusException
- if the WebDriver is nullwaitAlert(String...)
public static void handleBasicAuthentication(java.lang.String user, java.lang.String password, int delayInSecond)
user
- String, the user namepassword
- String, the passworddelayInSecond
- int, delay in second, before the thread startspublic static void main(java.lang.String[] args)
test_ajax_call(String)
args
- Copyright © SAS Institute. All Rights Reserved.