public class RPA extends Object
RemoteWebDriver
Action
Actions
Mouse
Keyboard
Wait
FluentWait
WebDriverWait
ExpectedCondition
ExpectedConditions
Coordinates
ApiUtils
PointedCoordinates
RobotsMouse
UiElement
UiElementCollection
UiCondition
UiCollectionCondition
Classes from the following packages also are automatically imported into Machine configs:
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:
Modifier and Type | Field and Description |
---|---|
static String |
ACTION_COPY_SELECTED_TEXT |
static String |
ACTION_GET_CLIPBOARD_TEXT |
static String |
ACTION_PUTTY_COPY_ALL_TEXT |
static String |
ACTION_SELECT_ALL_TEXT_AND_COPY |
static long |
SWITCH_WINDOW_TIMEOUT |
Modifier and Type | Method and Description |
---|---|
static UiElement |
$(org.openqa.selenium.By seleniumSelector)
Finds the first element matching given descriptor
|
static UiElement |
$(org.openqa.selenium.By seleniumSelector,
int index)
Driver Type: Desktop, Web
|
static UiElement |
$(String cssSelector)
Finds the first element matching given CSS selector
|
static UiElement |
$(String cssSelector,
int index)
Finds the Nth element matching given criteria
|
static UiElement |
$(org.openqa.selenium.WebElement webElement)
Wraps standard Selenium WebElement into UiElement
to use additional methods like shouldHave(), selectOption(), etc.
|
static UiElementCollection |
$$(org.openqa.selenium.By seleniumSelector)
Find all elements matching given descriptor.
|
static UiElementCollection |
$$(Collection<? extends org.openqa.selenium.WebElement> elements)
Initializes collection with Elements
|
static UiElementCollection |
$$(String cssSelector)
Finds all elements matching given CSS selector.
|
static org.openqa.selenium.interactions.Actions |
actions()
With this method you can use Selenium Actions like described in the
AdvancedUserInteractions page.
|
static void |
back()
Desktop: moves back to preview window in desktopDriver history
|
static void |
cleanClipboard()
Clean clipboard.
|
static RobotClipboard |
clipboard()
Returns clipboard implementation based on the settings
|
static String |
clipboardText()
Returns text from RPA agent clipboard
|
static void |
close()
Closes the current window.
|
static String |
confirm()
Accepts (Clicks "Yes" or "Ok") in the existing confirmation dialog (javascript 'alert' or 'confirm').
|
static String |
confirm(String expectedDialogText)
Accepts (Clicks "Yes" or "Ok") in the existing confirmation dialog (javascript 'alert' or 'confirm').
|
static String |
copyPuttyWindowText()
Copies all text in PuTTY window.
|
static String |
copySelectedText()
Copies currently selected text and returns it.
|
static boolean |
deleteFileOnAgent(String filePath)
Deletes file or folder on RPA Agent machine
|
static void |
disableTypeOnScreen()
Sets an option typeOnScreen is FALSE to a desktop driver
|
static String |
dismiss()
Dismisses (clicks "No" or "Cancel") in the existing confirmation dialog (javascript 'alert' or 'confirm').
|
static String |
dismiss(String expectedDialogText)
Dismisses (clicks "No" or "Cancel") in the existing confirmation dialog (javascript 'alert' or 'confirm').
|
static byte[] |
downloadFileFromAgent(String filePath)
Downloads file from RPA Agent machine
|
static String |
downloadFileOnAgent(String downloadLink)
Downloads a file and saves it on RPA agent machine (in default temp folder)
|
static String |
downloadFileOnAgent(String downloadLink,
String filePath)
Downloads a file and saves it on RPA agent machine
|
static String |
downloadTextFileFromAgent(String filePath)
Downloads text file from RPA Agent machine
|
static com.workfusion.rpa.driver.Driver |
driver()
Short definition for accessing current driver instance.
|
static void |
enableTypeOnScreen()
Sets an option typeOnScreen is TRUE to a desktop driver
|
static boolean |
exists(org.openqa.selenium.By selector)
Checks if element exists on the current page.
|
static boolean |
exists(String cssSelector)
Checks if element exists on the current page.
|
static org.openqa.selenium.support.ui.FluentWait<org.openqa.selenium.WebDriver> |
fluentWait()
Creates an org.openqa.selenium.support.ui.FluentWait instance with Selenide timeout/polling.
|
static void |
forward()
Desktop: moves forward to next window in desktopDriver history
|
static List<String> |
getDriverLogs(LogType logType)
Driver Type: Web
|
static List<String> |
getDriverLogs(LogType logType,
Level logLevel)
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. |
static UiElement |
getElement(org.openqa.selenium.By criteria)
Finds the first element matching given criteria
|
static UiElement |
getElement(org.openqa.selenium.By criteria,
int index)
Finds the Nth element matching given criteria
|
static UiElementCollection |
getElements(org.openqa.selenium.By criteria)
Finds all elements matching given descriptor
|
static long |
getFluentWaitPollingInterval()
Returns the frequency with which to check the condition, for example in:
|
static long |
getFluentWaitTimeout()
Returns the maximum amount of time to wait for a condition, for example in:
|
static UiElement |
getFocusedElement()
Returns the currently focused UiElement,
that is, the element that will get keystroke events if the user types any.
|
static org.openqa.selenium.WebDriver.Timeouts |
implicitlyWaitTimeout(long milliseconds)
Sets the maximum amount of time to wait for element search
|
static void |
inChrome(groovy.lang.Closure closure)
Is used for explicitly Chrome driver choosing.
|
static void |
inDesktop(groovy.lang.Closure closure)
Is used for explicitly Desktop driver choosing.
|
static void |
inEdge(groovy.lang.Closure closure)
Is used for explicitly Edge driver choosing.
|
static void |
inFirefox(groovy.lang.Closure closure)
Is used for explicitly Firefox driver choosing.
|
static void |
inIE(groovy.lang.Closure closure)
Is used for explicitly IE driver choosing.
|
static boolean |
isOptionEnabled(String key)
Checks if an option related to a desktop driver is enabled
|
static RobotsKeyboard |
keyboard()
Short definition for accessing current driver keyboard.
|
static void |
minimizeWindow()
Minimizes current window
|
static RobotsMouse |
mouse()
Short definition for accessing current driver mouse.
|
static Integer |
open(Object target)
Opens a specified URL or application
|
static Integer |
open(String target)
Opens a specified URL or application
|
static void |
open(URL absoluteUrl)
Opens a specified absolute URL
|
static Integer |
openAndFocus(String path2launch,
long timeout,
long polling)
Opens a specified URL or application and sets focus
|
static void |
openChrome(String target)
Opens a specified URL in Chrome browser
|
static void |
openEdge(String target)
Opens a specified URL in Edge browser
|
static void |
openFirefox(String target)
Opens a specified URL in Firefox browser
|
static void |
openIE(String target)
Opens a specified URL in IE browser
|
static String |
openLinkInNewWindow(org.openqa.selenium.By by)
Opens the specified link in a new browser's tab.
|
static String |
openLinkInNewWindow(String url)
Opens the link in a new browser's tab.
|
static String |
openNewWindow()
Opens a new browser's tab.
|
static org.openqa.selenium.WebDriver.Timeouts |
pageLoadTimeout(long milliseconds)
Sets the maximum amount of time to wait for page to load
|
static void |
pressAltF4()
Send ALT+F4 to the current window.
|
static void |
pressBackSpace()
Send BACK_SPACE to the current window.
|
static void |
pressCtrlA()
Send CTRL+A to the current window.
|
static void |
pressCtrlC()
Send CTRL+C to the current window.
|
static void |
pressCtrlShiftZ()
Send CTRL+SHIFT+Z to the current window.
|
static void |
pressCtrlV()
Send CTRL+V to the current window.
|
static void |
pressCtrlX()
Send CTRL+X to the current window.
|
static void |
pressCtrlZ()
Send CTRL+Z to the current window.
|
static void |
pressEnter()
Sends ENTER to the current window.
|
static void |
pressEscape()
Sends ESCAPE to the current window.
|
static void |
pressSpace()
Sends SPACE to the current window.
|
static void |
pressTab()
Sends TAB to the current window.
|
static void |
refresh()
Refreshes the current page
|
static BufferedImage |
screenshotAsImage()
Takes a screenshot of the current window
|
static org.openqa.selenium.WebDriver.Timeouts |
scriptTimeout(long milliseconds)
Sets the maximum amount of time to wait for script execution
|
static String |
selectAllTextAndCopy()
Select all text in current window and copies it to clipboard.
|
static void |
sendKeys(CharSequence... charSequences)
Sends a string to current window using keyboard.
|
static void |
sendKeys(Object text)
Sends a string to current window using keyboard.
|
static String |
sendToAgent(byte[] fileData)
Sends file to RPA Agent default temp folder.
|
static String |
sendToAgent(byte[] fileData,
String filePath)
Sends file-data to RPA Agent.
|
static String |
sendToAgent(byte[] fileData,
String filePrefix,
String fileSuffix)
Sends file-data to RPA Agent, create temporary file
|
static String |
sendToAgent(String textContent)
Sends file to RPA Agent default temp folder.
|
static String |
sendToAgent(String textContent,
String filePath)
Sends file-data to RPA Agent.
|
static void |
setClipboardText(String text)
Sets text to RPA agent clipboard
|
static void |
setFluentWaitPollingInterval(long fluentWaitPollingInterval)
Sets The frequency with which to check the condition, for example in:
|
static void |
setFluentWaitTimeout(long fluentWaitTimeout)
Sets the maximum amount of time to wait for a condition, for example in:
|
static void |
setImageMatchingOptions(Map<String,Object> options)
Sets the Image Matching Options
|
static void |
setOption(String key,
boolean value)
Sets an option related to a desktop driver
|
static void |
setReturnTypeAsJSON()
Sets an option returnType is JSON to a desktop driver
|
static void |
setReturnTypeAsString()
Sets an option returnType is STRING to a desktop driver
|
static void |
sleep(long milliseconds)
Wait for a specified number of milliseconds before the next step.
|
static org.openqa.selenium.WebDriver |
switchSendRawKeysMode(boolean enable)
Enables/disables sending keys as is (raw keys mode) or as with handling special keys (CTRL, SHIFT, etc).
|
static org.openqa.selenium.WebDriver.TargetLocator |
switchTo()
Switch to window/tab/frame/parentFrame/innerFrame/alert.
|
static org.openqa.selenium.WebDriver.Window |
switchToExistingWindow(String titleOrDescriptor)
Switches to a existing window with a specified title or descriptor
Sample
switchToExistingWindow("[CLASS:Notepad]")
|
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)
|
static String |
switchToLastWindow()
Deprecated.
As of Release 9.1, since window switching algorithm works by default with all opened windows |
static String |
switchToNextWindow()
Deprecated.
As of Release 9.1, since window switching algorithm works by default with all opened windows |
static String |
switchToPrevWindow()
Deprecated.
As of Release 9.1, since window switching algorithm works by default with all opened windows |
static String |
switchToRootWindow()
Deprecated.
As of Release 9.1, since window switching algorithm works by default with all opened windows |
static org.openqa.selenium.WebDriver.Timeouts |
timeouts()
Driver Type: Desktop, Web
|
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
|
static String |
title()
Returns the title of the current page.
|
static org.openqa.selenium.support.ui.FluentWait<org.openqa.selenium.WebDriver> |
Wait()
Deprecated.
As of Release 9.2, please use fluentWait() instead |
static org.openqa.selenium.WebDriver.Window |
window()
Returns the current window
Sample
window().fullscreen();
|
static org.openqa.selenium.WebDriver.Window |
window(String titleOrDescriptor)
Switches to a window with a specified title or descriptor
Sample
window("[CLASS:Notepad]")
|
static void |
zoom(double factor)
Zoom the current page (in or out).
|
public static final String ACTION_GET_CLIPBOARD_TEXT
public static final String ACTION_COPY_SELECTED_TEXT
public static final String ACTION_SELECT_ALL_TEXT_AND_COPY
public static final String ACTION_PUTTY_COPY_ALL_TEXT
public static final long SWITCH_WINDOW_TIMEOUT
public static com.workfusion.rpa.driver.Driver driver()
Driver Type: Desktop, Web
RemoteWebDriver
public static RobotsKeyboard keyboard()
keyboard().sendKeys(Keys.TAB);
Driver Type: Desktop, Web
Keyboard
public static RobotsMouse mouse()
mouse().doubleClick(20, 40).contextClick(100, 78);
Driver Type: Desktop, Web
Mouse
public static org.openqa.selenium.WebDriver.TargetLocator switchTo()
Switch to window/tab/frame/parentFrame/innerFrame/alert.
Similar to org.openqa.selenium.WebDriver#switchTo()
switchTo().window("[CLASS:Notepad]").close();
Driver Type: Desktop, Web
public static org.openqa.selenium.WebDriver.Window window()
window().fullscreen();
Driver Type: Desktop, Web
WebDriver.Window
public static void minimizeWindow()
Driver Type: Desktop
public static org.openqa.selenium.WebDriver.Window switchToExistingWindow(String titleOrDescriptor, Long timeoutInMillis)
switchToExistingWindow("[CLASS:Notepad]", 100L)
Driver Type: Desktop
titleOrDescriptor
- string representation of a window title or descriptortimeoutInMillis
- timeout in milliseconds for find last open windowpublic static org.openqa.selenium.WebDriver.Window switchToExistingWindow(String titleOrDescriptor)
switchToExistingWindow("[CLASS:Notepad]")
Driver Type: Desktop
titleOrDescriptor
- string representation of a window title or descriptorpublic static org.openqa.selenium.WebDriver.Window window(String titleOrDescriptor)
window("[CLASS:Notepad]")
Driver Type: Desktop, Web
titleOrDescriptor
- string representation of a window title or descriptorpublic static void sendKeys(Object text)
Sends a string to current window using keyboard.
Delegates invocation to driver.getKeyboard().sendKeys(...)
Driver Type: Desktop, Web
text
- can be a Collection or Array, all items will be concatenatedpublic static void sendKeys(CharSequence... charSequences)
Sends a string to current window using keyboard.
Delegates invocation to driver.getKeyboard().sendKeys(...)
Driver Type: Desktop, Web
charSequences
- can be a Char Sequence (ex. String, Keys.CHAR), all items will be concatenatedpublic static void pressEnter()
pressEnter();Implementation details: This is the same as
driver().getKeyboard().sendKeys(Keys.ENTER)
Driver Type: Desktop, Web
public static void pressTab()
pressTab();Implementation details: This is the same as
driver().getKeyboard().sendKeys(Keys.TAB)
Driver Type: Desktop, Web
public static void pressEscape()
pressEscape();Implementation details: This is the same as
driver().getKeyboard().sendKeys(Keys.ESCAPE)
Driver Type: Desktop, Web
public static void pressSpace()
pressSpace();Implementation details: This is the same as
driver().getKeyboard().sendKeys(Keys.SPACE)
Driver Type: Desktop, Web
public static void pressBackSpace()
pressBackSpace();Implementation details: This is the same as
driver().getKeyboard().sendKeys(Keys.BACK_SPACE)
Driver Type: Desktop, Web
public static void pressCtrlA()
pressCtrlA();Implementation details: This is the same as
driver().getKeyboard().sendKeys(Keys.chord(Keys.CONTROL, "a"))
Driver Type: Desktop, Web
public static void pressCtrlC()
pressCtrlC();Implementation details: This is the same as
driver().getKeyboard().sendKeys(Keys.chord(Keys.CONTROL, "c"))
Driver Type: Desktop, Web
public static void pressCtrlV()
pressCtrlV();Implementation details: This is the same as
driver().getKeyboard().sendKeys(Keys.chord(Keys.CONTROL, "v"))
Driver Type: Desktop, Web
public static void pressCtrlX()
pressCtrlX();Implementation details: This is the same as
driver().getKeyboard().sendKeys(Keys.chord(Keys.CONTROL, "x"))
Driver Type: Desktop, Web
public static void pressCtrlZ()
pressCtrlZ();Implementation details: This is the same as
driver().getKeyboard().sendKeys(Keys.chord(Keys.CONTROL, "z"))
Driver Type: Desktop, Web
public static void pressCtrlShiftZ()
pressCtrlShiftZ();Implementation details: This is the same as
driver().getKeyboard().sendKeys(Keys.chord(Keys.CONTROL, Keys.SHIFT, "z"))
Driver Type: Desktop, Web
public static void pressAltF4()
pressAltF4();Implementation details: This is the same as
driver().getKeyboard().sendKeys(Keys.chord(Keys.ALT, Keys.F4))
Driver Type: Desktop, Web
public static Integer openAndFocus(String path2launch, long timeout, long polling)
Object calculator = "calc.exe"; openAndFocus(calculator, 1000, 250);
Driver Type: Desktop
path2launch
- Application pathtimeout
- Timeout during driver try get focus in millisecondspolling
- Polling interval in millisecondspublic static Integer open(Object target)
Object calculator = "calc.exe"; open(calculator);
Driver Type: Desktop, Web
target
- object that will be converted to Stringpublic static Integer open(String target)
open("calc.exe");
Driver Type: Desktop, Web
target
- String with URL or application pathpublic static void openFirefox(String target)
open("https://workfusion.com");
Driver Type: Universal
target
- String with URLpublic static void inFirefox(groovy.lang.Closure closure)
inFirefox() { open("https://workfusion.com") }Such constructions are not supported e.g
inFirefox{ inChrome() { open("https://workfusion.com") } }
Driver Type: Universal
closure
- code that will be executed using Firefox driverpublic static void openIE(String target)
open("https://workfusion.com");
Driver Type: Universal
target
- String with URLpublic static void inIE(groovy.lang.Closure closure)
inIE() { open("https://workfusion.com") }Such constructions are not supported e.g
inIE{ inChrome() { open("https://workfusion.com") } }
Driver Type: Universal
closure
- code that will be executed using IE driverpublic static void openChrome(String target)
open("https://workfusion.com");
Driver Type: Universal
target
- String with URLpublic static void openEdge(String target)
open("https://workfusion.com");
Driver Type: Universal
target
- String with URLpublic static void inChrome(groovy.lang.Closure closure)
inChrome() { open("https://workfusion.com") }Such constructions are not supported e.g
inChrome{ inDesktop() { open("https://workfusion.com") } }
Driver Type: Universal
closure
- code that will be executed using Chrome driverpublic static void inDesktop(groovy.lang.Closure closure)
inDesktop() { open("https://workfusion.com") }Such constructions are not supported e.g
inDesktop{ inChrome() { open("https://workfusion.com") } }
Driver Type: Universal
closure
- code that will be executed using Desktop driverpublic static void inEdge(groovy.lang.Closure closure)
inEdge() { open("https://workfusion.com") }Such constructions are not supported e.g
inEdge{ inChrome() { open("https://workfusion.com") } }
Driver Type: Universal
closure
- code that will be executed using Edge driverpublic static void open(URL absoluteUrl)
open(new URL("https://workfusion.com"));
Driver Type: Web
absoluteUrl
- String with absolute URLpublic static void close()
Closes the current window.
This is the same as:driver.close();
Driver Type: Desktop, Web
public static void refresh()
Refreshes the current page
This is the same as:driver.navigate().refresh();
Driver Type: Web
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();
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();
public static String title()
Returns the title of the current page.
This is the same as:driver.title();
Driver Type: Desktop, Web
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
milliseconds
- time to sleep in millisecondspublic static UiElement $(org.openqa.selenium.WebElement webElement)
Driver Type: Desktop, Web
webElement
- standard Selenium WebElementUiElement
public static boolean exists(String cssSelector)
Driver Type: Desktop, Web
cssSelector
- any CSS selector like "input[name='first_name']" or "#messages .new_message"public static boolean exists(org.openqa.selenium.By selector)
Driver Type: Desktop, Web
selector
- any selector like:By.id(), By.name(), By.cssSelector("[CLASS:Edit; INSTANCE:1]")
public static UiElement $(String cssSelector)
Driver Type: Desktop, Web
cssSelector
- any CSS selector like "input[name='first_name']" or "#messages .new_message"public static UiElement $(org.openqa.selenium.By seleniumSelector)
Driver Type: Desktop, Web
seleniumSelector
- any selector like:By.id(), By.name(), By.cssSelector("[CLASS:Edit; INSTANCE:1]")
public static UiElement $(org.openqa.selenium.By seleniumSelector, int index)
Driver Type: Desktop, Web
getElement(By, int)
public static UiElement $(String cssSelector, int index)
Driver Type: Desktop, Web
cssSelector
- any CSS selector like "input[name='first_name']" or "#messages .new_message"index
- 0..Npublic static UiElementCollection $$(Collection<? extends org.openqa.selenium.WebElement> elements)
Driver Type: Desktop, Web
elements
- Collection of standard Selenium WebElements$(WebElement)
public static UiElementCollection $$(String cssSelector)
Driver Type: Desktop, Web
cssSelector
- any CSS selector like "input[name='first_name']" or "#messages .new_message"$(String)
public static UiElementCollection $$(org.openqa.selenium.By seleniumSelector)
Driver Type: Desktop, Web
seleniumSelector
- any selector like:By.id(), By.name(), By.cssSelector("[CLASS:Edit; INSTANCE:1]")
$(By)
public static UiElement getElement(org.openqa.selenium.By criteria)
Driver Type: Desktop, Web
criteria
- instance of By: By.id(), By.className() etc.public static UiElement getElement(org.openqa.selenium.By criteria, int index)
Driver Type: Desktop, Web
criteria
- instance of By: By.id(), By.className() etc.index
- 0..NIndexOutOfBoundsException
- if the specified index does not existpublic static UiElementCollection getElements(org.openqa.selenium.By criteria)
Driver Type: Desktop, Web
criteria
- instance of By: By.id(), By.className() etc.public static String confirm()
Driver Type: Web
org.openqa.selenium.TimeoutException
- if dialog is not shownpublic static String confirm(String expectedDialogText)
Driver Type: Web
expectedDialogText
- if not null, checks that confirmation dialog displays this message (case-sensitive)IllegalStateException
- if confirmation message differs from expected messageorg.openqa.selenium.TimeoutException
- if dialog is not shownpublic static String dismiss()
Driver Type: Web
org.openqa.selenium.TimeoutException
- if dialog is not shownpublic static String dismiss(String expectedDialogText)
Driver Type: Web
expectedDialogText
- if not null, checks that confirmation dialog displays this message (case-sensitive)IllegalStateException
- if confirmation message differs from expected messageorg.openqa.selenium.TimeoutException
- if dialog is not shownpublic static UiElement getFocusedElement()
Driver Type: Web
getFocusedElement().sendKeys(Keys.ENTER);
@Deprecated public static org.openqa.selenium.support.ui.FluentWait<org.openqa.selenium.WebDriver> Wait()
As of Release 9.2, please use fluentWait() instead
Wait().until(invisibilityOfElementLocated(By.id("magic-id")));
Driver Type: Desktop, Web
getFluentWaitPollingInterval()
,
getFluentWaitTimeout()
public static org.openqa.selenium.support.ui.FluentWait<org.openqa.selenium.WebDriver> fluentWait()
fluentWait().until(invisibilityOfElementLocated(By.id("magic-id")));
Driver Type: Desktop, Web
getFluentWaitPollingInterval()
,
getFluentWaitTimeout()
public static org.openqa.selenium.interactions.Actions actions()
actions() .sendKeys($(By.name("rememberMe")), "John") .click($(#rememberMe")) .click($(byText("Login"))) .build() .perform();
Driver Type: Desktop, Web
public static void zoom(double factor)
Driver Type: Web
factor
- e.g. 1.1 or 2.0 or 0.5public static List<String> getDriverLogs(LogType logType)
Driver Type: Web
getDriverLogs(LogType, Level)
public static List<String> getDriverLogs(LogType logType, Level logLevel)
for(String logEntry : getDriverLogs(LogType.BROWSER, Level.ALL)) {
Reporter.log(logEntry + "<br>");
}
Note that currently "manage().logs()" is in the Beta stage.
Driver Type: Web
@Deprecated public static String switchToRootWindow()
As of Release 9.1, since window switching algorithm works by default with all opened windows
@Deprecated public static String switchToLastWindow()
As of Release 9.1, since window switching algorithm works by default with all opened windows
@Deprecated public static String switchToPrevWindow()
As of Release 9.1, since window switching algorithm works by default with all opened windows
@Deprecated public static String switchToNextWindow()
As of Release 9.1, since window switching algorithm works by default with all opened windows
public static String openNewWindow()
Driver Type: Web
public static String openLinkInNewWindow(String url)
Driver Type: Web
public static String openLinkInNewWindow(org.openqa.selenium.By by)
Driver Type: Web
openLinkInNewWindow(byCssSelector(".container a.create-new")).switchTo();
by
- - link descriptorpublic static long getFluentWaitTimeout()
Wait().until(<some_condition>); $(".demo-el").waitUntil(<other_condition>);
Driver Type: Desktop, Web
public static void setFluentWaitTimeout(long fluentWaitTimeout)
Wait().until(<some_condition>); $(".demo-el").waitUntil(<other_condition>);
Driver Type: Desktop, Web
fluentWaitTimeout
- timeout in millisecondspublic static long getFluentWaitPollingInterval()
Wait().until(<some_condition>); $(".demo-el").waitUntil(<other_condition>);
Driver Type: Desktop, Web
public static void setFluentWaitPollingInterval(long fluentWaitPollingInterval)
Wait().until(<some_condition>); $(".demo-el").waitUntil(<other_condition>);
Driver Type: Desktop, Web
fluentWaitPollingInterval
- frequency in millisecondspublic static org.openqa.selenium.WebDriver.Timeouts timeouts()
Driver Type: Desktop, Web
public static org.openqa.selenium.WebDriver.Timeouts timeouts(long milliseconds)
Driver Type: Desktop, Web
milliseconds
- timeout in millisecondssetFluentWaitTimeout(long)
,
implicitlyWaitTimeout(long)
,
pageLoadTimeout(long)
,
scriptTimeout(long)
public static org.openqa.selenium.WebDriver.Timeouts implicitlyWaitTimeout(long milliseconds)
Driver Type: Desktop, Web
milliseconds
- timeout in millisecondsWebDriver.Timeouts.implicitlyWait(long, TimeUnit)
public static org.openqa.selenium.WebDriver.Timeouts pageLoadTimeout(long milliseconds)
Driver Type: Desktop, Web
milliseconds
- timeout in millisecondsWebDriver.Timeouts.pageLoadTimeout(long, TimeUnit)
public static org.openqa.selenium.WebDriver.Timeouts scriptTimeout(long milliseconds)
Driver Type: Desktop, Web
milliseconds
- timeout in millisecondsWebDriver.Timeouts.setScriptTimeout(long, TimeUnit)
public static void setImageMatchingOptions(Map<String,Object> options)
Driver Type: Desktop/p>
options
- key-values optionspublic static BufferedImage screenshotAsImage()
Driver Type: Web
public static RobotClipboard clipboard()
Driver Type: Desktop
public static void cleanClipboard()
Driver Type: Desktop
setClipboardText(String)
public static String clipboardText()
Driver Type: Desktop
public static String copySelectedText()
Driver Type: Desktop
public static String selectAllTextAndCopy()
Driver Type: Desktop
public static void setClipboardText(String text)
Driver Type: Desktop
text
- text to set in clipboardpublic static String copyPuttyWindowText()
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.67public static String sendToAgent(String textContent)
Driver Type: Desktop
textContent
- file text contentpublic static String sendToAgent(byte[] fileData)
Driver Type: Desktop
fileData
- byte arraypublic static String sendToAgent(String textContent, String filePath)
Driver Type: Desktop
textContent
- file text contentfilePath
- path to save the filepublic static String sendToAgent(byte[] fileData, String filePath)
Driver Type: Desktop
fileData
- byte arrayfilePath
- path to save the filepublic static String sendToAgent(byte[] fileData, String filePrefix, String fileSuffix)
Driver Type: Desktop
fileData
- byte arrayfilePrefix
- prefix for file namefileSuffix
- postfix for file name. Can be extension if starts from dot (.txt)public static byte[] downloadFileFromAgent(String filePath)
Note: 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
filePath
- specifies path to the file that will be downloadedOutOfMemoryError
- if an array of the required size cannot be allocated, for
example the file is larger that 2GB
public static String downloadTextFileFromAgent(String filePath)
Driver Type: Desktop
filePath
- specifies path to the file that will be downloadeddownloadFileFromAgent(String)
public static boolean deleteFileOnAgent(String filePath)
Driver Type: Desktop
filePath
- specifies path to the file or folder that will be deletedpublic static String downloadFileOnAgent(String downloadLink)
Driver Type: Desktop
downloadLink
- link to download the filepublic static String downloadFileOnAgent(String downloadLink, String filePath)
Driver Type: Desktop
downloadLink
- link to download the filefilePath
- specifies folder to save filepublic static org.openqa.selenium.WebDriver switchSendRawKeysMode(boolean enable)
Driver Type: Desktop
enable
- - true - send as raw keys; false - send as special keys;public static void setOption(String key, boolean value)
Driver Type: Desktop
key
- option keyvalue
- option valuepublic static boolean isOptionEnabled(String key)
Driver Type: Desktop
key
- option keypublic static void enableTypeOnScreen()
Driver Type: Desktop
Enabling this option makes your automation less stable in case some popup windows appear.
public static void disableTypeOnScreen()
Driver Type: Desktop
public static void setReturnTypeAsJSON()
Driver Type: Desktop
public static void setReturnTypeAsString()
Driver Type: Desktop
Copyright 2016, WorkFusion, Inc.