Class UiElement
- All Implemented Interfaces:
com.workfusion.rpa.internal.api.element.WebElement,org.openqa.selenium.interactions.Locatable,org.openqa.selenium.SearchContext,org.openqa.selenium.TakesScreenshot,org.openqa.selenium.WebElement,org.openqa.selenium.WrapsElement
WebElement and provides new functionality.
- Samples
$("#errorMessage").shouldBe(visible, enabled).click();$("td").parent().doubleClick();$(".edit").pressBackSpace();
Driver model
This class does not talk to a browser directly. It operates on the RPA
Driver, which is a façade over one of the real automation
backends:
- Web — a Selenium 4 based driver automating a browser;
- Desktop — a driver automating a native desktop application's UI (not a browser);
- Universal — supports both web and desktop targets.
Although the API surface reuses Selenium types (such as By and Coordinates), a
given call may ultimately be carried out by the desktop driver rather than by a browser. Each
method below is tagged with a Driver Type listing the backend(s) that support
it; invoking a method on an unsupported backend throws IllegalStateException (e.g.
setText(Object) is Desktop-only, innerHtml() is Web-only). Methods with no tag
work on any backend.
Coordinates and offsets
All mouse methods that accept an (offsetX, offsetY) pair (for example
click(int, int), doubleClick(int, int), contextClick(int, int))
measure the offset from the TOP-LEFT corner of the element's bounding
rectangle, in pixels:
offsetXgrows to the right;offsetYgrows downward;(0, 0)is the top-left corner of the element itself.
This is intentionally different from the Selenium 4 Actions
convention, where click(element, x, y) measures offsets from the element's center.
To keep the simpler top-left-based addressing, these methods convert the top-left offset into the
center-relative offset Selenium 4 expects (subtracting centerX()/centerY()) before
delegating to Actions. See recalculateOffsetToCenter(int, int).
The helpers left(), top(), right(), bottom(),
centerX() and centerY() return element-local coordinates (relative to the
top-left corner) and can be passed straight back in as offsets, e.g.
element.click(element.centerX(), element.centerY()) clicks the element's center.
- Coordinate samples
$("[CLASS:Edit]").click(5, 5);— click 5px right and 5px down from the element's top-left corner.$("[CLASS:Edit]").click(left(), top());— click the top-left corner itself (left()andtop()are both0).UiElement btn = $("[CLASS:Button]"); btn.click(btn.centerX(), btn.centerY());— click the element's center; equivalent to a plainbtn.click()but explicit about the target point.$("[CLASS:Edit]").doubleClick(0, bottom());— double-click the bottom-left corner (bottom()is the element height).
-
Method Summary
Modifier and TypeMethodDescriptionDriver Type: Desktop, WebDriver Type: Desktop, Web$(org.openqa.selenium.By selector) Driver Type: Desktop, Web$(org.openqa.selenium.By selector, int index) Driver Type: Desktop, WebDriver Type: Desktop, Web$$(org.openqa.selenium.By selector) Driver Type: Desktop, WebAppend given text to the text field.Get the attribute of the element.intbottom()Bottom edge of the element in element-local coordinates (relative to its top-left corner).intcenterX()Horizontal center of the element relative to its top-left corner.intcenterY()Vertical center of the element relative to its top-left corner.voidclear()Clears the text of this input or textarea element.voidclick()Click the elementclick(int clicks) Click the element number of timesclick(int offsetX, int offsetY) Left-click the element at a point offset from its TOP-LEFT corner.click(int clicks, int offsetX, int offsetY) Left-click the element a given number of times at a point offset from its TOP-LEFT corner.Find closes ancestor element matching given criteria.Click with right mouse button on this elementcontextClick(int offsetX, int offsetY) Right-click (context-click) the element at a point offset from its TOP-LEFT corner.Copies selected textDouble click the elementdoubleClick(int offsetX, int offsetY) Double-click the element at a point offset from its TOP-LEFT corner.booleanTwoUiElements are equal when they are of the same class and wrap equal underlying elements.Find the first matching element inside given elementFind the Nth matching element inside given elementfind(org.openqa.selenium.By selector) Find the first matching element inside given elementfind(org.openqa.selenium.By selector, int index) Find the Nth matching element inside given elementShort form ofwebDriver.findElements(thisElement, By.cssSelector(cssSelector))findAll(org.openqa.selenium.By selector) Short form ofwebDriver.findElements(thisElement, selector)com.workfusion.rpa.internal.api.element.WebElementfindElement(org.openqa.selenium.By by) Finds the first descendant element matching the given criteria.List<org.openqa.selenium.WebElement> findElements(org.openqa.selenium.By by) Finds all descendant elements matching the given criteria.booleanfocus()Sets input focus on this element.Gets the value of the given attribute.org.openqa.selenium.interactions.CoordinatesReturns theCoordinatesof this element, used by mouse interactions to address it.Gets the value of a CSS property of this element.getDomAttribute(String name) Gets the value of the given attribute as declared in the DOM markup, without any property normalization.getDomProperty(String name) Gets the value of the given DOM property (the current, possibly script-updated value), as opposed to the static markup attribute.getId()org.openqa.selenium.Pointorg.openqa.selenium.RectanglegetRect()<X> XgetScreenshotAs(org.openqa.selenium.OutputType<X> outputType) Captures a screenshot of this element in the requested output form.Find selected option from this select fieldGet text of selected option in select fieldGet value of selected option in select fieldorg.openqa.selenium.SearchContextReturns the shadow root hosted by this element, allowing queries into its shadow DOM.org.openqa.selenium.DimensiongetSize()getText()Get the visible text of this elementGet the currently selected (highlighted) text of this element.getValue()Get the "value" attribute of the elementcom.workfusion.rpa.internal.api.element.WebElementReturns the underlyingWebElementthis object wraps.booleanhas(com.workfusion.rpa.helpers.conditionsnative.UiCondition condition) Return true iff element matches given conditioninthashCode()hover()Emulate "mouseOver" event.Get the HTML code of the element with children.Get the text code of the element with children.booleanis(com.workfusion.rpa.helpers.conditionsnative.UiCondition condition) Return true if element matches given conditionbooleanbooleanbooleanisExists()Deprecated.from 9.2, it will be delete in 10.0booleanCheck if image is properly loaded.booleanintleft()Left edge of the element in element-local coordinates (relative to its top-left corner).name()Get the "name" attribute of the elementparent()Get parent element of this element For example, $("td").parent() could give some "tr".Press BACK_SPACE.Send CTRL+A.Send CTRL+C.Send CTRL+SHIFT+Z.Send CTRL+V.Send CTRL+X.Send CTRL+Z.Press ENTER.Press ESCAPE.Press SPACE.pressTab()Press TAB.intright()Right edge of the element in element-local coordinates (relative to its top-left corner).scrollDown(int times) Moves mouse cursor to the center of element and scrolls down number of times.scrollTo()Ask browser to scroll to this elementscrollUp(int times) Moves mouse cursor to the center of element and scrolls up number of times.Sample: String selectedText = $("[CLASS:Edit; INSTANCE:1]") .append("some text") .selectAllTextAndCopy();selectOption(int index) Select an option from dropdown list (by index)selectOption(String text) Select an option from dropdown list (by text)selectOptionByValue(String value) Select an option from dropdown list (by value)voidsendKeys(CharSequence... charSequences) Types the given key sequence into the element.Types the given value into the element, converting it to text first.sendKeysWithFocus(Object text) It scrolls to the element, moves cursor to it and then performs sendKeys.setSelected(boolean selected) Set checkbox/radio state to CHECKED or UNCHECKED.Sets given text to a text fieldClear the text field and enter given text.should(com.workfusion.rpa.helpers.conditionsnative.UiCondition condition) Checks that given element meets all of given conditions.should(com.workfusion.rpa.helpers.conditionsnative.UiCondition... conditions) Checks that the element meets all of the given conditions immediately (no waiting).should(com.workfusion.rpa.helpers.conditionsnative.UiCondition condition1, com.workfusion.rpa.helpers.conditionsnative.UiCondition condition2) Checks that the element meets both of the given conditions immediately (no waiting).shouldBe(com.workfusion.rpa.helpers.conditionsnative.UiCondition condition) Synonym forshould(UiCondition)reading as "be"; checked immediately.shouldBe(com.workfusion.rpa.helpers.conditionsnative.UiCondition... conditions) Synonym forshould(UiCondition...)}.shouldHave(com.workfusion.rpa.helpers.conditionsnative.UiCondition condition) Synonym forshould(UiCondition)reading as "have"; checked immediately.shouldHave(com.workfusion.rpa.helpers.conditionsnative.UiCondition... conditions) Synonym forshould(UiCondition...)}.shouldNot(com.workfusion.rpa.helpers.conditionsnative.UiCondition condition) Checks that the element does NOT meet the given condition immediately (no waiting).shouldNot(com.workfusion.rpa.helpers.conditionsnative.UiCondition... conditions) Checks that given element does not meet given conditions.shouldNotBe(com.workfusion.rpa.helpers.conditionsnative.UiCondition condition) Synonym forshouldNot(UiCondition)reading as "not be"; checked immediately.shouldNotBe(com.workfusion.rpa.helpers.conditionsnative.UiCondition... conditions) Synonym forshouldNot(UiCondition...).shouldNotHave(com.workfusion.rpa.helpers.conditionsnative.UiCondition condition) Synonym forshouldNot(UiCondition)reading as "not have"; checked immediately.shouldNotHave(com.workfusion.rpa.helpers.conditionsnative.UiCondition... conditions) Synonym forshouldNot(UiCondition...).Single click the element.singleClick(int offsetX, int offsetY) Single click the element.booleanChecks if element still exists on the current page.voidsubmit()Submits the form this element belongs to (or the element itself if it is a form).text()Short form of getText()Driver Type: Desktop, Webinttop()Top edge of the element in element-local coordinates (relative to its top-left corner).org.openqa.selenium.support.ui.SelectConverts UI element toSelecttoString()Displays WebElement in human-readable format.com.workfusion.rpa.internal.api.element.WebElementTriple click the elementtripleClick(int offsetX, int offsetY) Triple-click the element at a point offset from its TOP-LEFT corner.val()Get the "value" attribute of the element Same as #getValue()Driver Type: Desktop, WebwaitUntil(com.workfusion.rpa.helpers.conditionsnative.UiCondition condition) Wait until given element meets given conditions.waitUntil(com.workfusion.rpa.helpers.conditionsnative.UiCondition condition, long timeoutMilliseconds) Wait until given element meets given conditions.waitUntil(com.workfusion.rpa.helpers.conditionsnative.UiCondition condition, long timeoutMilliseconds, long pollingIntervalMilliseconds) Wait until given element meets given conditions.waitWhile(com.workfusion.rpa.helpers.conditionsnative.UiCondition condition) Wait while given element meets given conditions.waitWhile(com.workfusion.rpa.helpers.conditionsnative.UiCondition condition, long timeoutMilliseconds) Wait while given element meets given conditions.waitWhile(com.workfusion.rpa.helpers.conditionsnative.UiCondition condition, long timeoutMilliseconds, long pollingIntervalMilliseconds) Wait while given element meets given conditions.Wheel click on the elementwheelClick(int offsetX, int offsetY) Middle-button (wheel) click the element at a point offset from its TOP-LEFT corner.Methods inherited from interface com.workfusion.rpa.internal.api.element.WebElement
setText
-
Method Details
-
append
Append given text to the text field.
This is the same as WebElement.sendKeys(text)
Driver Type: Desktop, Web
- Parameters:
text- Any text to append into the text field.
-
setValue
Clear the text field and enter given text.
Implementation details: this is the same as
1. WebElement.clear() 2. WebElement.sendKeys(text)
Driver Type: Desktop, Web
- Parameters:
text- Any text to enter into the text field.
-
val
Driver Type: Desktop, Web
Same as #setValue(java.lang.String)
-
text
Driver Type: Desktop, Web
Same as #setValue(java.lang.String)
-
setText
Sets given text to a text field
Driver Type: Desktop, Web
- Parameters:
text- Any text to enter into the text field.
-
pressEnter
Press ENTER. Useful for input field and textareas:$("query").val("Aikido techniques").pressEnter();Implementation details: This is the same as
WebElement.sendKeys(Keys.ENTER)
Driver Type: Desktop, Web
-
pressTab
Press TAB. Useful for input field and textareas:$("#to").val("stiven@seagal.com").pressTab();Implementation details: This is the same as
WebElement.sendKeys(Keys.TAB)
Driver Type: Desktop, Web
-
pressEscape
Press ESCAPE. Useful for input field and textareas:$(".edit").click().pressEscape();Implementation details: This is the same as
WebElement.sendKeys(Keys.ESCAPE)
Driver Type: Desktop, Web
-
pressSpace
Press SPACE. Useful for input field and textareas:$(".edit").pressSpace();Implementation details: This is the same as
WebElement.sendKeys(Keys.SPACE)
Driver Type: Desktop, Web
-
pressBackSpace
Press BACK_SPACE. Useful for input field and textareas:$(".edit").pressBackSpace();Implementation details: This is the same as
WebElement.sendKeys(Keys.BACK_SPACE)
Driver Type: Desktop, Web
-
pressCtrlA
Send CTRL+A. Useful for input field and textareas:$(".edit").pressCtrlA();Implementation details: This is the same as
WebElement.sendKeys.sendKeys(Keys.chord(Keys.CONTROL, "a"))
Driver Type: Desktop, Web
-
pressCtrlC
Send CTRL+C. Useful for input field and textareas:$(".edit").pressCtrlC();Implementation details: This is the same as
WebElement.sendKeys.sendKeys(Keys.chord(Keys.CONTROL, "c"))
Driver Type: Desktop, Web
-
pressCtrlV
Send CTRL+V. Useful for input field and textareas:$(".edit").pressCtrlV();Implementation details: This is the same as
WebElement.sendKeys(Keys.chord(Keys.CONTROL, "v"))
Driver Type: Desktop, Web
-
pressCtrlX
Send CTRL+X. Useful for input field and textareas:$(".edit").pressCtrlX();Implementation details: This is the same as
WebElement.sendKeys(Keys.chord(Keys.CONTROL, "x"))
Driver Type: Desktop, Web
-
pressCtrlZ
Send CTRL+Z. Useful for input field and textareas:$(".edit").pressCtrlZ();Implementation details: This is the same as
WebElement.sendKeys(Keys.chord(Keys.CONTROL, "z"))
Driver Type: Desktop, Web
-
pressCtrlShiftZ
Send CTRL+SHIFT+Z. Useful for input field and textareas:$(".edit").pressCtrlShiftZ();Implementation details: This is the same as
WebElement.sendKeys(Keys.chord(Keys.CONTROL, Keys.SHIFT, "z"))
Driver Type: Desktop, Web
-
getText
Get the visible text of this elementDriver Type: Desktop, Web
- Specified by:
getTextin interfaceorg.openqa.selenium.WebElement- Returns:
- The text of this element
-
getTextSelected
Get the currently selected (highlighted) text of this element.Driver Type: Desktop, Web
- Specified by:
getTextSelectedin interfacecom.workfusion.rpa.internal.api.element.WebElement- Returns:
- the selected text, or an empty string if nothing is selected
-
text
Short form of getText()Driver Type: Desktop, Web
- See Also:
-
innerText
Get the text code of the element with children.Driver Type: Web
Short form of getAttribute("textContent") or getAttribute("innerText") depending on browser.
-
innerHtml
Get the HTML code of the element with children.Short form of getAttribute("innerHTML")
Driver Type: Web
-
attr
Get the attribute of the element. Synonym for getAttribute(String).Driver Type: Desktop, Web
- Returns:
- null if attribute is missing
-
name
Get the "name" attribute of the elementDriver Type: Desktop, Web
- Returns:
- attribute "name" value or null if attribute is missing
-
val
Get the "value" attribute of the element Same as #getValue()Driver Type: Desktop, Web
- Returns:
- attribute "value" value or null if attribute is missing
-
getValue
Get the "value" attribute of the elementDriver Type: Desktop, Web
- Returns:
- attribute "value" value or null if attribute is missing
-
isExists
Deprecated.from 9.2, it will be delete in 10.0Checks if element exists true on the current page.Driver Type: Desktop, Web
- Returns:
- false if element is not found, browser is closed or any WebDriver exception happened
-
stillExists
public boolean stillExists()Checks if element still exists on the current page.Driver Type: Desktop, Web
- Returns:
- false if element is not found, browser is closed or any WebDriver exception happened
- Since:
- 9.2
-
is
public boolean is(com.workfusion.rpa.helpers.conditionsnative.UiCondition condition) Return true if element matches given conditionDriver Type: Desktop, Web
-
has
public boolean has(com.workfusion.rpa.helpers.conditionsnative.UiCondition condition) Return true iff element matches given conditionDriver Type: Desktop, Web
-
should
Checks that given element meets all of given conditions.
IMPORTANT: Element matches these conditions immediately.
For example:
$("#errorMessage").should(APPEAR);Driver Type: Desktop, Web
- Returns:
- Given element, useful for chaining:
$("#errorMessage").should(APPEAR).shouldBe(ENABLED); - Throws:
IllegalStateException- if element is not matched to condition
-
should
Checks that the element meets all of the given conditions immediately (no waiting).Driver Type: Desktop, Web
- Parameters:
conditions- conditions that must all hold- Returns:
- this element, for chaining
- Throws:
IllegalStateException- if any condition is not met- See Also:
-
should
public UiElement should(com.workfusion.rpa.helpers.conditionsnative.UiCondition condition1, com.workfusion.rpa.helpers.conditionsnative.UiCondition condition2) Checks that the element meets both of the given conditions immediately (no waiting).Driver Type: Desktop, Web
- Parameters:
condition1- first condition that must holdcondition2- second condition that must hold- Returns:
- this element, for chaining
- Throws:
IllegalStateException- if either condition is not met- See Also:
-
shouldHave
Synonym for
should(UiCondition...)}. Useful for better readability.For example:
$("#errorMessage").shouldHave(text("Hello"), text("World"));Driver Type: Desktop, Web
- See Also:
-
shouldHave
Synonym forshould(UiCondition)reading as "have"; checked immediately.Driver Type: Desktop, Web
- Parameters:
condition- condition that must hold- Returns:
- this element, for chaining
- Throws:
IllegalStateException- if the condition is not met
-
shouldBe
Synonym for
should(UiCondition...)}. Useful for better readability.For example:
$("#errorMessage").shouldBe(visible, enabled);Driver Type: Desktop, Web
- See Also:
-
shouldBe
Synonym forshould(UiCondition)reading as "be"; checked immediately.Driver Type: Desktop, Web
- Parameters:
condition- condition that must hold- Returns:
- this element, for chaining
- Throws:
IllegalStateException- if the condition is not met
-
shouldNot
Checks that given element does not meet given conditions.
IMPORTANT: If element matches these conditions immediately.
For example:
$("#errorMessage").should(exist);Driver Type: Desktop, Web
-
shouldNot
Checks that the element does NOT meet the given condition immediately (no waiting).Driver Type: Desktop, Web
- Parameters:
condition- condition that must not hold- Returns:
- this element, for chaining
- Throws:
IllegalStateException- if the condition is met
-
shouldNotHave
public UiElement shouldNotHave(com.workfusion.rpa.helpers.conditionsnative.UiCondition... conditions) Synonym for
shouldNot(UiCondition...). Useful for better readability.For example:
$("#errorMessage").shouldNotHave(text("Exception"), text("Error"));Driver Type: Desktop, Web
- See Also:
-
shouldNotHave
Synonym forshouldNot(UiCondition)reading as "not have"; checked immediately.Driver Type: Desktop, Web
- Parameters:
condition- condition that must not hold- Returns:
- this element, for chaining
- Throws:
IllegalStateException- if the condition is met
-
shouldNotBe
Synonym for
shouldNot(UiCondition...). Useful for better readability.For example:
$("#errorMessage").shouldNotBe(visible, enabled);Driver Type: Desktop, Web
- See Also:
-
shouldNotBe
Synonym forshouldNot(UiCondition)reading as "not be"; checked immediately.Driver Type: Desktop, Web
- Parameters:
condition- condition that must not hold- Returns:
- this element, for chaining
- Throws:
IllegalStateException- if the condition is met
-
waitUntil
Wait until given element meets given conditions.
Driver Type: Desktop, Web
- Parameters:
condition- e.g. enabled, visible, text() and so on- Throws:
IllegalStateException- if element still is not matched to condition after the timeout
-
waitUntil
public UiElement waitUntil(com.workfusion.rpa.helpers.conditionsnative.UiCondition condition, long timeoutMilliseconds) Wait until given element meets given conditions.
Driver Type: Desktop, Web
- Parameters:
condition- e.g. enabled, visible, text() and so ontimeoutMilliseconds- timeout in milliseconds.- Throws:
IllegalStateException- if element still is not matched to condition after the timeout
-
waitUntil
public UiElement waitUntil(com.workfusion.rpa.helpers.conditionsnative.UiCondition condition, long timeoutMilliseconds, long pollingIntervalMilliseconds) Wait until given element meets given conditions.
Driver Type: Desktop, Web
- Parameters:
condition- e.g. enabled, visible, text() and so ontimeoutMilliseconds- timeout in milliseconds.pollingIntervalMilliseconds- interval in milliseconds, when checking condition- Throws:
IllegalStateException- if element still is not matched to condition after the timeout
-
waitWhile
Wait while given element meets given conditions.
Driver Type: Desktop, Web
- Parameters:
condition- e.g. enabled, visible, text() and so on- Throws:
IllegalStateException- if element still is not matched to condition after the timeout
-
waitWhile
public UiElement waitWhile(com.workfusion.rpa.helpers.conditionsnative.UiCondition condition, long timeoutMilliseconds) Wait while given element meets given conditions.
Driver Type: Desktop, Web
- Parameters:
condition- e.g. enabled, visible, text() and so ontimeoutMilliseconds- timeout in milliseconds.- Throws:
IllegalStateException- if element still is not matched to condition after the timeout
-
waitWhile
public UiElement waitWhile(com.workfusion.rpa.helpers.conditionsnative.UiCondition condition, long timeoutMilliseconds, long pollingIntervalMilliseconds) Wait while given element meets given conditions.
Driver Type: Desktop, Web
- Parameters:
condition- e.g. enabled, visible, text() and so ontimeoutMilliseconds- timeout in milliseconds.pollingIntervalMilliseconds- interval in milliseconds, when checking condition- Throws:
IllegalStateException- if element still is not matched to condition after the timeout
-
parent
Get parent element of this element For example, $("td").parent() could give some "tr".Driver Type: Web
- Returns:
- Parent element
-
closest
Find closes ancestor element matching given criteria. For example, $("td").closest("table") could give some "table".Driver Type: Web
- Parameters:
tagOrClass- Either HTML tag or CSS class. E.g. "form" or ".active".- Returns:
- Matching ancestor element
-
find
Find the first matching element inside given element
Short form of
webElement.findElement(By.cssSelector(cssSelector))Driver Type: Desktop, Web
-
find
Find the Nth matching element inside given element
Driver Type: Desktop, Web
-
find
Find the first matching element inside given element
Short form of
webElement.findElement(By.cssSelector(cssSelector))Driver Type: Desktop, Web
-
find
Find the Nth matching element inside given element
Driver Type: Desktop, Web
-
$
Driver Type: Desktop, Web
- See Also:
-
$
Driver Type: Desktop, Web
UiElement#find(java.lang.String) -
$
Driver Type: Desktop, Web
UiElement#find(java.lang.String)
-
$
Driver Type: Desktop, Web
UiElement#find(java.lang.String)
-
findAll
Short form of
webDriver.findElements(thisElement, By.cssSelector(cssSelector))For example,
$("#multirowTable").findAll("tr.active").shouldHave(size(2));Driver Type: Desktop, Web
- Returns:
- list of elements inside given element matching given CSS selector
-
findAll
Short form of
webDriver.findElements(thisElement, selector)For example,
$("#multirowTable").findAll(By.className("active")).shouldHave(size(2));Driver Type: Desktop, Web
- Returns:
- list of elements inside given element matching given criteria
-
$$
Driver Type: Desktop, Web
UiElement#findAll(java.lang.String)
-
$$
Driver Type: Desktop, Web
UiElement#findAll(java.lang.String)
-
setSelected
Set checkbox/radio state to CHECKED or UNCHECKED.Driver Type: Desktop, Web
- Parameters:
selected- true for checked and false for unchecked
-
toSelectElement
public org.openqa.selenium.support.ui.Select toSelectElement()Converts UI element toSelectDriver Type: Web
- Returns:
Selectobject that Models a SELECT tag, providing helper methods to select and deselect options.
-
selectOption
Select an option from dropdown list (by index)Driver Type: Web
- Parameters:
index- 0..N (0 means first option)
-
selectOption
Select an option from dropdown list (by text)Driver Type: Web
- Parameters:
text- visible text of option
-
selectOptionByValue
Select an option from dropdown list (by value)Driver Type: Web
- Parameters:
value- "value" attribute of option
-
getSelectedOption
Find selected option from this select fieldDriver Type: Web
- Returns:
- WebElement for selected <option> element
-
getSelectedValue
Get value of selected option in select fieldDriver Type: Web
-
getSelectedText
Get text of selected option in select fieldDriver Type: Web
-
scrollTo
Ask browser to scroll to this elementDriver Type: Web
-
scrollDown
Moves mouse cursor to the center of element and scrolls down number of times.Driver Type: Desktop, Web
- Parameters:
times- how many times need to scroll (ticks of the mouse wheel)- Returns:
- this element
-
scrollUp
Moves mouse cursor to the center of element and scrolls up number of times.Driver Type: Desktop, Web
- Parameters:
times- how many times need to scroll (ticks of the mouse wheel)- Returns:
- this element
-
toWebElement
public com.workfusion.rpa.internal.api.element.WebElement toWebElement()- Returns:
- the original Selenium WebElement wrapped by this object
-
getWrappedElement
public com.workfusion.rpa.internal.api.element.WebElement getWrappedElement()Returns the underlyingWebElementthis object wraps. UnliketoWebElement(), it unwraps only one level, so the result may itself be anotherUiElement.- Specified by:
getWrappedElementin interfaceorg.openqa.selenium.WrapsElement- Returns:
- the wrapped element
-
click
Left-click the element at a point offset from its TOP-LEFT corner.The offset is measured from the element's top-left corner (
(0, 0)), not from its center as the Selenium 4ActionsAPI would; the conversion is done internally viarecalculateOffsetToCenter(int, int). For exampleclick(5, 5)clicks 5px right and 5px down from the top-left corner, whileclick(centerX(), centerY())clicks the center. See the class-level "Coordinates and offsets" section.Driver Type: Desktop, Web
- Parameters:
offsetX- horizontal offset from the element's left edge, in pixels (grows to the right)offsetY- vertical offset from the element's top edge, in pixels (grows downward)- Since:
- 9.2
-
click
public void click()Click the elementBy default it uses default Selenium method click.
- Specified by:
clickin interfaceorg.openqa.selenium.WebElement
-
contextClick
Right-click (context-click) the element at a point offset from its TOP-LEFT corner.The offset is measured from the element's top-left corner (
(0, 0)); see the class-level "Coordinates and offsets" section.Driver Type: Desktop, Web
- Parameters:
offsetX- horizontal offset from the element's left edge, in pixels (grows to the right)offsetY- vertical offset from the element's top edge, in pixels (grows downward)- Returns:
- this element
- Since:
- 9.2
-
contextClick
Click with right mouse button on this element- Returns:
- this element
-
singleClick
Single click the element. The same asclick(int, int), but returns UiElement. Helpful for chaining- Sample
$("[CLASS:Edit; INSTANCE:1]").singleClick(10, 10).sendKeys(text);
The offset is measured from the element's top-left corner (
(0, 0)); see the class-level "Coordinates and offsets" section.Driver Type: Desktop, Web
- Parameters:
offsetX- horizontal offset from the element's left edge, in pixels (grows to the right)offsetY- vertical offset from the element's top edge, in pixels (grows downward)- Returns:
- this UiElement
- Since:
- 9.2
-
singleClick
Single click the element. The same asclick(), but returns UiElement. Helpful for chaining- Sample
$("[CLASS:Edit; INSTANCE:1]").singleClick().sendKeys(text);
- Returns:
- this UiElement
-
doubleClick
Double-click the element at a point offset from its TOP-LEFT corner.The offset is measured from the element's top-left corner (
(0, 0)); see the class-level "Coordinates and offsets" section.Driver Type: Desktop, Web
- Parameters:
offsetX- horizontal offset from the element's left edge, in pixels (grows to the right)offsetY- vertical offset from the element's top edge, in pixels (grows downward)- Returns:
- this UiElement
- Since:
- 9.2
-
doubleClick
Double click the element- Returns:
- this element
-
tripleClick
Triple-click the element at a point offset from its TOP-LEFT corner.The offset is measured from the element's top-left corner (
(0, 0)); see the class-level "Coordinates and offsets" section.Driver Type: Desktop, Web
- Parameters:
offsetX- horizontal offset from the element's left edge, in pixels (grows to the right)offsetY- vertical offset from the element's top edge, in pixels (grows downward)- Returns:
- this UiElement
- Since:
- 9.2
-
tripleClick
Triple click the elementDriver Type: Desktop, Web
- Returns:
- this element
-
click
Left-click the element a given number of times at a point offset from its TOP-LEFT corner.The offset is measured from the element's top-left corner (
(0, 0)); see the class-level "Coordinates and offsets" section. All clicks land on the same point.Driver Type: Desktop, Web
- Parameters:
clicks- number of consecutive clicks to performoffsetX- horizontal offset from the element's left edge, in pixels (grows to the right)offsetY- vertical offset from the element's top edge, in pixels (grows downward)- Returns:
- this UiElement
- Since:
- 9.2
-
click
Click the element number of timesDriver Type: Desktop, Web
- Parameters:
clicks- number of clicks- Returns:
- this element
-
wheelClick
Middle-button (wheel) click the element at a point offset from its TOP-LEFT corner.The offset is measured from the element's top-left corner (
(0, 0)); see the class-level "Coordinates and offsets" section.Driver Type: Desktop, Web
- Parameters:
offsetX- horizontal offset from the element's left edge, in pixels (grows to the right)offsetY- vertical offset from the element's top edge, in pixels (grows downward)- Returns:
- this UiElement
- Since:
- 9.2
-
wheelClick
Wheel click on the elementDriver Type: Desktop, Web
- Returns:
- this element
-
hover
Emulate "mouseOver" event. In other words, move mouse cursor over this element (without clicking it).- Returns:
- this element
-
isImageLoaded
public boolean isImageLoaded()Check if image is properly loaded.Driver Type: Web
- Throws:
IllegalArgumentException- if argument is not an "img" element
-
submit
public void submit()Submits the form this element belongs to (or the element itself if it is a form).Driver Type: Web
- Specified by:
submitin interfaceorg.openqa.selenium.WebElement
-
sendKeys
Types the given key sequence into the element.Driver Type: Desktop, Web
- Specified by:
sendKeysin interfaceorg.openqa.selenium.WebElement- Parameters:
charSequences- the characters/keys to send (may includeKeysvalues)
-
sendKeys
Types the given value into the element, converting it to text first. UnlikesendKeys(CharSequence...)this returns the element for chaining.Driver Type: Desktop, Web
- Parameters:
text- the value to type; converted to its string form before sending- Returns:
- this element, for chaining
-
sendKeysWithFocus
It scrolls to the element, moves cursor to it and then performs sendKeys. Above actions help to maintain focus on the element before sendKeys is invoked, which leads to improved reliability of sendKeys action.Driver Type: Web
- Returns:
- this element
- Throws:
IllegalStateException- if driver different than Web is used- Since:
- 10.2.7
-
clear
public void clear()Clears the text of this input or textarea element.Driver Type: Desktop, Web
- Specified by:
clearin interfaceorg.openqa.selenium.WebElement
-
getTagName
- Specified by:
getTagNamein interfaceorg.openqa.selenium.WebElement- Returns:
- the tag name of this element (e.g.
"input"); for Desktop, the control type
-
getAttribute
Gets the value of the given attribute.- Specified by:
getAttributein interfaceorg.openqa.selenium.WebElement- Parameters:
s- the attribute name- Returns:
- the attribute value, or
nullif the attribute is missing
-
getDomAttribute
Gets the value of the given attribute as declared in the DOM markup, without any property normalization.Driver Type: Web
- Specified by:
getDomAttributein interfaceorg.openqa.selenium.WebElement- Parameters:
name- the attribute name- Returns:
- the declared attribute value, or
nullif it is not present
-
getDomProperty
Gets the value of the given DOM property (the current, possibly script-updated value), as opposed to the static markup attribute.Driver Type: Web
- Specified by:
getDomPropertyin interfaceorg.openqa.selenium.WebElement- Parameters:
name- the property name- Returns:
- the property value, or
nullif it is not present
-
getAriaRole
- Specified by:
getAriaRolein interfaceorg.openqa.selenium.WebElement- Returns:
- the ARIA role of this element (explicit
roleattribute or its implicit role)Driver Type: Web
-
getAccessibleName
- Specified by:
getAccessibleNamein interfaceorg.openqa.selenium.WebElement- Returns:
- the accessible name of this element, as computed for assistive technologies
Driver Type: Web
-
getShadowRoot
public org.openqa.selenium.SearchContext getShadowRoot()Returns the shadow root hosted by this element, allowing queries into its shadow DOM.Driver Type: Web
- Specified by:
getShadowRootin interfaceorg.openqa.selenium.WebElement- Returns:
- the shadow root as a
SearchContext
-
isSelected
public boolean isSelected()- Specified by:
isSelectedin interfaceorg.openqa.selenium.WebElement- Returns:
trueif this element (e.g. a checkbox, radio button or option) is selected
-
isEnabled
public boolean isEnabled()- Specified by:
isEnabledin interfaceorg.openqa.selenium.WebElement- Returns:
trueif this element is enabled (not disabled)
-
focus
public boolean focus()Sets input focus on this element.Driver Type: Desktop
- Specified by:
focusin interfacecom.workfusion.rpa.internal.api.element.WebElement- Returns:
trueif the element received focus
-
isDisplayed
public boolean isDisplayed()- Specified by:
isDisplayedin interfaceorg.openqa.selenium.WebElement- Returns:
trueif this element is rendered and visible to the user
-
findElements
Finds all descendant elements matching the given criteria.- Specified by:
findElementsin interfaceorg.openqa.selenium.SearchContext- Specified by:
findElementsin interfaceorg.openqa.selenium.WebElement- Parameters:
by- the locating criteria- Returns:
- the matching elements (empty list if none)
-
findElement
public com.workfusion.rpa.internal.api.element.WebElement findElement(org.openqa.selenium.By by) Finds the first descendant element matching the given criteria.- Specified by:
findElementin interfaceorg.openqa.selenium.SearchContext- Specified by:
findElementin interfaceorg.openqa.selenium.WebElement- Parameters:
by- the locating criteria- Returns:
- the first matching element
- Throws:
org.openqa.selenium.NoSuchElementException- if no element matches
-
getLocation
public org.openqa.selenium.Point getLocation()- Specified by:
getLocationin interfaceorg.openqa.selenium.WebElement- Returns:
- the location of the element's top-left corner (page pixels on Web, screen pixels on Desktop)
-
getSize
public org.openqa.selenium.Dimension getSize()- Specified by:
getSizein interfaceorg.openqa.selenium.WebElement- Returns:
- the width and height of the element, in pixels
-
getRect
public org.openqa.selenium.Rectangle getRect()- Specified by:
getRectin interfaceorg.openqa.selenium.WebElement- Returns:
- the element's bounding rectangle (location of its top-left corner plus its size)
-
getCssValue
Gets the value of a CSS property of this element.Driver Type: Web
- Specified by:
getCssValuein interfaceorg.openqa.selenium.WebElement- Parameters:
s- the CSS property name- Returns:
- the property value
-
getScreenshotAs
public <X> X getScreenshotAs(org.openqa.selenium.OutputType<X> outputType) Captures a screenshot of this element in the requested output form.- Specified by:
getScreenshotAsin interfaceorg.openqa.selenium.TakesScreenshot- Type Parameters:
X- the output type- Parameters:
outputType- the desired output format (e.g.OutputType.FILE,OutputType.BYTES)- Returns:
- the screenshot in the requested form
-
getId
- Specified by:
getIdin interfacecom.workfusion.rpa.internal.api.element.WebElement- Returns:
- the internal driver-assigned identifier of this element
-
getCoordinates
public org.openqa.selenium.interactions.Coordinates getCoordinates()Returns theCoordinatesof this element, used by mouse interactions to address it. The point reported is the element's location; seeRobotsMousefor how it is used.- Specified by:
getCoordinatesin interfaceorg.openqa.selenium.interactions.Locatable- Returns:
- this element's coordinates
-
copySelectedText
Copies selected textDriver Type: Desktop
- Returns:
- selected text
-
selectAllTextAndCopy
Sample: String selectedText = $("[CLASS:Edit; INSTANCE:1]") .append("some text") .selectAllTextAndCopy();Driver Type: Desktop
- Returns:
- selected text
-
equals
TwoUiElements are equal when they are of the same class and wrap equal underlying elements. -
top
public int top()Top edge of the element in element-local coordinates (relative to its top-left corner).Always
0, since the element's own origin is its top-left corner. Provided for symmetry withbottom()and so it can be used as an offset, e.g.click(left(), top())clicks the top-left corner.- Returns:
0
-
left
public int left()Left edge of the element in element-local coordinates (relative to its top-left corner).Always
0, since the element's own origin is its top-left corner. Provided for symmetry withright()and so it can be used as an offset.- Returns:
0
-
bottom
public int bottom()Bottom edge of the element in element-local coordinates (relative to its top-left corner).- Returns:
- the element height, in pixels
-
right
public int right()Right edge of the element in element-local coordinates (relative to its top-left corner).- Returns:
- the element width, in pixels
-
centerX
public int centerX()Horizontal center of the element relative to its top-left corner.Can be passed directly as an
offsetXto the offset-based mouse methods, e.g.click(centerX(), centerY())clicks the element's center.- Returns:
- half of the element width, in pixels
-
centerY
public int centerY()Vertical center of the element relative to its top-left corner.Can be passed directly as an
offsetYto the offset-based mouse methods, e.g.click(centerX(), centerY())clicks the element's center.- Returns:
- half of the element height, in pixels
-
hashCode
public int hashCode()- Overrides:
hashCodein classObject- Returns:
- a hash code consistent with
equals(Object), derived from the wrapped element
-
toString
Displays WebElement in human-readable format. Useful for logging and debugging. Not recommended to use for test verifications.
-