Class SmartClientWebDriver
- All Implemented Interfaces:
org.openqa.selenium.interactions.HasInputDevices
,org.openqa.selenium.interactions.Interactive
,org.openqa.selenium.JavascriptExecutor
,org.openqa.selenium.SearchContext
,org.openqa.selenium.TakesScreenshot
,org.openqa.selenium.WebDriver
- Direct Known Subclasses:
SmartClientChromeDriver
,SmartClientEdgeDriver
,SmartClientFirefoxDriver
,SmartClientIEDriver
,SmartClientRemoteWebDriver
WebDriver
interface providing SmartClient specific enhancements. Additionally several extra methods are provided to correspond one to one with classic Selenium's "Selenese" test language. This, in combination with SeleneseRunner
allows the running of Selenese test files with WebDriver.-
Method Summary
Modifier and TypeMethodDescriptionboolean
assertEval
(String javaScript) Assert that the specified JavaScript script evaluates to empty String or null.boolean
assertEval
(String javaScript, Object expected) Assert that the specified JavaScript script evaluates equal to the expected value.boolean
assertEval
(String javaScript, Object expected, boolean asJavaScriptString) Assert that the specified JavaScript script evaluates equal to the expected value.boolean
assertEval
(String javaScript, String expected) Assert that the specified JavaScript script evaluates equal to the expected value.boolean
assertEval
(String javaScript, String expected, boolean asJavaScriptString) Assert that the specified JavaScript script evaluates equal to the expected value.blur
(org.openqa.selenium.By by) Blurs the target element or canvas.clearCanvasProperty
(org.openqa.selenium.By scLocator, String propertyName) Clears the specified canvas property by setting itnull
.void
Resets all tolerances to their default values.click
(org.openqa.selenium.By by) Send a single click to the locator target.clickAndHold
(org.openqa.selenium.By by) Equivalent of our "mouseDown", sent to locator target.clickAndHoldAt
(org.openqa.selenium.By by, int xOffset, int yOffset) Equivalent of our "mouseDown", sent to an offset from locator target's left, top corner.contextClick
(org.openqa.selenium.By by) Send a context (right) click to the locator target.To Support Selenese.To Support Selenese.doubleClick
(org.openqa.selenium.By by) Send a double click to the locator target.dragAndDrop
(org.openqa.selenium.By sourceBy, String offset) Deprecated.use the variant that takes separate coordinate offsetsdragAndDrop
(org.openqa.selenium.By sourceBy, org.openqa.selenium.By targetBy) Simulate a drag-and-drop from the source locator to the target locator.dragAndDropBy
(org.openqa.selenium.By sourceBy, int xOffset, int yOffset) Simulate a drag-and-drop from the source locator by the horizontal and vertical offsets.focus
(org.openqa.selenium.By by) Set focus into the target element or canvas.focus
(org.openqa.selenium.By by, boolean clearModifiers) Set focus into the target element or canvas.focus
(org.openqa.selenium.By by, boolean clearModifiers, boolean refocus) Set focus into the target element or canvas.void
Fetch a URL relative to the baseURL.void
Fetch a URL relative to the baseURL.int
getElementHeight
(org.openqa.selenium.By by) Get height of target elementint
getElementPositionLeft
(org.openqa.selenium.By by) Get left page offset of target elementint
getElementPositionTop
(org.openqa.selenium.By by) Get top page offset of target elementint
getElementWidth
(org.openqa.selenium.By by) Get width of target elementSimulate Selenium V1's getEval() by evaluating the expression passed in as a series of statements, and returning the value of the last statement as the result.Simulate Selenium V1's getEval() by evaluating the expression passed in as a series of statements, and returning the value of the last statement as the result.getTable
(org.openqa.selenium.By scLocator, long row, long col) Returns the specified table cell display value.getText
(org.openqa.selenium.By by) Returns text of element associated with locator, or the value if there's no associated text.getValue
(org.openqa.selenium.By scLocator) Returns value of element associated with locator.getValueAsString
(org.openqa.selenium.By scLocator) Similar togetValue(By)
except always returns the value as a String.getValueAsString
(org.openqa.selenium.By scLocator, boolean asJavaScriptString) Similar togetValue(By)
except always returns the value as a String.Send a modifer key down event to the locator target.keyDown
(org.openqa.selenium.By by, org.openqa.selenium.Keys theKey) Send a modifer key down event to the locator target.Sends a single keystroke to the target.Similar tosendKeys(org.openqa.selenium.By, java.lang.String)
to support Selenese conversion.Send a modifer key up event to the locator target.keyUp
(org.openqa.selenium.By by, org.openqa.selenium.Keys theKey) Send a modifer key up event to the locator target.mouseMove
(org.openqa.selenium.By by) Simulate a mouseOver for the locator target.mouseMoveAt
(org.openqa.selenium.By by, int xOffset, int yOffset) Simulate a mouseOver at an offset from locator target's left, top corner.void
pause
(long waitInMillis) Wait for the specified amount of time.release
(org.openqa.selenium.By by) Equivalent of our "mouseUp", sent to the locator target.releaseAt
(org.openqa.selenium.By by, int xOffset, int yOffset) Equivalent of our "mouseUp", sent to an offset from locator target's left, top corner.void
scrollIntoViewIfNeeded
(org.openqa.selenium.By by) Scroll the target into view if it's not already in view.boolean
scrollIntoViewIfNeeded
(org.openqa.selenium.By by, org.openqa.selenium.WebElement element) Scroll the target into view if it's not already in view.secondClick
(org.openqa.selenium.By by) Send a second click to the locator target.void
selectWindowByName
(String name) Switch to window specified by name.void
selectWindowByTitle
(String title) Switch to window specified by title.boolean
Similar totype(org.openqa.selenium.By)
except returns whether the element actually got cleared before the new value was typed, and sends a Keys.TAB to the target after typing the value.Send a sequence of keys to the locator target.void
setAllowCoordClickOnOccludingElement
(boolean allow) void
setAllowJavaScriptToStringMatch
(boolean allowJSMatch) Configures whetherSmartClientWebDriver
checks for a JavaScript match when comparing Strings to values, in addition to performing the check against a Java conversion of the value.void
setBaseUrl
(String baseUrl) Set the Base URL against which tests will runvoid
setCanvasHeightTolerance
(long canvasHeightTolerance) Sets primary tolerance forverifyCanvasHeight(org.openqa.selenium.By, long)
.setCanvasProperty
(org.openqa.selenium.By scLocator, String propertyName, Object value) Sets the specified canvas property to the provided value.setCanvasPropertyFalse
(org.openqa.selenium.By scLocator, String propertyName) Sets the specified canvas propertyfalse
.setCanvasPropertyTrue
(org.openqa.selenium.By scLocator, String propertyName) Sets the specified canvas propertytrue
.void
setCanvasWidthTolerance
(long canvasWidthTolerance) Sets primary tolerance forverifyCanvasWidth(org.openqa.selenium.By, long)
.void
setClientLogLevel
(String category, long level) Sets client log level for a category as number.void
setClientLogLevel
(String category, String level) Sets client log level for a category using log priority name.void
setDefaultImplicitWait
(long implicitWaitMillis) Change the implicit timeout for native WebDriver calls to the supplied number of milliseconds.void
setDefaultWaitTimeout
(long timeoutInSeconds) Change the default timeout for SmartClientWebDriver waitForXXX() methods to the supplied number of seconds.void
setElementTolerance
(long elementTolerance) void
setMaxDragPause
(long maxDragPauseMillis) Change the default maximum pause used by ScActions during dragAndDrop operations.void
setOccludedElementApproach
(com.isomorphic.webdriver.SmartClientWebDriver.OccludedElementApproach occludedApproach) How to click on an occludedWebElement
that can't be hit by clicking at the expected coordinates.void
setServerLogLevel
(String category, String level) Sets server log level for a category using log priority name.void
setUseFrameworkValueAsFallback
(boolean useFrameworkValue) Sets whethergetValue(org.openqa.selenium.By)
should be called on locators as a fallback ifgetText(org.openqa.selenium.By)
is not able to find anything (other than the empty string).void
setValueTolerance
(long valueTolerance) Sets value tolerance forverifyValueWithTolerance(org.openqa.selenium.By, java.lang.Long)
, and fallback tolerance values forverifyCanvasWidth(org.openqa.selenium.By, long)
andverifyCanvasHeight(org.openqa.selenium.By, long)
.To Support Selenese.To Support Selenese.void
Show the developer console.type
(org.openqa.selenium.By by) Sends an empty String to the target, clearing it if it's an editable text element.Alternative tosendKeys(By,String)
taking a single key as a Long.Clears target if it's an editable text element.boolean
verifyCanvasHeight
(org.openqa.selenium.By scLocator, long expectedHeight) Verify height of target canvas.boolean
verifyCanvasWidth
(org.openqa.selenium.By scLocator, long expectedWidth) Verify width of target canvas.boolean
verifyElementClickable
(org.openqa.selenium.By scLocator) Verify that a given element is clickable.boolean
verifyElementHeight
(org.openqa.selenium.By by, long expectedHeight) Verify that target element height matches expected valueboolean
verifyElementHeightWithTolerance
(org.openqa.selenium.By by, long expectedHeight) Verify that target element height matches expected value within tolerance.boolean
verifyElementPositionLeft
(org.openqa.selenium.By by, long expectedLeft) Verify that target element left page offset matches expected valueboolean
verifyElementPositionTop
(org.openqa.selenium.By by, long expectedTop) Verify that target element top page offset matches expected valueboolean
verifyElementPresent
(org.openqa.selenium.By by) Verify that a given element is present.boolean
verifyElementReadyForKeyPresses
(org.openqa.selenium.By scLocator) Verify that a given element is ready to receive keypresses.boolean
verifyElementSelected
(org.openqa.selenium.By by) Verify that a given element is selected.boolean
verifyElementVisible
(org.openqa.selenium.By by) Verify that a given element is visible.boolean
verifyElementWidth
(org.openqa.selenium.By by, long expectedWidth) Verify that target element width matches expected valueboolean
verifyElementWidthWithTolerance
(org.openqa.selenium.By by, long expectedWidth) Verify that target element width matches expected value within tolerance.boolean
verifyTable
(org.openqa.selenium.By scLocator, long row, long col, String expected) Verify that specified table cell display value matches the expected String pattern.boolean
verifyText
(org.openqa.selenium.By by) Verify that the element's text is empty.boolean
verifyText
(org.openqa.selenium.By by, String expected) Verify that the supplied String pattern matches the element's text.boolean
verifyTextPresent
(String expected) Verify that the supplied String pattern is presnt somewhere on the page.boolean
verifyTextPresent
(org.openqa.selenium.By by, String expected) Verify that the supplied String pattern is contained in the element's text.boolean
verifyTitle
(String expected) Verify that the supplied String pattern matches the page title.boolean
verifyValue
(org.openqa.selenium.By scLocator, Boolean expected) Verifies that the target has theBoolean
value expected.boolean
verifyValue
(org.openqa.selenium.By scLocator, Integer expected) Verifies that the target has theInteger
value expected.boolean
verifyValue
(org.openqa.selenium.By scLocator, Long expected) Verifies that the target has theLong
value expected.boolean
verifyValue
(org.openqa.selenium.By scLocator, String expected) Verifies that the target matches theString
pattern.boolean
verifyValueEmpty
(org.openqa.selenium.By scLocator) Verifies that target's value is empty.boolean
verifyValueWithTolerance
(org.openqa.selenium.By scLocator, Integer expected) Verifies that the target has theInteger
value expected within tolerance.boolean
verifyValueWithTolerance
(org.openqa.selenium.By scLocator, Long expected) Verifies that the target has theLong
value expected within tolerance.boolean
verifyValueWithTolerance
(org.openqa.selenium.By scLocator, String expected) Verifies that the target matches theString
pattern, with any numbers allowed to match literal numbers in the expected String with a tolerance.boolean
waitForCanvasDone
(org.openqa.selenium.By scLocator) Wait until a targetCanvas
responds positively to the isCanvasDone() call.boolean
waitForCanvasDone
(org.openqa.selenium.By scLocator, long timeoutInSeconds) Wait until a targetCanvas
responds positively to the isCanvasDone() call.boolean
waitForCondition
(String javaScript) Wait for a javascript expression to evaluate to true.boolean
waitForCondition
(String javaScript, long timeoutInSeconds) Wait for a javascript expression to evaluate to true.boolean
waitForCondition
(String javaScript, long timeoutInSeconds, Object... argument) Wait for a javascript script to execute and return true.boolean
waitForElementClickable
(org.openqa.selenium.By scLocator) Wait until a given element responds positively to the isElementClickable() call.boolean
waitForElementClickable
(org.openqa.selenium.By scLocator, long timeoutInSeconds) Wait until a given element responds positively to the isElementClickable() call.boolean
waitForElementInViewport
(org.openqa.selenium.By scLocator) Wait until a given element has been scrolled into the browser viewport.boolean
waitForElementInViewport
(org.openqa.selenium.By scLocator, long timeoutInSeconds) Wait until a given element has been scrolled into the browser viewport.boolean
waitForElementNotClickable
(org.openqa.selenium.By scLocator) Wait until a given element responds negatively to the isElementClickable() call.boolean
waitForElementNotClickable
(org.openqa.selenium.By scLocator, long timeoutInSeconds) Wait until a given element responds negatively to the isElementClickable() call.boolean
waitForElementNotPresent
(org.openqa.selenium.By by) Wait until a given element is no longer present.boolean
waitForElementNotPresent
(org.openqa.selenium.By by, long timeoutInSeconds) Wait until a given element is no longer present.boolean
waitForElementNotVisible
(org.openqa.selenium.By by) Wait until a given element is no longer visible.boolean
waitForElementNotVisible
(org.openqa.selenium.By by, long timeoutInSeconds) Wait until a given element is no longer visible.boolean
waitForElementPresent
(org.openqa.selenium.By by) Wait until a given element is present.boolean
waitForElementPresent
(org.openqa.selenium.By by, long timeoutInSeconds) Wait until a given element is present.boolean
waitForElementReadyForKeyPresses
(org.openqa.selenium.By scLocator) Wait until a given element responds positively to the isElementReadyForKeyPresses() call.boolean
waitForElementReadyForKeyPresses
(org.openqa.selenium.By scLocator, long timeoutInSeconds) Wait until a given element responds positively to the isElementReadyForKeyPresses() call.boolean
waitForElementVisible
(org.openqa.selenium.By by) Wait until a given element becomes visible.boolean
waitForElementVisible
(org.openqa.selenium.By by, long timeoutInSeconds) Wait until a given element becomes visible.boolean
waitForEval
(String javaScript, String expected) Wait for a javascript expression to evaluate to a value that matches the supplied String pattern under the rules described inverifyValue(org.openqa.selenium.By, java.lang.Boolean)
.boolean
waitForEval
(String javaScript, String expected, long timeoutInSeconds) Wait for a javascript expression to evaluate to a value that matches the supplied String pattern under the rules described inverifyValue(org.openqa.selenium.By, java.lang.Boolean)
.boolean
waitForFormDone
(org.openqa.selenium.By scLocator) Wait until a targetDynamicForm
responds positively to the isFormDone() call.boolean
waitForFormDone
(org.openqa.selenium.By scLocator, long timeoutInSeconds) Wait until a targetDynamicForm
responds positively to the isFormDone() call.boolean
waitForFrameToLoad
(String frameLocator, long timeoutInSeconds) Wait until a frame has loaded.boolean
waitForGridDone
(org.openqa.selenium.By scLocator) Wait until a targetListGrid
responds positively to the isGridDone() call.boolean
waitForGridDone
(org.openqa.selenium.By scLocator, long timeoutInSeconds) Wait until a targetListGrid
responds positively to the isGridDone() call.boolean
waitForGridDone
(org.openqa.selenium.By scLocator, Boolean includeEdits) Wait until a targetListGrid
responds positively to the isGridDone() call.boolean
waitForGridDone
(org.openqa.selenium.By scLocator, Boolean includeEdits, long timeoutInSeconds) boolean
waitForHoverTextPresent
(String expected) Wait until the hover canvas shows a particular text value.boolean
waitForHoverTextPresent
(String expected, long timeoutInSeconds) Wait until the hover canvas shows a particular text value.boolean
waitForItemDone
(org.openqa.selenium.By scLocator) Wait until a targetFormItem
responds positively to the isItemDone() call.boolean
waitForItemDone
(org.openqa.selenium.By scLocator, long timeoutInSeconds) Wait until a targetFormItem
responds positively to the isItemDone() call.boolean
Wait until a given element responds positively to the isSystemDone() call.boolean
waitForSystemDone
(long timeoutInSeconds) Wait until a given element responds positively to the isSystemDone() call.boolean
waitForSystemDone
(com.isomorphic.webdriver.SystemDoneConfig config) Wait until a given element responds positively to the isSystemDone() call.boolean
waitForSystemDone
(com.isomorphic.webdriver.SystemDoneConfig config, long timeoutInSeconds) Wait until a given element responds positively to the isSystemDone() call.boolean
waitForSystemDone
(Boolean includeRedraws) Wait until a given element responds positively to the isSystemDone() call.boolean
waitForSystemDone
(Boolean includeRedraws, Boolean includeEdits) Wait until a given element responds positively to the isSystemDone() call.boolean
waitForSystemDone
(Boolean includeRedraws, Boolean includeEdits, long timeoutInSeconds) Wait until a given element responds positively to the isSystemDone() call.boolean
waitForSystemDone
(String includePropList) Wait until a given element responds positively to the isSystemDone() call.boolean
waitForSystemDone
(String includePropList, long timeoutInSeconds) Wait until a given element responds positively to the isSystemDone() call.boolean
waitForText
(org.openqa.selenium.By by, String expected) Wait until a given element has a particular text value.boolean
waitForText
(org.openqa.selenium.By by, String expected, long timeoutInSeconds) Wait until a given element has a particular text value.boolean
waitForTileGridDone
(org.openqa.selenium.By scLocator) Wait until a targetTileGrid
responds positively to the isTileGridDone() call.boolean
waitForTileGridDone
(org.openqa.selenium.By scLocator, long timeoutInSeconds) Wait until a targetTileGrid
responds positively to the isTileGridDone() call.boolean
waitForTileLayoutDone
(org.openqa.selenium.By scLocator) Wait until a targetTileLayout
responds positively to the isTileLayoutDone() call.boolean
waitForTileLayoutDone
(org.openqa.selenium.By scLocator, long timeoutInSeconds) Wait until a targetTileLayout
responds positively to the isTileLayoutDone() call.boolean
waitForValue
(org.openqa.selenium.By scLocator, Object expected) Wait until a target matches theString
pattern.boolean
waitForValue
(org.openqa.selenium.By scLocator, Object expected, long timeoutInSeconds) Wait until a target matches theString
pattern.
-
Method Details
-
setMaxDragPause
public void setMaxDragPause(long maxDragPauseMillis) Change the default maximum pause used by ScActions during dragAndDrop operations. Too little and dragAndDrop operations will short-stroke. Too much and the mouse won't be released and WebDriver communication with the browser will fail.- Parameters:
maxDragPauseMillis
- new maximum pause for dragAndDrops
-
setDefaultWaitTimeout
public void setDefaultWaitTimeout(long timeoutInSeconds) Change the default timeout for SmartClientWebDriver waitForXXX() methods to the supplied number of seconds. Does not impact native WebDriver wait timeouts.- Parameters:
timeoutInSeconds
- new default timeout, in seconds (must be positive)
-
setDefaultImplicitWait
public void setDefaultImplicitWait(long implicitWaitMillis) Change the implicit timeout for native WebDriver calls to the supplied number of milliseconds. For example this will affect non-ByScLocator findElement() waits.- Parameters:
implicitWaitMillis
- new implicit timeout, in milliseconds (must be positive)
-
setOccludedElementApproach
public void setOccludedElementApproach(com.isomorphic.webdriver.SmartClientWebDriver.OccludedElementApproach occludedApproach) How to click on an occludedWebElement
that can't be hit by clicking at the expected coordinates. In older versions of WebDriver, occlusion didn't matter as much, and the element could still be targeted with a click. In Selenium v3, you're not able to click on an element unless if it has visible points and only at those points.The default is that we attempt to click at the element currently at that point if it's a descendant of the originally targeted element. If it's not, a number of points inside the original's element rect are checked for being the element or its descendants, and the closest descendant nearest the center of the rect is selected.
Note that the W3C (driver-backed) WebDriver (i.e. not legacy mode) requires SmartClientWebDriver to more aggressively check for occlusion, as clicks on occluded elements may silently fail without any exception thrown in W2C WebDriver.
- Parameters:
occludedApproach
- specifies approach to take when click() can't reach the targeted element By coordinates
-
setAllowCoordClickOnOccludingElement
Deprecated.Configures handling of occludedWebElement
s. Under WebDriver v3, this method is better avoided in favor ofsetOccludedElementApproach(com.isomorphic.webdriver.SmartClientWebDriver.OccludedElementApproach)
.- Parameters:
allow
- sets ELEMENT_AT_POINT if true, otherwise ELEMENT strategy
-
setValueTolerance
public void setValueTolerance(long valueTolerance) Sets value tolerance forverifyValueWithTolerance(org.openqa.selenium.By, java.lang.Long)
, and fallback tolerance values forverifyCanvasWidth(org.openqa.selenium.By, long)
andverifyCanvasHeight(org.openqa.selenium.By, long)
.- Parameters:
valueTolerance
- absolute deviation from expected value to allow, inclusive
-
setElementTolerance
public void setElementTolerance(long elementTolerance) Sets tolerance forverifyElementWidthWithTolerance(org.openqa.selenium.By, long)
andverifyElementHeightWithTolerance(org.openqa.selenium.By, long)
.- Parameters:
elementTolerance
- absolute deviation from expected value to allow, inclusive
-
setCanvasWidthTolerance
public void setCanvasWidthTolerance(long canvasWidthTolerance) Sets primary tolerance forverifyCanvasWidth(org.openqa.selenium.By, long)
.- Parameters:
canvasWidthTolerance
- absolute deviation from expected value to allow, inclusive
-
setCanvasHeightTolerance
public void setCanvasHeightTolerance(long canvasHeightTolerance) Sets primary tolerance forverifyCanvasHeight(org.openqa.selenium.By, long)
.- Parameters:
canvasHeightTolerance
- absolute deviation from expected value to allow, inclusive
-
clearTolerances
public void clearTolerances()Resets all tolerances to their default values. -
getElementWidth
public int getElementWidth(org.openqa.selenium.By by) Get width of target element- Parameters:
by
- element locator- Returns:
- width of target element
-
getElementHeight
public int getElementHeight(org.openqa.selenium.By by) Get height of target element- Parameters:
by
- element locator- Returns:
- height of target element
-
getElementPositionLeft
public int getElementPositionLeft(org.openqa.selenium.By by) Get left page offset of target element- Parameters:
by
- element locator- Returns:
- left page offset of target element
-
getElementPositionTop
public int getElementPositionTop(org.openqa.selenium.By by) Get top page offset of target element- Parameters:
by
- element locator- Returns:
- top page offset of target element
-
getValue
Returns value of element associated with locator. Note that due to the underlying JavascriptExecutor rules, a number is always returned as a Long, and in Java num1.equals(num2) will fail even if num1 and num2 represent the same value if num1 is a Long and num2 is an Integer. So you should always compare the result with a Long.In Junit, for example:
verifyEquals(driver.getValue(locator), 1234L)
- Parameters:
scLocator
- locator to SmartClient target whose value is desired- Returns:
- element's value
-
getValueAsString
Similar togetValue(By)
except always returns the value as a String. Uses JavaScript to perform the conversion. SeegetValueAsString(By, boolean)
.- Parameters:
scLocator
- locator to SmartClient target whose value is desired- Returns:
- element's value, as a String
-
getValueAsString
Similar togetValue(By)
except always returns the value as a String. IfasJavaScriptString
is true, the string conversion is done in JavaScript by the browser - otherwise it's done ivia Java toString() APIs. Using JavaScript will produce output closer to Selenese v1 scripts.- Parameters:
scLocator
- locator to SmartClient target whose value is desiredasJavaScriptString
- whether to use JavaScript for the toString() conversion- Returns:
- element's value, as a String
-
setUseFrameworkValueAsFallback
public void setUseFrameworkValueAsFallback(boolean useFrameworkValue) Sets whethergetValue(org.openqa.selenium.By)
should be called on locators as a fallback ifgetText(org.openqa.selenium.By)
is not able to find anything (other than the empty string). If not set, the "value" attribute of the WebElement will be used as the fallback instead. This will typically be the "display value" of the element, rather than its "Framework value" (as returned bygetValue(org.openqa.selenium.By)
). Default is false.- Parameters:
useFrameworkValue
- whether to use the Framework value as the fallback
-
getText
Returns text of element associated with locator, or the value if there's no associated text. (SeesetUseFrameworkValueAsFallback(boolean)
for details on what value is used.)See note in
verifyText(org.openqa.selenium.By)
for how w deal with the fact that WebDriver doesn't convert newlines to spaces in the same way that Selenium v1 did.- Parameters:
by
- element locator- Returns:
- element's text or values
-
getTable
Returns the specified table cell display value.- Returns:
- cell's display value
-
getEval
Simulate Selenium V1's getEval() by evaluating the expression passed in as a series of statements, and returning the value of the last statement as the result.- Parameters:
javaScript
- statements to evaluate- Returns:
- value of last statement
-
getEval
Simulate Selenium V1's getEval() by evaluating the expression passed in as a series of statements, and returning the value of the last statement as the result.If a fallbackValue expression is provided, the entire series of statements will be wrapped in try/catch logic and the fallbackValue will be returned in the event an exception is hit.
- Parameters:
javaScript
- statements to evaluatefallbackValue
- value if exception hit (must be an expression)- Returns:
- value of last statement or fallbackValue
-
setCanvasPropertyTrue
Sets the specified canvas propertytrue
.- Parameters:
scLocator
- canvas locatorpropertyName
- property to set- Returns:
- the old property value
-
setCanvasPropertyFalse
Sets the specified canvas propertyfalse
.- Parameters:
scLocator
- canvas locatorpropertyName
- property to set- Returns:
- the old property value
-
clearCanvasProperty
Clears the specified canvas property by setting itnull
.- Parameters:
scLocator
- canvas locatorpropertyName
- property to clear- Returns:
- the old property value
-
setCanvasProperty
public Object setCanvasProperty(org.openqa.selenium.By scLocator, String propertyName, Object value) Sets the specified canvas property to the provided value.- Parameters:
scLocator
- canvas locatorpropertyName
- property to setvalue
- new property value- Returns:
- the old property value
-
verifyElementWidth
public boolean verifyElementWidth(org.openqa.selenium.By by, long expectedWidth) Verify that target element width matches expected value- Parameters:
by
- element locatorexpectedWidth
- width to match- Returns:
- whether target element width matches expected value
-
verifyElementHeight
public boolean verifyElementHeight(org.openqa.selenium.By by, long expectedHeight) Verify that target element height matches expected value- Parameters:
by
- element locatorexpectedHeight
- height to match- Returns:
- whether target element height matches expected value
-
verifyElementPositionLeft
public boolean verifyElementPositionLeft(org.openqa.selenium.By by, long expectedLeft) Verify that target element left page offset matches expected value- Parameters:
by
- element locatorexpectedLeft
- left page offset to match- Returns:
- whether target element left page offset matches expected value
-
verifyElementPositionTop
public boolean verifyElementPositionTop(org.openqa.selenium.By by, long expectedTop) Verify that target element top page offset matches expected value- Parameters:
by
- element locatorexpectedTop
- top page offset to match- Returns:
- whether target element top page offset matches expected value
-
verifyElementPresent
public boolean verifyElementPresent(org.openqa.selenium.By by) Verify that a given element is present.- Parameters:
by
- element locator- Returns:
- whether the element is present
-
verifyElementVisible
public boolean verifyElementVisible(org.openqa.selenium.By by) Verify that a given element is visible.- Parameters:
by
- element locator- Returns:
- whether the element is visible
-
verifyElementSelected
public boolean verifyElementSelected(org.openqa.selenium.By by) Verify that a given element is selected.- Parameters:
by
- element locator- Returns:
- whether the element is selected
-
verifyElementClickable
public boolean verifyElementClickable(org.openqa.selenium.By scLocator) Verify that a given element is clickable.- Parameters:
scLocator
- element locator- Returns:
- whether the element is clickable
-
verifyElementReadyForKeyPresses
public boolean verifyElementReadyForKeyPresses(org.openqa.selenium.By scLocator) Verify that a given element is ready to receive keypresses.- Parameters:
scLocator
- element locator- Returns:
- whether the element is ready to receive keypresses.
-
verifyCanvasWidth
public boolean verifyCanvasWidth(org.openqa.selenium.By scLocator, long expectedWidth) Verify width of target canvas.- Parameters:
scLocator
- canvas locatorexpectedWidth
- width to match within tolerance- Returns:
- whether canvas's width meets tolerance
-
verifyCanvasHeight
public boolean verifyCanvasHeight(org.openqa.selenium.By scLocator, long expectedHeight) Verify height of target canvas.- Parameters:
scLocator
- canvas locatorexpectedHeight
- height to match within tolerance- Returns:
- whether canvas's height meets tolerance
-
verifyElementWidthWithTolerance
public boolean verifyElementWidthWithTolerance(org.openqa.selenium.By by, long expectedWidth) Verify that target element width matches expected value within tolerance.- Parameters:
by
- element locatorexpectedWidth
- width to match within tolerance- Returns:
- whether target element width is within tolerance of expected value
-
verifyElementHeightWithTolerance
public boolean verifyElementHeightWithTolerance(org.openqa.selenium.By by, long expectedHeight) Verify that target element height matches expected value within tolerance.- Parameters:
by
- element locatorexpectedHeight
- height to match within tolerance- Returns:
- whether target element height is within tolerance of expected value
-
setAllowJavaScriptToStringMatch
public void setAllowJavaScriptToStringMatch(boolean allowJSMatch) Configures whetherSmartClientWebDriver
checks for a JavaScript match when comparing Strings to values, in addition to performing the check against a Java conversion of the value. Default is true.- Parameters:
allowJSMatch
- whether to check for a JavaScript toString() match too
-
verifyValueEmpty
public boolean verifyValueEmpty(org.openqa.selenium.By scLocator) Verifies that target's value is empty. Note that bothnull
and the empty String are considered empty, since by convention Selenium v1's verifyEmptyValue() returns true if no element can be found for the locator - and in that casegetValue(org.openqa.selenium.By)
returns null. An emptyList
is also considered an empty value ifallowCoordClickOnOccludingElement
is true.- Parameters:
scLocator
- locator to SmartClient target to check- Returns:
- whether value is empty
-
verifyValue
Verifies that the target has theBoolean
value expected.- Parameters:
scLocator
- locator to SmartClient target to checkexpected
- Boolean to match- Returns:
- whether value matches expected Boolean
-
verifyValue
Verifies that the target has theLong
value expected.- Parameters:
scLocator
- locator to SmartClient target to checkexpected
- Long to match- Returns:
- whether value matches expected Long
-
verifyValueWithTolerance
Verifies that the target has theLong
value expected within tolerance.- Parameters:
scLocator
- locator to SmartClient target to checkexpected
- Long to match- Returns:
- whether value matches expected Long within tolerance
-
verifyValue
Verifies that the target has theInteger
value expected. Utility method to avoid type casting from Java.- Parameters:
scLocator
- locator to SmartClient target to checkexpected
- Integer to match- Returns:
- whether value matches expected Integer
-
verifyValueWithTolerance
Verifies that the target has theInteger
value expected within tolerance.- Parameters:
scLocator
- locator to SmartClient target to checkexpected
- Integer to match- Returns:
- whether value matches expected Integer within tolerance
-
verifyValue
Verifies that the target matches theString
pattern. Note that the expected String pattern may start with the Selenium v1 specifiers "regex:", "regexp:", "regexi:", "regexpi:", "glob:", and "exact:". As in Selenium v1, "glob:" is the default if no specifier prefix is present, meaning to use globbing.- Parameters:
scLocator
- locator to SmartClient target to checkexpected
- pattern value is expected to match- Returns:
- whether value matches expected String pattern
-
verifyValueWithTolerance
Verifies that the target matches theString
pattern, with any numbers allowed to match literal numbers in the expected String with a tolerance. So for example, an expected String of "10, 20" will match a JavaScript array value of [12, 19] if avalueTolerance
of 10 is in use andJavaScript String matching mode
is active.Note that the expected String pattern may start with the Selenium v1 specifiers "regex:", "regexp:", "regexi:", "regexpi:", "glob:", and "exact:". As in Selenium v1, "glob:" is the default if no specifier prefix is present, meaning to use globbing.
- Parameters:
scLocator
- locator to SmartClient target to checkexpected
- numbers to match with a tolerance, or String matching pattern- Returns:
- whether value matches expected String pattern
-
verifyTextPresent
Verify that the supplied String pattern is presnt somewhere on the page.- Parameters:
expected
- String pattern to match against text on page- Returns:
- whether pattern is presnt somewhere on the page.
-
verifyText
public boolean verifyText(org.openqa.selenium.By by) Verify that the element's text is empty.- Parameters:
by
- element locator- Returns:
- whether element's text is empty.
-
verifyText
Verify that the supplied String pattern matches the element's text. Note that WebDriver doesn't convert newlines to spaces in the same way as Selenium v1, so to avoid scripts failing when run against this API, we by default allow any spaces in the pattern to match any whitespace in the text.- Parameters:
by
- element locatorexpected
- String pattern to match against the element's text.- Returns:
- whether pattern matches the target's text.
-
verifyTextPresent
Verify that the supplied String pattern is contained in the element's text. Note that WebDriver doesn't convert newlines to spaces in the same way as Selenium v1, so to avoid scripts failing when run against this API, we by default allow any spaces in the pattern to match any whitespace in the text.- Parameters:
by
- element locatorexpected
- String pattern that should be contained by the element's text.- Returns:
- whether pattern is caonted in the target's text.
-
verifyTitle
Verify that the supplied String pattern matches the page title. Note that WebDriver doesn't convert newlines to spaces in the same way as Selenium v1, so to avoid scripts failing when run against this API, we by default allow any spaces in the pattern to match any whitespace in the text.- Parameters:
expected
- String pattern to match against the page title.- Returns:
- whether pattern matches the title text.
-
verifyTable
Verify that specified table cell display value matches the expected String pattern. Whitespace at either end is ignored and the Selenium v1 matching prefixes mentioned inverifyValue(By,String)
are supported.- Parameters:
scLocator
- cell locatorrow
- target cell rowcol
- target cell colexpected
- String pattern to match against the cell display value- Returns:
- whether pattern matches the cell display value
-
assertEval
Assert that the specified JavaScript script evaluates to empty String or null. SeeassertEval(String,String,boolean)
.- Parameters:
javaScript
- script to run- Returns:
- true if script evaluates to empty String or null, else false
-
assertEval
Assert that the specified JavaScript script evaluates equal to the expected value. SeeassertEval(String,String,boolean)
.- Parameters:
javaScript
- script to runexpected
- pattern to match against value of script- Returns:
- true if script evaluates to true, else false
-
assertEval
Assert that the specified JavaScript script evaluates equal to the expected value. SeeassertEval(String,String,boolean)
.- Parameters:
javaScript
- script to runexpected
- pattern to match against value of scriptasJavaScriptString
- whether to convert the result to a String in JavaScript before returning to Java; (e.g. [1,2] will become "1,2")- Returns:
- true if script evaluates to true, else false
-
assertEval
Assert that the specified JavaScript script evaluates equal to the expected value. SeeassertEval(String,String,boolean)
.- Parameters:
javaScript
- script to runexpected
- pattern to match against value of script- Returns:
- true if script evaluates to true, else false
-
assertEval
Assert that the specified JavaScript script evaluates equal to the expected value. Note that the script is expected to be a sequence of statements ending in an expression taken as the script's value. It should not contain any return statement as you need inexecuteScript(java.lang.String, java.lang.Object...)
. (This is for back compatibility with Selenium v1.)Note that
assertEval
is similar towaitForEval(java.lang.String, java.lang.String)
except that the comparison is made immediately and no waiting ever occurs.- Parameters:
javaScript
- script to runexpected
- pattern to match against value of scriptasJavaScriptString
- whether to convert the result to a String in JavaScript before returning to Java; (e.g. [1,2] will become "1,2")- Returns:
- true if script evaluates to true, else false
-
waitForElementClickable
public boolean waitForElementClickable(org.openqa.selenium.By scLocator) Wait until a given element responds positively to the isElementClickable() call.- Parameters:
scLocator
- element locator- Returns:
- True if the element responded positively in time. False if timed out while trying
- See Also:
-
waitForElementClickable
public boolean waitForElementClickable(org.openqa.selenium.By scLocator, long timeoutInSeconds) Wait until a given element responds positively to the isElementClickable() call.- Parameters:
scLocator
- element locatortimeoutInSeconds
- seconds to wait (ignored if non-positive - default used)- Returns:
- True if the element responded positively in time. False if timed out while trying
-
waitForElementNotClickable
public boolean waitForElementNotClickable(org.openqa.selenium.By scLocator) Wait until a given element responds negatively to the isElementClickable() call.- Parameters:
scLocator
- element locator- Returns:
- True if the element responded negatively in time. False if timed out while trying
- See Also:
-
waitForElementNotClickable
public boolean waitForElementNotClickable(org.openqa.selenium.By scLocator, long timeoutInSeconds) Wait until a given element responds negatively to the isElementClickable() call.- Parameters:
scLocator
- element locatortimeoutInSeconds
- seconds to wait (ignored if non-negative - default used)- Returns:
- True if the element responded negatively in time. False if timed out while trying
-
waitForElementVisible
public boolean waitForElementVisible(org.openqa.selenium.By by) Wait until a given element becomes visible.- Parameters:
by
- element locator- Returns:
- True if the element becomes visible time. False if timed out while checking
- See Also:
-
waitForElementVisible
public boolean waitForElementVisible(org.openqa.selenium.By by, long timeoutInSeconds) Wait until a given element becomes visible.- Parameters:
by
- element locatortimeoutInSeconds
- seconds to wait (ignored if non-positive - default used)- Returns:
- True if the element becomes visible time. False if timed out while checking
-
waitForElementPresent
public boolean waitForElementPresent(org.openqa.selenium.By by) Wait until a given element is present.- Parameters:
by
- target element- Returns:
- True if the element is present in time. False if timed out while trying
-
waitForElementPresent
public boolean waitForElementPresent(org.openqa.selenium.By by, long timeoutInSeconds) Wait until a given element is present.- Parameters:
by
- target elementtimeoutInSeconds
- seconds to wait (ignored if non-positive - default used)- Returns:
- True if the element is present in time. False if timed out while trying
-
waitForElementNotPresent
public boolean waitForElementNotPresent(org.openqa.selenium.By by) Wait until a given element is no longer present.- Parameters:
by
- target element- Returns:
- True if the element is not present in time. False if timed out while trying
-
waitForElementNotPresent
public boolean waitForElementNotPresent(org.openqa.selenium.By by, long timeoutInSeconds) Wait until a given element is no longer present.- Parameters:
by
- target elementtimeoutInSeconds
- seconds to wait (ignored if non-positive - default used)- Returns:
- True if the element is not present in time. False if timed out while trying
-
waitForElementNotVisible
public boolean waitForElementNotVisible(org.openqa.selenium.By by) Wait until a given element is no longer visible.- Parameters:
by
- element locator- Returns:
- True if the element becomes not visible time. False if timed out while checking
- See Also:
-
waitForElementNotVisible
public boolean waitForElementNotVisible(org.openqa.selenium.By by, long timeoutInSeconds) Wait until a given element is no longer visible.- Parameters:
by
- element locatortimeoutInSeconds
- seconds to wait (ignored if non-positive - default used)- Returns:
- True if the element becomes not visible time. False if timed out while checking
-
waitForElementReadyForKeyPresses
public boolean waitForElementReadyForKeyPresses(org.openqa.selenium.By scLocator) Wait until a given element responds positively to the isElementReadyForKeyPresses() call.- Parameters:
scLocator
- target element- Returns:
- True if the element responded positively in time. False if timed out while trying
-
waitForElementReadyForKeyPresses
public boolean waitForElementReadyForKeyPresses(org.openqa.selenium.By scLocator, long timeoutInSeconds) Wait until a given element responds positively to the isElementReadyForKeyPresses() call.- Parameters:
scLocator
- target elementtimeoutInSeconds
- seconds to wait (ignored if non-positive - default used)- Returns:
- True if the element responded positively in time. False if timed out while trying
-
waitForElementInViewport
public boolean waitForElementInViewport(org.openqa.selenium.By scLocator) Wait until a given element has been scrolled into the browser viewport.- Parameters:
scLocator
- target element- Returns:
- True if the element is in viewport in time. False if timed out while trying
-
waitForElementInViewport
public boolean waitForElementInViewport(org.openqa.selenium.By scLocator, long timeoutInSeconds) Wait until a given element has been scrolled into the browser viewport.- Parameters:
scLocator
- target elementtimeoutInSeconds
- seconds to wait (ignored if non-positive - default used)- Returns:
- True if the element is in viewport in time. False if timed out while trying
-
waitForCanvasDone
public boolean waitForCanvasDone(org.openqa.selenium.By scLocator) Wait until a targetCanvas
responds positively to the isCanvasDone() call.- Parameters:
scLocator
- target canvas- Returns:
- True if the canvas responded positively in time. False if timed out while trying
-
waitForCanvasDone
public boolean waitForCanvasDone(org.openqa.selenium.By scLocator, long timeoutInSeconds) Wait until a targetCanvas
responds positively to the isCanvasDone() call.- Parameters:
scLocator
- target canvastimeoutInSeconds
- seconds to wait (ignored if non-positive - default used)- Returns:
- True if the canvas responded positively in time. False if timed out while trying
-
waitForGridDone
public boolean waitForGridDone(org.openqa.selenium.By scLocator) Wait until a targetListGrid
responds positively to the isGridDone() call.- Parameters:
scLocator
- target grid- Returns:
- True if the grid responded positively in time. False if timed out while trying
-
waitForGridDone
public boolean waitForGridDone(org.openqa.selenium.By scLocator, long timeoutInSeconds) Wait until a targetListGrid
responds positively to the isGridDone() call.- Parameters:
scLocator
- target gridtimeoutInSeconds
- seconds to wait (ignored if non-positive - default used)- Returns:
- True if the grid responded positively in time. False if timed out while trying
-
waitForGridDone
Wait until a targetListGrid
responds positively to the isGridDone() call.- Parameters:
scLocator
- target gridincludeEdits
- whether to check for pending (unsaved) edits- Returns:
- True if the grid responded positively in time. False if timed out while trying
-
waitForGridDone
public boolean waitForGridDone(org.openqa.selenium.By scLocator, Boolean includeEdits, long timeoutInSeconds) SeewaitForGridDone(org.openqa.selenium.By)
. Wait until a targetListGrid
responds positively to the isGridDone() call.- Parameters:
scLocator
- target gridincludeEdits
- whether to check for pending (unsaved) editstimeoutInSeconds
- seconds to wait (ignored if non-positive - default used)- Returns:
- True if the grid responded positively in time. False if timed out while trying
-
waitForTileGridDone
public boolean waitForTileGridDone(org.openqa.selenium.By scLocator) Wait until a targetTileGrid
responds positively to the isTileGridDone() call.- Parameters:
scLocator
- target grid- Returns:
- True if the grid responded positively in time. False if timed out while trying
-
waitForTileGridDone
public boolean waitForTileGridDone(org.openqa.selenium.By scLocator, long timeoutInSeconds) Wait until a targetTileGrid
responds positively to the isTileGridDone() call.- Parameters:
scLocator
- target gridtimeoutInSeconds
- seconds to wait (ignored if non-positive - default used)- Returns:
- True if the grid responded positively in time. False if timed out while trying
-
waitForTileLayoutDone
public boolean waitForTileLayoutDone(org.openqa.selenium.By scLocator) Wait until a targetTileLayout
responds positively to the isTileLayoutDone() call.- Parameters:
scLocator
- target tileLayout- Returns:
- True if the tileLayout responded positively in time. False if timed out while trying
-
waitForTileLayoutDone
public boolean waitForTileLayoutDone(org.openqa.selenium.By scLocator, long timeoutInSeconds) Wait until a targetTileLayout
responds positively to the isTileLayoutDone() call.- Parameters:
scLocator
- target tileLayouttimeoutInSeconds
- seconds to wait (ignored if non-positive - default used)- Returns:
- True if the tileLayout responded positively in time. False if timed out while trying
-
waitForFormDone
public boolean waitForFormDone(org.openqa.selenium.By scLocator) Wait until a targetDynamicForm
responds positively to the isFormDone() call.- Parameters:
scLocator
- target form- Returns:
- True if the form responded positively in time. False if timed out while trying
-
waitForFormDone
public boolean waitForFormDone(org.openqa.selenium.By scLocator, long timeoutInSeconds) Wait until a targetDynamicForm
responds positively to the isFormDone() call.- Parameters:
scLocator
- target formtimeoutInSeconds
- seconds to wait (ignored if non-positive - default used)- Returns:
- True if the form responded positively in time. False if timed out while trying
-
waitForItemDone
public boolean waitForItemDone(org.openqa.selenium.By scLocator) Wait until a targetFormItem
responds positively to the isItemDone() call.- Parameters:
scLocator
- target item- Returns:
- True if the item responded positively in time. False if timed out while trying
-
waitForItemDone
public boolean waitForItemDone(org.openqa.selenium.By scLocator, long timeoutInSeconds) Wait until a targetFormItem
responds positively to the isItemDone() call.- Parameters:
scLocator
- target itemtimeoutInSeconds
- seconds to wait (ignored if non-positive - default used)- Returns:
- True if the item responded positively in time. False if timed out while trying
-
waitForSystemDone
public boolean waitForSystemDone()Wait until a given element responds positively to the isSystemDone() call.- Returns:
- True if the element responded positively in time. False if timed out while trying
-
waitForSystemDone
public boolean waitForSystemDone(long timeoutInSeconds) Wait until a given element responds positively to the isSystemDone() call.- Parameters:
timeoutInSeconds
- seconds to wait (ignored if non-positive - default used)- Returns:
- True if the element responded positively in time. False if timed out while trying
-
waitForSystemDone
Wait until a given element responds positively to the isSystemDone() call.- Parameters:
includeRedraws
- whether to check for pending redraws- Returns:
- True if the element responded positively in time. False if timed out while trying
-
waitForSystemDone
Wait until a given element responds positively to the isSystemDone() call.- Parameters:
includeRedraws
- whether to check for pending redrawsincludeEdits
- whether to check for pending (unsaved) edits- Returns:
- True if the element responded positively in time. False if timed out while trying
-
waitForSystemDone
public boolean waitForSystemDone(Boolean includeRedraws, Boolean includeEdits, long timeoutInSeconds) Wait until a given element responds positively to the isSystemDone() call.- Parameters:
includeRedraws
- whether to check for pending redrawsincludeEdits
- whether to check for pending (unsaved) editstimeoutInSeconds
- seconds to wait (ignored if non-positive - default used)- Returns:
- True if the element responded positively in time. False if timed out while trying
-
waitForSystemDone
Wait until a given element responds positively to the isSystemDone() call.- Parameters:
includePropList
- controls what to check when looking at whether system is "done" specified as a comma-separated list of properties to include- Returns:
- True if the element responded positively in time. False if timed out while trying
-
waitForSystemDone
Wait until a given element responds positively to the isSystemDone() call.- Parameters:
includePropList
- controls what to check when looking at whether system is "done" specified as a comma-separated list of properties to includetimeoutInSeconds
- seconds to wait (ignored if non-positive - default used)- Returns:
- True if the element responded positively in time. False if timed out while trying
-
waitForSystemDone
public boolean waitForSystemDone(com.isomorphic.webdriver.SystemDoneConfig config) Wait until a given element responds positively to the isSystemDone() call.- Parameters:
config
- controls what to check when looking at whether system is "done"- Returns:
- True if the element responded positively in time. False if timed out while trying
-
waitForSystemDone
public boolean waitForSystemDone(com.isomorphic.webdriver.SystemDoneConfig config, long timeoutInSeconds) Wait until a given element responds positively to the isSystemDone() call.- Parameters:
config
- controls what to check when looking at whether system is "done"timeoutInSeconds
- seconds to wait (ignored if non-positive - default used)- Returns:
- True if the element responded positively in time. False if timed out while trying
-
waitForText
Wait until a given element has a particular text value. SeeverifyText(org.openqa.selenium.By)
.- Parameters:
by
- target elementexpected
- String pattern to match against the element's text.- Returns:
- True if the element responded positively in time. False if timed out while trying
-
waitForText
Wait until a given element has a particular text value. SeeverifyText(org.openqa.selenium.By)
.- Parameters:
by
- target elementexpected
- String pattern to match against the element's text.timeoutInSeconds
- seconds to wait (ignored if non-positive - default used)- Returns:
- True if the element responded positively in time. False if timed out while trying
-
waitForHoverTextPresent
Wait until the hover canvas shows a particular text value. SeeverifyText(org.openqa.selenium.By)
. SeewaitForHoverTextPresent(String,long)
.- Parameters:
expected
- String pattern to match against the hover canvas' contents- Returns:
- True if the element responded positively in time. False if timed out while trying
-
waitForHoverTextPresent
Wait until the hover canvas shows a particular text value. SeeverifyText(org.openqa.selenium.By)
. Note that for backward compatibilty, this API assumes the pattern is a regex, but you can override that as specified in the documentation forverifyValue(org.openqa.selenium.By, java.lang.Boolean)
.- Parameters:
expected
- String pattern to match against the hover canvas' contentstimeoutInSeconds
- seconds to wait (ignored if non-positive - default used)- Returns:
- True if the element responded positively in time. False if timed out while trying
-
waitForValue
Wait until a target matches theString
pattern. SeeverifyValue(org.openqa.selenium.By, java.lang.Boolean)
.- Parameters:
scLocator
- locator to SmartClient target to checkexpected
- pattern value is expected to match- Returns:
- True if the element responded positively in time. False if timed out while trying
-
waitForValue
public boolean waitForValue(org.openqa.selenium.By scLocator, Object expected, long timeoutInSeconds) Wait until a target matches theString
pattern. SeeverifyValue(org.openqa.selenium.By, java.lang.Boolean)
.- Parameters:
scLocator
- locator to SmartClient target to checkexpected
- pattern value is expected to matchtimeoutInSeconds
- seconds to wait (ignored if non-positive - default used)- Returns:
- True if the element responded positively in time. False if timed out while trying
-
waitForCondition
Wait for a javascript expression to evaluate to true. SeewaitForCondition(String,long)
.- Parameters:
javaScript
- script to run
-
waitForCondition
Wait for a javascript expression to evaluate to true. Note that for backward compatibility with Selenium v1, any value that satisfies !!value == true in javascript will satisfy the wait. Any JavaScript exception occurring outside outside try/catch blocks during the evaluation will propagate out of this method as a JavascriptException.- Parameters:
javaScript
- script to runtimeoutInSeconds
- seconds to wait (ignored if non-positive - default used)
-
waitForCondition
Wait for a javascript script to execute and return true. This method accepts a script suitable for direct execution by WebDriver's JavascriptExecutor, so if you don't provide a return statement, it will identically return null and always time out. No conversion is done on the result, so to satisfy the wait, an actual Boolean.TRUE must be returned by the JavascriptExecutor.You may pass one or more arguments to this variant, and they're referenced just as in native calls to the WebDriver JavascriptExecutor (e.g. "arguments[0]").
- Parameters:
javaScript
- script to runargument
- object to pass as argument to scripttimeoutInSeconds
- seconds to wait (ignored if non-positive - default used)
-
waitForEval
Wait for a javascript expression to evaluate to a value that matches the supplied String pattern under the rules described inverifyValue(org.openqa.selenium.By, java.lang.Boolean)
. SeewaitForEval(String,String,long)
.- Parameters:
javaScript
- script to runexpected
- pattern to match against value of script
-
waitForEval
Wait for a javascript expression to evaluate to a value that matches the supplied String pattern under the rules described inverifyValue(org.openqa.selenium.By, java.lang.Boolean)
. Script should be in Selenium v1 format - a sequence of statements, with the last statement being a valid expression. That expression will be the value of the script - the script should contain no return statement.- Parameters:
javaScript
- script to runexpected
- pattern to match against value of scripttimeoutInSeconds
- seconds to wait (ignored if non-positive - default used)
-
waitForFrameToLoad
Wait until a frame has loaded.- Parameters:
frameLocator
- locatortimeoutInSeconds
- seconds to wait- Returns:
- True if the frame loads in time. False if timed out while trying
-
setBaseUrl
Set the Base URL against which tests will run- Parameters:
baseUrl
- new base URL
-
get
Fetch a URL relative to the baseURL.- Parameters:
relativeUrl
- relative URL
-
get
Fetch a URL relative to the baseURL.- Parameters:
relativeUrl
- relative urlmaximize
- whether to maximize window
-
pause
public void pause(long waitInMillis) Wait for the specified amount of time.- Parameters:
waitInMillis
- amount of time, in milliseconds, to wait
-
selectWindowByName
Switch to window specified by name.- Parameters:
name
- name of window to switch to
-
selectWindowByTitle
Switch to window specified by title.- Parameters:
title
- title of window to switch to
-
scrollIntoViewIfNeeded
public void scrollIntoViewIfNeeded(org.openqa.selenium.By by) Scroll the target into view if it's not already in view. SeescrollIntoViewIfNeeded(By,WebElement)
.- Parameters:
by
- target locator
-
scrollIntoViewIfNeeded
public boolean scrollIntoViewIfNeeded(org.openqa.selenium.By by, org.openqa.selenium.WebElement element) Scroll the target into view if it's not already in view. For non SmartClient locators, this blindly calls scrollIntoView() in JavaScript on the DOM element. For SmartClient locators, we only call that API if it appears the target element is occluded at the locator coords.- Parameters:
by
- target locatorelement
- target element (only used in non-ByScLocator case)- Returns:
- whether scrollIntoView() was called on target element
-
click
Send a single click to the locator target.- Parameters:
by
- target element or widget - if null then the previous element- Returns:
- Itself, in order to allow chaining calls.
-
secondClick
Send a second click to the locator target.- Parameters:
by
- target element or widget - if null then the previous element- Returns:
- Itself, in order to allow chaining calls.
-
doubleClick
Send a double click to the locator target. This is just a convenience method that first callsclick(By)
and thensecondClick(By)
.- Parameters:
by
- target element or widget - if null then the previous element- Returns:
- Itself, in order to allow chaining calls.
-
clickAndHold
Equivalent of our "mouseDown", sent to locator target.- Parameters:
by
- target element or widget - if null then the previous element- Returns:
- Itself, in order to allow chaining calls.
-
clickAndHoldAt
Equivalent of our "mouseDown", sent to an offset from locator target's left, top corner.- Parameters:
by
- target element or widget - if null then the previous elementxOffset
- horizontal offset from target's left edgeyOffset
- vertical offset from target's top edge- Returns:
- Itself, in order to allow chaining calls.
-
release
Equivalent of our "mouseUp", sent to the locator target.- Parameters:
by
- target element or widget - if null then the previous element- Returns:
- Itself, in order to allow chaining calls.
-
releaseAt
Equivalent of our "mouseUp", sent to an offset from locator target's left, top corner.- Parameters:
by
- target element or widget - if null then the previous elementxOffset
- horizontal offset from target's left edgeyOffset
- vertical offset from target's top edge- Returns:
- Itself, in order to allow chaining calls.
-
contextClick
Send a context (right) click to the locator target.- Parameters:
by
- target element or widget - if null then the previous element- Returns:
- Itself, in order to allow chaining calls.
-
mouseMove
Simulate a mouseOver for the locator target.- Parameters:
by
- target element or widget - if null then the previous element- Returns:
- Itself, in order to allow chaining calls.
-
mouseMoveAt
Simulate a mouseOver at an offset from locator target's left, top corner.- Parameters:
by
- target element or widget - if null then the previous elementxOffset
- horizontal offset from target's left edgeyOffset
- vertical offset from target's top edge- Returns:
- Itself, in order to allow chaining calls.
-
dragAndDrop
public SmartClientWebDriver dragAndDrop(org.openqa.selenium.By sourceBy, org.openqa.selenium.By targetBy) Simulate a drag-and-drop from the source locator to the target locator.- Parameters:
sourceBy
- Indicates the element to drag. If null then the previous element.targetBy
- The destination- Returns:
- Itself, in order to allow chaining calls.
-
dragAndDrop
Deprecated.use the variant that takes separate coordinate offsetsSimulate a drag-and-drop from the source locator by the encoded String offset. Note that this variant is only for backcompat with Selenium v1. If you're writing new WebDriver tests, you should usedragAndDropBy(By,int,int)
instead.- Parameters:
sourceBy
- Indicates the element to drag. If null then the previous element.offset
- Selenese compatible string arg. Eg: "-70,+0"- Returns:
- Itself, in order to allow chaining calls.
-
dragAndDropBy
public SmartClientWebDriver dragAndDropBy(org.openqa.selenium.By sourceBy, int xOffset, int yOffset) Simulate a drag-and-drop from the source locator by the horizontal and vertical offsets.- Parameters:
sourceBy
- Indicates the element to drag. If null then the previous element.- Returns:
- Itself, in order to allow chaining calls.
-
sendKeys
Send a sequence of keys to the locator target.- Parameters:
by
- Indicates the target of keystrokes. If null then the previous element.keysToSend
- the String of keys to send- Returns:
- Itself, in order to allow chaining calls.
-
type
Sends an empty String to the target, clearing it if it's an editable text element. Similar tosendKeys(org.openqa.selenium.By, java.lang.String)
to support Selenese conversion.- Parameters:
by
- Indicates the target of keystrokes. If null then the previous element.- Returns:
- Itself, in order to allow chaining calls.
-
type
Clears target if it's an editable text element. Regardless then sends it the specified String of keys. Similar tosendKeys(org.openqa.selenium.By, java.lang.String)
to support selenese conversion.- Parameters:
by
- Indicates the target of keystrokes. If null then the previous element.keysToSend
- keys to send- Returns:
- Itself, in order to allow chaining calls.
-
type
Alternative tosendKeys(By,String)
taking a single key as a Long.- Parameters:
by
- Indicates the target of keystrokes. If null then the previous element.keyToSend
- Long to send as text- Returns:
- Itself, in order to allow chaining calls.
-
sendData
Similar totype(org.openqa.selenium.By)
except returns whether the element actually got cleared before the new value was typed, and sends a Keys.TAB to the target after typing the value.- Parameters:
by
- Indicates the target of keystrokes. If null then the previous element.keysToSend
- keys to send- Returns:
- whether the element was successfully cleared
-
keyPress
Sends a single keystroke to the target.- Parameters:
by
- target of keystrokes (currently ignored)charToSend
- Javascript key code for a modifier key- Returns:
- Itself, in order to allow chaining calls.
-
keyPress
Similar tosendKeys(org.openqa.selenium.By, java.lang.String)
to support Selenese conversion.- Parameters:
by
- target of keystrokes (currently ignored)keysToSend
- keys to send- Returns:
- Itself, in order to allow chaining calls.
-
keyDown
Send a modifer key down event to the locator target.- Parameters:
by
- target of keystrokes (currently ignored except for ENTER)charToSend
- Javascript key code for a modifier key- Returns:
- Itself, in order to allow chaining calls.
-
keyUp
Send a modifer key up event to the locator target.- Parameters:
by
- target of keystrokes (currently ignored)charToSend
- Javascript key code for a modifier key- Returns:
- Itself, in order to allow chaining calls.
-
keyDown
Send a modifer key down event to the locator target.- Parameters:
by
- Indicates the target of keystrokes. If null then the previous element.theKey
- modifier key- Returns:
- Itself, in order to allow chaining calls.
-
keyUp
Send a modifer key up event to the locator target.- Parameters:
by
- Indicates the target of keystrokes. If null then the previous element.theKey
- modifier key- Returns:
- Itself, in order to allow chaining calls.
-
shiftKeyDown
To Support Selenese. This causes a keydown on key 16- Returns:
- Itself, in order to allow chaining calls.
-
shiftKeyUp
To Support Selenese. This causes a keyup on key 16- Returns:
- Itself, in order to allow chaining calls.
-
controlKeyDown
To Support Selenese. This causes a keydown on key 17- Returns:
- Itself, in order to allow chaining calls.
-
controlKeyUp
To Support Selenese. This causes a keyup on key 17- Returns:
- Itself, in order to allow chaining calls.
-
focus
Set focus into the target element or canvas.- Parameters:
by
- focus target- Returns:
- Itself, in order to allow chaining calls.
-
focus
Set focus into the target element or canvas.- Parameters:
by
- focus targetclearModifiers
- whether to attempt to clear "stuck" modifier keys- Returns:
- Itself, in order to allow chaining calls.
-
focus
public SmartClientWebDriver focus(org.openqa.selenium.By by, boolean clearModifiers, boolean refocus) Set focus into the target element or canvas.- Parameters:
by
- focus targetclearModifiers
- whether to attempt to clear "stuck" modifier keysrefocus
- whether to refocus instead of no-oping if focus target already has focus- Returns:
- Itself, in order to allow chaining calls.
-
blur
Blurs the target element or canvas.- Parameters:
by
- blur target- Returns:
- Itself, in order to allow chaining calls.
-
showConsole
public void showConsole()Show the developer console. -
setClientLogLevel
Sets client log level for a category as number. Note that ERROR is 2, WARN is 3, INFO is 4, etc.- Parameters:
category
- logging categorylevel
- numerical logging level to set
-
setClientLogLevel
Sets client log level for a category using log priority name. Note that valid priority names are "FATAL", "ERROR", "WARN", "INFO", and "DEBUG".- Parameters:
category
- logging categorylevel
- named logging level to set
-
setServerLogLevel
Sets server log level for a category using log priority name. This method will wait for the SmartClient Framework to be loaded so server communication is possible. Note that valid priority names are "FATAL", "ERROR", "WARN", "INFO", and "DEBUG".- Parameters:
category
- logging categorylevel
- named logging level to set
-