Class RPA
The following classes are also automatically imported into Machine configs.
They are accessible by their short-class-name (e.g. RemoteWebDriver)
RemoteWebDriverActionMouseKeyboardWaitFluentWaitWebDriverWaitExpectedConditionExpectedConditionsActionsApiUtilsPointedCoordinatesRobotsMouseUiElementUiElementCollectionUiConditionUiCollectionCondition
Classes from the following packages also are automatically imported into Machine configs:
- org.openqa.selenium.*
Main simplified methods:
driver()- accessing current driver instance.keyboard()- current driver keyboard.mouse()- current driver mouse.$(By)- finds the first element matching given descriptor.$$(String)- find all elements matching given descriptor.
Also important simplified methods:
sendKeys(CharSequence...)- sends a string to current window using keyboard.open(String)- opens a specified URL or application.window(String)- switches to a window with a specified title or descriptor.timeouts(long)- sets the maximum amount of time to wait for condition, page load, script to execute, element search.
The following additional methods are implemented for desktopDriver:
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic UiElement$(com.workfusion.rpa.internal.api.element.WebElement webElement) Wraps standard Selenium WebElement into UiElement to use additional methods like shouldHave(), selectOption(), etc.static UiElementFinds the first element matching given CSS selectorstatic UiElementFinds the Nth element matching given criteriastatic UiElement$(org.openqa.selenium.By seleniumSelector) Finds the first element matching given descriptorstatic UiElement$(org.openqa.selenium.By seleniumSelector, int index) Driver Type: Desktop, Webstatic UiElementCollectionFinds all elements matching given CSS selector.static UiElementCollection$$(Collection<? extends com.workfusion.rpa.internal.api.element.WebElement> elements) Initializes collection with Elementsstatic UiElementCollection$$(org.openqa.selenium.By seleniumSelector) Find all elements matching given descriptor.static com.workfusion.rpa.internal.api.interactions.WFActionsactions()With this method you can use Selenium Actions like described in the AdvancedUserInteractions page.static voidback()Desktop: moves back to preview window in desktopDriver historystatic voidClean clipboard.static RobotClipboardReturns clipboard implementation based on the settingsstatic StringReturns text from RPA agent clipboardstatic voidclose()Closes the current window.static Stringconfirm()Accepts (Clicks "Yes" or "Ok") in the existing confirmation dialog (javascript 'alert' or 'confirm').static StringAccepts (Clicks "Yes" or "Ok") in the existing confirmation dialog (javascript 'alert' or 'confirm').static StringCopies all text in PuTTY window.static StringCopies currently selected text and returns it.static booleandeleteFileOnAgent(String filePath) Deletes file or folder on RPA Agent machinestatic voidSets an option typeOnScreen is FALSE to a desktop driverstatic Stringdismiss()Dismisses (clicks "No" or "Cancel") in the existing confirmation dialog (javascript 'alert' or 'confirm').static StringDismisses (clicks "No" or "Cancel") in the existing confirmation dialog (javascript 'alert' or 'confirm').static byte[]downloadFileFromAgent(String filePath) Downloads file from RPA Agent machinestatic StringdownloadFileOnAgent(String downloadLink) Downloads a file and saves it on RPA agent machine (in default temp folder)static StringdownloadFileOnAgent(String downloadLink, String filePath) Downloads a file and saves it on RPA agent machinestatic StringdownloadTextFileFromAgent(String filePath) Downloads text file from RPA Agent machinestatic com.workfusion.rpa.driver.Driverdriver()Short definition for accessing current driver instance.static voidSets an option typeOnScreen is TRUE to a desktop driverstatic booleanChecks if element exists on the current page.static booleanexists(org.openqa.selenium.By selector) Checks if element exists on the current page.static org.openqa.selenium.support.ui.FluentWait<com.workfusion.rpa.internal.api.driver.WebDriver> Creates an org.openqa.selenium.support.ui.FluentWait instance with Selenide timeout/polling.static voidforward()Desktop: moves forward to next window in desktopDriver historygetDriverLogs(LogType logType) Deprecated.getDriverLogs(LogType logType, Level logLevel) Deprecated.static UiElementgetElement(org.openqa.selenium.By criteria) Finds the first element matching given criteriastatic UiElementgetElement(org.openqa.selenium.By criteria, int index) Finds the Nth element matching given criteriastatic UiElementCollectiongetElements(org.openqa.selenium.By criteria) Finds all elements matching given descriptorstatic longReturns the frequency with which to check the condition, for example in:static longReturns the maximum amount of time to wait for a condition, for example in:static UiElementReturns the currently focused UiElement, that is, the element that will get keystroke events if the user types any.static StringGets an option related to a desktop driverstatic org.openqa.selenium.WebDriver.TimeoutsimplicitlyWaitTimeout(long milliseconds) Sets the maximum amount of time to wait for element searchstatic voidinChrome(groovy.lang.Closure<?> closure) Is used for explicitly Chrome driver choosing.static voidinDesktop(groovy.lang.Closure<?> closure) Is used for explicitly Desktop driver choosing.static voidinEdge(groovy.lang.Closure<?> closure) Is used for explicitly Edge driver choosing.static voidinEdgeInIEMode(groovy.lang.Closure<?> closure) Is used for explicitly Edge driver choosing.static voidinFirefox(groovy.lang.Closure<?> closure) Is used for explicitly Firefox driver choosing.static voidinIE(groovy.lang.Closure<?> closure) Is used for explicitly IE driver choosing.static booleanisOptionEnabled(String key) Checks if an option related to a desktop driver is enabledstatic RobotsKeyboardkeyboard()Short definition for accessing current driver keyboard.static voidMinimizes current windowstatic RobotsMousemouse()Short definition for accessing current driver mouse.static IntegerOpens a specified URL or applicationstatic IntegerOpens a specified URL or applicationstatic voidOpens a specified absolute URLstatic IntegeropenAndFocus(String path2launch, long timeout, long polling) Opens a specified URL or application and sets focusstatic voidopenChrome(String target) Opens a specified URL in Chrome browserstatic voidOpens a specified URL in Edge browserstatic voidopenEdgeInIEMode(String target) Opens a specified URL in Edge browser in IE modestatic voidopenFirefox(String target) Opens a specified URL in Firefox browserstatic voidOpens a specified URL in IE browserstatic StringOpens the link in a new browser's tab.static StringopenLinkInNewWindow(org.openqa.selenium.By by) Opens the specified link in a new browser's tab.static StringOpens a new browser's tab.static org.openqa.selenium.WebDriver.TimeoutspageLoadTimeout(long milliseconds) Sets the maximum amount of time to wait for page to loadstatic voidSend ALT+F4 to the current window.static voidSend BACK_SPACE to the current window.static voidSend CTRL+A to the current window.static voidSend CTRL+C to the current window.static voidSend CTRL+SHIFT+Z to the current window.static voidSend CTRL+V to the current window.static voidSend CTRL+X to the current window.static voidSend CTRL+Z to the current window.static voidSends ENTER to the current window.static voidSends ESCAPE to the current window.static voidSends SPACE to the current window.static voidpressTab()Sends TAB to the current window.static voidrefresh()Refreshes the current pagestatic BufferedImageTakes a screenshot of the current windowstatic org.openqa.selenium.WebDriver.TimeoutsscriptTimeout(long milliseconds) Sets the maximum amount of time to wait for script executionstatic StringSelect all text in current window and copies it to clipboard.static voidsendKeys(CharSequence... charSequences) Sends a string to current window using keyboard.static voidSends a string to current window using keyboard.static StringsendToAgent(byte[] fileData) Sends file to RPA Agent default temp folder.static StringsendToAgent(byte[] fileData, String filePath) Sends file-data to RPA Agent.static StringsendToAgent(byte[] fileData, String filePrefix, String fileSuffix) Sends file-data to RPA Agent, create temporary filestatic StringsendToAgent(String textContent) Sends file to RPA Agent default temp folder.static StringsendToAgent(String textContent, String filePath) Sends file-data to RPA Agent.static voidsetClipboardText(String text) Sets text to RPA agent clipboardstatic voidsetFluentWaitPollingInterval(long fluentWaitPollingInterval) Sets The frequency with which to check the condition, for example in:static voidsetFluentWaitTimeout(long fluentWaitTimeout) Sets the maximum amount of time to wait for a condition, for example in:static voidsetImageMatchingOptions(Map<String, Object> options) Sets the Image Matching Optionsstatic voidSets an option related to a desktop driverstatic voidSets an option related to a desktop driverstatic voidSets an option returnType is JSON to a desktop driverstatic voidSets an option returnType is STRING to a desktop driverstatic voidsleep(long milliseconds) Wait for a specified number of milliseconds before the next step.static com.workfusion.rpa.internal.api.driver.WebDriverswitchSendRawKeysMode(boolean enable) Enables/disables sending keys as is (raw keys mode) or as with handling special keys (CTRL, SHIFT, etc).static com.workfusion.rpa.internal.api.driver.WebDriver.TargetLocatorswitchTo()Switch to window/tab/frame/parentFrame/innerFrame/alert.static org.openqa.selenium.WebDriver.WindowswitchToExistingWindow(String titleOrDescriptor) Switches to a existing window with a specified title or descriptor SampleswitchToExistingWindow("[CLASS:Notepad]")static org.openqa.selenium.WebDriver.WindowswitchToExistingWindow(String titleOrDescriptor, Long timeoutInMillis) Switches to a existing window with a specified title or descriptor SampleswitchToExistingWindow("[CLASS:Notepad]", 100L)static StringDeprecated.As of Release 9.1, since window switching algorithm works by default with all opened windowsstatic StringDeprecated.As of Release 9.1, since window switching algorithm works by default with all opened windowsstatic StringDeprecated.As of Release 9.1, since window switching algorithm works by default with all opened windowsstatic StringDeprecated.As of Release 9.1, since window switching algorithm works by default with all opened windowsstatic org.openqa.selenium.WebDriver.Timeoutstimeouts()Driver Type: Desktop, Webstatic org.openqa.selenium.WebDriver.Timeoutstimeouts(long milliseconds) Sets the maximum amount of time to wait for: condition page load script to execute element searchstatic Stringtitle()Returns the title of the current page.static org.openqa.selenium.support.ui.FluentWait<com.workfusion.rpa.internal.api.driver.WebDriver> Wait()Deprecated.As of Release 9.2, please use fluentWait() insteadstatic org.openqa.selenium.WebDriver.Windowwindow()Returns the current window Samplewindow().fullscreen();static org.openqa.selenium.WebDriver.WindowSwitches to a window with a specified title or descriptor Samplewindow("[CLASS:Notepad]")static voidzoom(double factor) Zoom the current page (in or out).
-
Field Details
-
ACTION_GET_CLIPBOARD_TEXT
- See Also:
-
ACTION_COPY_SELECTED_TEXT
- See Also:
-
ACTION_SELECT_ALL_TEXT_AND_COPY
- See Also:
-
ACTION_PUTTY_COPY_ALL_TEXT
- See Also:
-
SWITCH_WINDOW_TIMEOUT
public static final long SWITCH_WINDOW_TIMEOUT- See Also:
-
-
Method Details
-
driver
public static com.workfusion.rpa.driver.Driver driver()Short definition for accessing current driver instance.Driver Type: Desktop, Web
- Returns:
- current driver
- See Also:
-
keyboard
Short definition for accessing current driver keyboard.- Sample
keyboard().sendKeys(Keys.TAB);
Driver Type: Desktop, Web
- Returns:
- current driver keyboard
- See Also:
-
mouse
Short definition for accessing current driver mouse.- Sample
mouse().doubleClick(20, 40).contextClick(100, 78);
Driver Type: Desktop, Web
- Returns:
- current driver mouse
- See Also:
-
switchTo
public static com.workfusion.rpa.internal.api.driver.WebDriver.TargetLocator switchTo()Switch to window/tab/frame/parentFrame/innerFrame/alert.
Similar to org.openqa.selenium.WebDriver#switchTo()
- Sample
switchTo().window("[CLASS:Notepad]").close();
Driver Type: Desktop, Web
- Returns:
- WebDriver.TargetLocator
-
window
public static org.openqa.selenium.WebDriver.Window window()Returns the current window- Sample
window().fullscreen();
Driver Type: Desktop, Web
- Returns:
- interface for managing the current window
- See Also:
-
minimizeWindow
public static void minimizeWindow()Minimizes current windowDriver Type: Desktop, Web
-
switchToExistingWindow
public static org.openqa.selenium.WebDriver.Window switchToExistingWindow(String titleOrDescriptor, Long timeoutInMillis) Switches to a existing window with a specified title or descriptor- Sample
switchToExistingWindow("[CLASS:Notepad]", 100L)
Driver Type: Desktop
- Parameters:
titleOrDescriptor- string representation of a window title or descriptortimeoutInMillis- timeout in milliseconds for find last open window- Returns:
- current window
-
switchToExistingWindow
Switches to a existing window with a specified title or descriptor- Sample
switchToExistingWindow("[CLASS:Notepad]")
Driver Type: Desktop
- Parameters:
titleOrDescriptor- string representation of a window title or descriptor- Returns:
- current window
-
window
Switches to a window with a specified title or descriptor- Sample
window("[CLASS:Notepad]")
Driver Type: Desktop, Web
- Parameters:
titleOrDescriptor- string representation of a window title or descriptor- Returns:
- current window
-
sendKeys
Sends a string to current window using keyboard.
Delegates invocation to driver.getKeyboard().sendKeys(...)
Driver Type: Desktop, Web
- Parameters:
text- can be a Collection or Array, all items will be concatenated
-
sendKeys
Sends a string to current window using keyboard.
Delegates invocation to driver.getKeyboard().sendKeys(...)
Driver Type: Desktop, Web
- Parameters:
charSequences- can be a Char Sequence (ex. String, Keys.CHAR), all items will be concatenated
-
pressEnter
public static void pressEnter()Sends ENTER to the current window.pressEnter();
Implementation details: This is the same as
driver().getKeyboard().sendKeys(Keys.ENTER)
Driver Type: Desktop, Web
-
pressTab
public static void pressTab()Sends TAB to the current window.pressTab();
Implementation details: This is the same as
driver().getKeyboard().sendKeys(Keys.TAB)
Driver Type: Desktop, Web
-
pressEscape
public static void pressEscape()Sends ESCAPE to the current window.pressEscape();
Implementation details: This is the same as
driver().getKeyboard().sendKeys(Keys.ESCAPE)
Driver Type: Desktop, Web
-
pressSpace
public static void pressSpace()Sends SPACE to the current window.pressSpace();
Implementation details: This is the same as
driver().getKeyboard().sendKeys(Keys.SPACE)
Driver Type: Desktop, Web
-
pressBackSpace
public static void pressBackSpace()Send BACK_SPACE to the current window.pressBackSpace();
Implementation details: This is the same as
driver().getKeyboard().sendKeys(Keys.BACK_SPACE)
Driver Type: Desktop, Web
-
pressCtrlA
public static void pressCtrlA()Send CTRL+A to the current window.pressCtrlA();
Implementation details: This is the same as
driver().getKeyboard().sendKeys(Keys.chord(Keys.CONTROL, "a"))
Driver Type: Desktop, Web
-
pressCtrlC
public static void pressCtrlC()Send CTRL+C to the current window.pressCtrlC();
Implementation details: This is the same as
driver().getKeyboard().sendKeys(Keys.chord(Keys.CONTROL, "c"))
Driver Type: Desktop, Web
-
pressCtrlV
public static void pressCtrlV()Send CTRL+V to the current window.pressCtrlV();
Implementation details: This is the same as
driver().getKeyboard().sendKeys(Keys.chord(Keys.CONTROL, "v"))
Driver Type: Desktop, Web
-
pressCtrlX
public static void pressCtrlX()Send CTRL+X to the current window.pressCtrlX();
Implementation details: This is the same as
driver().getKeyboard().sendKeys(Keys.chord(Keys.CONTROL, "x"))
Driver Type: Desktop, Web
-
pressCtrlZ
public static void pressCtrlZ()Send CTRL+Z to the current window.pressCtrlZ();
Implementation details: This is the same as
driver().getKeyboard().sendKeys(Keys.chord(Keys.CONTROL, "z"))
Driver Type: Desktop, Web
-
pressCtrlShiftZ
public static void pressCtrlShiftZ()Send CTRL+SHIFT+Z to the current window.pressCtrlShiftZ();
Implementation details: This is the same as
driver().getKeyboard().sendKeys(Keys.chord(Keys.CONTROL, Keys.SHIFT, "z"))
Driver Type: Desktop, Web
-
pressAltF4
public static void pressAltF4()Send ALT+F4 to the current window.pressAltF4();
Implementation details: This is the same as
driver().getKeyboard().sendKeys(Keys.chord(Keys.ALT, Keys.F4))
Driver Type: Desktop, Web
-
openAndFocus
Opens a specified URL or application and sets focusObject calculator = "calc.exe"; openAndFocus(calculator, 1000, 250);
Driver Type: Desktop
- Parameters:
path2launch- Application pathtimeout- Timeout during driver try get focus in millisecondspolling- Polling interval in milliseconds- Returns:
- Process ID
- Since:
- 9.2.0 should return ID of started process for Desktop driver or return NULL for Web drivers
-
open
Opens a specified URL or applicationObject calculator = "calc.exe"; open(calculator);
Driver Type: Desktop, Web
- Parameters:
target- object that will be converted to String- Returns:
- Process ID
- Since:
- 9.2.0 should return ID of started process for Desktop driver or return NULL for Web drivers
-
open
Opens a specified URL or applicationopen("calc.exe");Driver Type: Desktop, Web
- Parameters:
target- String with URL or application path- Returns:
- Process ID
- Since:
- 9.2.0 should return ID of started process for Desktop driver or return NULL for Web drivers
-
openFirefox
Opens a specified URL in Firefox browseropen("https://workfusion.com");Driver Type: Universal
- Parameters:
target- String with URL
-
inFirefox
public static void inFirefox(groovy.lang.Closure<?> closure) Is used for explicitly Firefox driver choosing. In case when driver auto detection is ambiguous.inFirefox() { open("https://workfusion.com") }Such constructions are not supported e.ginFirefox{ inChrome() { open("https://workfusion.com") } }Driver Type: Universal
- Parameters:
closure- code that will be executed using Firefox driver- Since:
- 8.5.0.2
-
openIE
Opens a specified URL in IE browseropen("https://workfusion.com");Driver Type: Universal
- Parameters:
target- String with URL
-
inIE
public static void inIE(groovy.lang.Closure<?> closure) Is used for explicitly IE driver choosing. In case when driver auto detection is ambiguous.inIE() { open("https://workfusion.com") }Such constructions are not supported e.ginIE{ inChrome() { open("https://workfusion.com") } }Driver Type: Universal
- Parameters:
closure- code that will be executed using IE driver- Since:
- 8.5.0.2
-
openChrome
Opens a specified URL in Chrome browseropen("https://workfusion.com");Driver Type: Universal
- Parameters:
target- String with URL
-
openEdge
Opens a specified URL in Edge browseropen("https://workfusion.com");Driver Type: Universal
- Parameters:
target- String with URL
-
openEdgeInIEMode
Opens a specified URL in Edge browser in IE modeopen("https://workfusion.com");Driver Type: Universal
- Parameters:
target- String with URL
-
inChrome
public static void inChrome(groovy.lang.Closure<?> closure) Is used for explicitly Chrome driver choosing. In case when driver auto detection is ambiguous.inChrome() { open("https://workfusion.com") }Such constructions are not supported e.ginChrome{ inDesktop() { open("https://workfusion.com") } }Driver Type: Universal
- Parameters:
closure- code that will be executed using Chrome driver- Since:
- 8.5.0.2
-
inDesktop
public static void inDesktop(groovy.lang.Closure<?> closure) Is used for explicitly Desktop driver choosing. In case when driver auto detection is ambiguous.inDesktop() { open("https://workfusion.com") }Such constructions are not supported e.ginDesktop{ inChrome() { open("https://workfusion.com") } }Driver Type: Universal
- Parameters:
closure- code that will be executed using Desktop driver- Since:
- 8.5.0.2
-
inEdge
public static void inEdge(groovy.lang.Closure<?> closure) Is used for explicitly Edge driver choosing. In case when driver auto detection is ambiguous.inEdge() { open("https://workfusion.com") }Such constructions are not supported e.ginEdge{ inChrome() { open("https://workfusion.com") } }Driver Type: Universal
- Parameters:
closure- code that will be executed using Edge driver
-
inEdgeInIEMode
public static void inEdgeInIEMode(groovy.lang.Closure<?> closure) Is used for explicitly Edge driver choosing. In case when driver auto detection is ambiguous.inEdgeInIEMode() { open("https://workfusion.com") }Such constructions are not supported e.ginEdgeInIEMode{ inChrome() { open("https://workfusion.com") } }Driver Type: Universal
- Parameters:
closure- code that will be executed using Edge driver
-
open
Opens a specified absolute URLopen(new URL("https://workfusion.com"));Driver Type: Web
- Parameters:
absoluteUrl- String with absolute URL
-
close
public static void close()Closes the current window.
This is the same as:
driver.close();
Driver Type: Desktop, Web
-
refresh
public static void refresh()Refreshes the current page
This is the same as:
driver.navigate().refresh();
Driver Type: Web
-
back
public static void back()Desktop: moves back to preview window in desktopDriver history
Web: moves back a single item in the browser's history.
Driver Type: Desktop, Web
This is the same as:
driver.navigate().back();
-
forward
public static void forward()Desktop: moves forward to next window in desktopDriver history
Web: moves a single item forward in the browser's history.
Driver Type: Desktop, Web
This is the same as:
driver.navigate().forward();
-
title
Returns the title of the current page.
This is the same as:
driver.title();
Driver Type: Desktop, Web
-
sleep
public static void sleep(long milliseconds) Wait for a specified number of milliseconds before the next step.
This is the same as:
Thread.sleep(milliseconds);
Driver Type: Desktop, Web
- Parameters:
milliseconds- time to sleep in milliseconds
-
$
Wraps standard Selenium WebElement into UiElement to use additional methods like shouldHave(), selectOption(), etc.Driver Type: Desktop, Web
- Parameters:
webElement- standard Selenium WebElement- Returns:
- given WebElement wrapped into UiElement
- See Also:
-
exists
Checks if element exists on the current page.Driver Type: Desktop, Web
- Parameters:
cssSelector- any CSS selector like "input[name='first_name']" or "#messages .new_message"- Returns:
- false if element is not found
- Since:
- 9.2
-
exists
public static boolean exists(org.openqa.selenium.By selector) Checks if element exists on the current page.Driver Type: Desktop, Web
- Parameters:
selector- any selector like:By.id(), By.name(), By.cssSelector("[CLASS:Edit; INSTANCE:1]")- Returns:
- false if element is not found
- Since:
- 9.2
-
$
Finds the first element matching given CSS selectorDriver Type: Desktop, Web
- Parameters:
cssSelector- any CSS selector like "input[name='first_name']" or "#messages .new_message"- Returns:
- UiElement
-
$
Finds the first element matching given descriptorDriver Type: Desktop, Web
- Parameters:
seleniumSelector- any selector like:By.id(), By.name(), By.cssSelector("[CLASS:Edit; INSTANCE:1]")- Returns:
- UiElement
-
$
Driver Type: Desktop, Web
- See Also:
-
$
Finds the Nth element matching given criteriaDriver Type: Desktop, Web
- Parameters:
cssSelector- any CSS selector like "input[name='first_name']" or "#messages .new_message"index- 0..N- Returns:
- UiElement
-
$$
public static UiElementCollection $$(Collection<? extends com.workfusion.rpa.internal.api.element.WebElement> elements) Initializes collection with ElementsDriver Type: Desktop, Web
- Parameters:
elements- Collection of standard Selenium WebElements- Returns:
- a collection of UIElements
- See Also:
-
$$
Finds all elements matching given CSS selector. Method returns a UiElementCollection which is a list of WebElement objects that can be iterated, and at the same time is an implementation of WebElement interface, meaning that you can call methods .sendKeys(), click() etc. on it.Driver Type: Desktop, Web
- Parameters:
cssSelector- any CSS selector like "input[name='first_name']" or "#messages .new_message"- Returns:
- a collection of UIElements OR an empty list if no elements were found
- See Also:
-
$$
Find all elements matching given descriptor. Method returns a UiElementCollection which is a list of WebElement objects that can be iterated, and at the same time is an implementation of WebElement interface, meaning that you can call methods .sendKeys(), click() etc. on it.Driver Type: Desktop, Web
- Parameters:
seleniumSelector- any selector like:By.id(), By.name(), By.cssSelector("[CLASS:Edit; INSTANCE:1]")- Returns:
- empty list if element was no found
- See Also:
-
getElement
Finds the first element matching given criteriaDriver Type: Desktop, Web
- Parameters:
criteria- instance of By: By.id(), By.className() etc.- Returns:
- UiElement
-
getElement
Finds the Nth element matching given criteriaDriver Type: Desktop, Web
- Parameters:
criteria- instance of By: By.id(), By.className() etc.index- 0..N- Returns:
- UiElement
- Throws:
IndexOutOfBoundsException- if the specified index does not exist
-
getElements
Finds all elements matching given descriptorDriver Type: Desktop, Web
- Parameters:
criteria- instance of By: By.id(), By.className() etc.- Returns:
- empty list if element was no found
-
confirm
Accepts (Clicks "Yes" or "Ok") in the existing confirmation dialog (javascript 'alert' or 'confirm').Driver Type: Web
- Returns:
- actual dialog text
- Throws:
org.openqa.selenium.TimeoutException- if dialog is not shown
-
confirm
Accepts (Clicks "Yes" or "Ok") in the existing confirmation dialog (javascript 'alert' or 'confirm').Driver Type: Web
- Parameters:
expectedDialogText- if not null, checks that confirmation dialog displays this message (case-sensitive)- Returns:
- actual dialog text
- Throws:
IllegalStateException- if confirmation message differs from expected messageorg.openqa.selenium.TimeoutException- if dialog is not shown
-
dismiss
Dismisses (clicks "No" or "Cancel") in the existing confirmation dialog (javascript 'alert' or 'confirm').Driver Type: Web
- Returns:
- actual dialog text
- Throws:
org.openqa.selenium.TimeoutException- if dialog is not shown
-
dismiss
Dismisses (clicks "No" or "Cancel") in the existing confirmation dialog (javascript 'alert' or 'confirm').Driver Type: Web
- Parameters:
expectedDialogText- if not null, checks that confirmation dialog displays this message (case-sensitive)- Returns:
- actual dialog text
- Throws:
IllegalStateException- if confirmation message differs from expected messageorg.openqa.selenium.TimeoutException- if dialog is not shown
-
getFocusedElement
Returns the currently focused UiElement, that is, the element that will get keystroke events if the user types any.Driver Type: Web
- Sample
getFocusedElement().sendKeys(Keys.ENTER);
- Returns:
- UiElement which has focus
-
Wait
@Deprecated public static org.openqa.selenium.support.ui.FluentWait<com.workfusion.rpa.internal.api.driver.WebDriver> Wait()Deprecated.As of Release 9.2, please use fluentWait() instead
Creates an org.openqa.selenium.support.ui.FluentWait instance with Selenide timeout/polling.- Sample
Wait().until(invisibilityOfElementLocated(By.id("magic-id")));
Driver Type: Desktop, Web
- Returns:
- instance of org.openqa.selenium.support.ui.FluentWait
- See Also:
-
fluentWait
public static org.openqa.selenium.support.ui.FluentWait<com.workfusion.rpa.internal.api.driver.WebDriver> fluentWait()Creates an org.openqa.selenium.support.ui.FluentWait instance with Selenide timeout/polling.- Sample
fluentWait().until(invisibilityOfElementLocated(By.id("magic-id")));
Driver Type: Desktop, Web
- Returns:
- instance of org.openqa.selenium.support.ui.FluentWait
- See Also:
-
actions
public static com.workfusion.rpa.internal.api.interactions.WFActions actions()With this method you can use Selenium Actions like described in the AdvancedUserInteractions page.actions() .sendKeys($(By.name("rememberMe")), "John") .click($(#rememberMe")) .click($(byText("Login"))) .build() .perform();Driver Type: Desktop, Web
-
zoom
public static void zoom(double factor) Zoom the current page (in or out).Driver Type: Web
- Parameters:
factor- e.g. 1.1 or 2.0 or 0.5
-
getDriverLogs
Deprecated.Driver Type: Web
- See Also:
-
getDriverLogs
Deprecated.Getting and filtering of the WebDriver logs for specified LogType by specified logging level
For example to get WebDriver Browser's console output (including JS info, warnings, errors, etc. messages) you can use:
Note that currently "manage().logs()" is in the Beta stage.for(String logEntry : getDriverLogs(LogType.BROWSER, Level.ALL)) { Reporter.log(logEntry + "<br>"); }
Driver Type: Web
- Parameters:
logType- WebDriver supported log types seelogLevel- logging level that will be used to control logging output- Returns:
- list of log entries
- See Also:
-
switchToRootWindow
Deprecated.As of Release 9.1, since window switching algorithm works by default with all opened windows
Switching focus to the first opened window- Returns:
- window's handler, which is in focus now
-
switchToLastWindow
Deprecated.As of Release 9.1, since window switching algorithm works by default with all opened windows
Switching focus to the last opened window- Returns:
- window's handler, which is in focus now
-
switchToPrevWindow
Deprecated.As of Release 9.1, since window switching algorithm works by default with all opened windows
Switching focus to the previously opened window before current window- Returns:
- window's handler, which is in focus now
-
switchToNextWindow
Deprecated.As of Release 9.1, since window switching algorithm works by default with all opened windows
Switching focus to the next opened window after current window- Returns:
- window's handler, which is in focus now
-
openNewWindow
Opens a new browser's tab. Focus will be switched to the new opened window.Driver Type: Web
- Returns:
- handler of the new window
-
openLinkInNewWindow
Opens the link in a new browser's tab. Focus will be switched to the new opened window.Driver Type: Web
- Returns:
- handler of the new window
-
openLinkInNewWindow
Opens the specified link in a new browser's tab. Focus will stay on the current window, which was targeted before click.Driver Type: Web
- Sample
openLinkInNewWindow(byCssSelector(".container a.create-new")).switchTo();
- Parameters:
by- - link descriptor- Returns:
- handler of the new window
-
getFluentWaitTimeout
public static long getFluentWaitTimeout()Returns the maximum amount of time to wait for a condition, for example in:Wait().until(<some_condition>); $(".demo-el").waitUntil(<other_condition>);Driver Type: Desktop, Web
- Returns:
- timeout in milliseconds
-
setFluentWaitTimeout
public static void setFluentWaitTimeout(long fluentWaitTimeout) Sets the maximum amount of time to wait for a condition, for example in:Wait().until(<some_condition>); $(".demo-el").waitUntil(<other_condition>);Driver Type: Desktop, Web
- Parameters:
fluentWaitTimeout- timeout in milliseconds
-
getFluentWaitPollingInterval
public static long getFluentWaitPollingInterval()Returns the frequency with which to check the condition, for example in:Wait().until(<some_condition>); $(".demo-el").waitUntil(<other_condition>);Driver Type: Desktop, Web
- Returns:
- frequency in milliseconds
-
setFluentWaitPollingInterval
public static void setFluentWaitPollingInterval(long fluentWaitPollingInterval) Sets The frequency with which to check the condition, for example in:Wait().until(<some_condition>); $(".demo-el").waitUntil(<other_condition>);Driver Type: Desktop, Web
- Parameters:
fluentWaitPollingInterval- frequency in milliseconds
-
timeouts
public static org.openqa.selenium.WebDriver.Timeouts timeouts()Driver Type: Desktop, Web
- Returns:
- the interface for managing driver timeouts.
-
timeouts
public static org.openqa.selenium.WebDriver.Timeouts timeouts(long milliseconds) Sets the maximum amount of time to wait for:- condition
- page load
- script to execute
- element search
Driver Type: Desktop, Web
- Parameters:
milliseconds- timeout in milliseconds- Returns:
- an Object for managing Timeouts
- See Also:
-
implicitlyWaitTimeout
public static org.openqa.selenium.WebDriver.Timeouts implicitlyWaitTimeout(long milliseconds) Sets the maximum amount of time to wait for element searchDriver Type: Desktop, Web
- Parameters:
milliseconds- timeout in milliseconds- Returns:
- an Object for managing Timeouts
- See Also:
-
pageLoadTimeout
public static org.openqa.selenium.WebDriver.Timeouts pageLoadTimeout(long milliseconds) Sets the maximum amount of time to wait for page to loadDriver Type: Desktop, Web
- Parameters:
milliseconds- timeout in milliseconds- Returns:
- an Object for managing Timeouts
- See Also:
-
scriptTimeout
public static org.openqa.selenium.WebDriver.Timeouts scriptTimeout(long milliseconds) Sets the maximum amount of time to wait for script executionDriver Type: Desktop, Web
- Parameters:
milliseconds- timeout in milliseconds- Returns:
- an Object for managing Timeouts
- See Also:
-
setImageMatchingOptions
Sets the Image Matching OptionsDriver Type: Desktop/p>
- Parameters:
options- key-values options
-
screenshotAsImage
Takes a screenshot of the current windowDriver Type: Web
- Returns:
- instance of BufferedImage object
-
clipboard
Returns clipboard implementation based on the settingsDriver Type: Desktop
- Returns:
- clipboard implementation
-
cleanClipboard
public static void cleanClipboard()Clean clipboard. Send empty string to clipboard.Driver Type: Desktop
- Since:
- 9.2
- See Also:
-
clipboardText
Returns text from RPA agent clipboardDriver Type: Desktop
- Returns:
- text from clipboard
-
copySelectedText
Copies currently selected text and returns it.Driver Type: Desktop
- Returns:
- text from clipboard
-
selectAllTextAndCopy
Select all text in current window and copies it to clipboard.
The same as (CTRL + A; CTRL + C)Driver Type: Desktop
- Returns:
- text from clipboard
-
setClipboardText
Sets text to RPA agent clipboardDriver Type: Desktop
- Parameters:
text- text to set in clipboard
-
copyPuttyWindowText
Copies all text in PuTTY window. Fully supported for PuTTY starting from v.0.67- Sample
window("[CLASS:PuTTY]");sendKeys("vim 123.txt", Keys.ENTER);copyPuttyWindowText();
Driver Type: Desktop
specially implemented for PuTTY, fully supported for PuTTY starting from v.0.67
- Returns:
- text from PuTTY window
-
sendToAgent
Sends file to RPA Agent default temp folder. If file already exists, it will be rewrittenDriver Type: Desktop
- Parameters:
textContent- file text content- Returns:
- absolute path to file
- Throws:
IOException
-
sendToAgent
Sends file to RPA Agent default temp folder. If file already exists, it will be rewrittenDriver Type: Desktop
- Parameters:
fileData- byte array- Returns:
- absolute path to file
- Throws:
IOException
-
sendToAgent
Sends file-data to RPA Agent. If file already exists, it will be rewrittenDriver Type: Desktop
- Parameters:
textContent- file text contentfilePath- path to save the file- Returns:
- absolute path to file
- Throws:
IOException
-
sendToAgent
Sends file-data to RPA Agent. If file already exists, it will be rewrittenDriver Type: Desktop
- Parameters:
fileData- byte arrayfilePath- path to save the file- Returns:
- absolute path to file
- Throws:
IOException
-
sendToAgent
public static String sendToAgent(byte[] fileData, String filePrefix, String fileSuffix) throws IOException Sends file-data to RPA Agent, create temporary fileDriver Type: Desktop
- Parameters:
fileData- byte arrayfilePrefix- prefix for file namefileSuffix- postfix for file name. Can be extension if starts from dot (.txt)- Returns:
- path to temp file
- Throws:
IOException
-
downloadFileFromAgent
Downloads file from RPA Agent machineNote: this method is intended for simple cases where it is convenient to read all bytes into a byte array. It is not intended for reading large files.
Driver Type: Desktop
- Parameters:
filePath- specifies path to the file that will be downloaded- Returns:
- content as byte[]
- Throws:
OutOfMemoryError- if an array of the required size cannot be allocated, for example the file is larger that2GBIOException
-
downloadTextFileFromAgent
Downloads text file from RPA Agent machineDriver Type: Desktop
- Parameters:
filePath- specifies path to the file that will be downloaded- Returns:
- content as String
- Throws:
IOException- See Also:
-
deleteFileOnAgent
Deletes file or folder on RPA Agent machineDriver Type: Desktop
- Parameters:
filePath- specifies path to the file or folder that will be deleted- Returns:
- boolean: was file/folder deleted or not
-
downloadFileOnAgent
Downloads a file and saves it on RPA agent machine (in default temp folder)Driver Type: Desktop
- Parameters:
downloadLink- link to download the file- Returns:
- path to downloaded file
- Throws:
IOException
-
downloadFileOnAgent
Downloads a file and saves it on RPA agent machineDriver Type: Desktop
- Parameters:
downloadLink- link to download the filefilePath- specifies folder to save file- Returns:
- path to downloaded file
- Throws:
IOException
-
switchSendRawKeysMode
public static com.workfusion.rpa.internal.api.driver.WebDriver switchSendRawKeysMode(boolean enable) Enables/disables sending keys as is (raw keys mode) or as with handling special keys (CTRL, SHIFT, etc). Helpful for sending text as is, which contains special text, ex. passwords.Driver Type: Desktop
- Parameters:
enable- - true - send as raw keys; false - send as special keys;- Returns:
- current driver
-
setOption
Sets an option related to a desktop driverDriver Type: Desktop
- Parameters:
key- option keyvalue- option string value
-
setOption
Sets an option related to a desktop driverDriver Type: Desktop
- Parameters:
key- option keyvalue- option boolean value
-
isOptionEnabled
Checks if an option related to a desktop driver is enabledDriver Type: Desktop
- Parameters:
key- option key- Returns:
- true if option is enabled, false otherwise
-
getOption
Gets an option related to a desktop driverDriver Type: Desktop
- Parameters:
key- option key- Returns:
- option's value if it exists, null otherwise
-
enableTypeOnScreen
public static void enableTypeOnScreen()Sets an option typeOnScreen is TRUE to a desktop driverDriver Type: Desktop
Enabling this option makes your automation less stable in case some popup windows appear.
-
disableTypeOnScreen
public static void disableTypeOnScreen()Sets an option typeOnScreen is FALSE to a desktop driverDriver Type: Desktop
-
setReturnTypeAsJSON
public static void setReturnTypeAsJSON()Sets an option returnType is JSON to a desktop driverDriver Type: Desktop
-
setReturnTypeAsString
public static void setReturnTypeAsString()Sets an option returnType is STRING to a desktop driverDriver Type: Desktop
-