RPA.Desktop

Clear the system clipboard.

Click at the element indicated by locator.

Arguments

ArgumentTypeDefault valueDescription
locatorstr, Locator, NoneNoneLocator for click position
actionActionclickClick action, e.g. right click
param locator:Locator for click position
param action:Click action, e.g. right click

Examples

Click Click LoginForm.Button Click coordinates:500,200 triple click

Click at a given pixel offset from the given locator.

Arguments

ArgumentTypeDefault valueDescription
locatorstr, Locator, NoneNoneLocator for click start position
xint0Click horizontal offset in pixels
yint0Click vertical offset in pixels
actionActionclickClick action, e.g. right click
param locator:Locator for click start position
param x:Click horizontal offset in pixels
param y:Click vertical offset in pixels
param action:Click action, e.g. right click

Examples

Click with offset Robocorp.Logo y=400

Close all opened applications.

Examples

Open file order1.docx Open file order2.docx Open file order3.docx # Do something with Word Close all applications

Close given application. Needs to be started with this library.

Arguments

ArgumentTypeDefault valueDescription
appApplicationnullApp instance
param app:App instance

Examples

# Open a file with a default application ${word}= Open file template.docx # Do something with Word Close application ${word} # Open a an application with a specific executable ${ie}= Open application iexplore.exe # Do something with IE Close application ${ie}

Read value to system clipboard from given input element.

Arguments

ArgumentTypeDefault valueDescription
locatorstr, LocatornullLocator for element
param locator:Locator for element
returns:Current clipboard value

Examples

${value}= Copy to clipboard ResultPage.Counter Log Copied text: ${value}

Return a new Region with the given dimensions.

Arguments

ArgumentTypeDefault valueDescription
leftintnullLeft edge coordinate.
topintnullTop edge coordinate.
rightintnullRight edge coordinate.
bottomintnullBottom edge coordinate.
param left:Left edge coordinate.
param top:Top edge coordinate.
param right:Right edge coordinate.
param bottom:Bottom edge coordinate.

Usage examples:

${region}= Define Region 10 10 50 30
region = desktop.define_region(10, 10, 50, 30)

Drag mouse from source to destination while holding the left mouse button.

Arguments

ArgumentTypeDefault valueDescription
sourcestr, LocatornullLocator for start position
destinationstr, LocatornullLocator for destination position
start_delayfloat2.0Delay in seconds after pressing down mouse button
end_delayfloat0.5Delay in seconds before releasing mouse button
param source:Locator for start position
param destination:
 Locator for destination position
param start_delay:
 Delay in seconds after pressing down mouse button
param end_delay:
 Delay in seconds before releasing mouse button

Find an element defined by locator, and return its position. Raises ElementNotFound if` no matches were found, or MultipleElementsFound if there were multiple matches.

Arguments

ArgumentTypeDefault valueDescription
locatorstr, LocatornullLocator string
param locator:Locator string

Examples

${match}= Find element image:logo.png Log Found logo at ${match.right}, ${match.top}

Find all elements defined by locator, and return their positions.

Arguments

ArgumentTypeDefault valueDescription
locatorstr, LocatornullLocator string
param locator:Locator string

Examples

${matches}= Find elements image:icon.png FOR ${match} IN @{matches} Log Found icon at ${match.right}, ${match.top} END

Read current value from system clipboard.

Examples

Copy to clipboard coordinates:401,198 ${text}= Get clipboard value Log We just copied '${text}'

Returns the dimensions of the current virtual display, which is the combined size of all physical monitors.

Get current mouse position in pixel coordinates.

Examples

${position}= Get mouse position Log Current mouse position is ${position.x}, ${position.y}

Draw an outline around all matching elements.

Arguments

ArgumentTypeDefault valueDescription
locatorstr, Locatornull

Move mouse to given coordinates.

Arguments

ArgumentTypeDefault valueDescription
locatorstr, LocatornullLocator for mouse position
param locator:Locator for mouse position

Examples

Move mouse Robocorp.Logo Move mouse offset:0,400

Return a new Region with an offset from the given region.

Arguments

ArgumentTypeDefault valueDescription
regionRegionnullThe region to move.
leftintnullAmount of pixels to move left/right.
topintnullAmount of pixels to move up/down.
param region:The region to move.
param left:Amount of pixels to move left/right.
param top:Amount of pixels to move up/down.

Usage examples:

${region}= Find Element ocr:"Net Assets" ${moved_region}= Move Region ${region} 500 0
region = desktop.find_element('ocr:"Net Assets"') moved_region = desktop.move_region(region, 500, 0)

Start a given application by name (if in PATH), or by path to executable.

Arguments

ArgumentTypeDefault valueDescription
name_or_pathstrnullName or path of application
argsnullCommand line arguments for application
param name_or_path:
 Name or path of application
param args:Command line arguments for application
returns:Application instance

Examples

Open application notepad.exe Open application c:\path\to\program.exe --example-argument

Open a file with the default application.

Arguments

ArgumentTypeDefault valueDescription
pathstrnullPath to file
param path:Path to file

Examples

Open file orders.xlsx

Paste value from system clipboard into given element.

Arguments

ArgumentTypeDefault valueDescription
locatorstr, LocatornullLocator for element
param locator:Locator for element

Examples

Copy to clipboard coordinates:401,198 Paste from clipboard coordinates:822,710

Press multiple keys down simultaneously.

Arguments

ArgumentTypeDefault valueDescription
keysstrnullKeys to press
param keys:Keys to press

Examples

Press keys ctrl alt delete Press keys ctrl a Press keys ctrl c ${all_text}= Get clipboard value Log Text box content was: ${all_text}

Press down mouse button and keep it pressed.

Arguments

ArgumentTypeDefault valueDescription
buttonAnyleft

Read text using OCR from the screen, or an area of the screen defined by the given locator.

Arguments

ArgumentTypeDefault valueDescription
locatorstr, NoneNoneLocation of element to read text from
invertboolFalseInvert image colors, useful for reading white text on dark background
param locator:Location of element to read text from
param invert:Invert image colors, useful for reading white text on dark background

Usage examples:

${label_region}= Find Element image:label.png ${value_region}= Move Region ${label_region} 100 0 ${text}= Read Text ${value_region}
label_region = desktop.find_element("image:label.png") value_region = desktop.move_region(label_region, 100, 0) text = desktop.read_text(value_region)

Release mouse button that was previously pressed.

Arguments

ArgumentTypeDefault valueDescription
buttonAnyleft

Return a resized new Region from a given region.

Arguments

ArgumentTypeDefault valueDescription
regionRegionnullThe region to resize.
leftint0Amount of pixels to resize left edge.
topint0Amount of pixels to resize top edge.
rightint0Amount of pixels to resize right edge.
bottomint0Amount of pixels to resize bottom edge.

Extends edges the given amount outward from the center, i.e. positive left values move the left edge to the left.

param region:The region to resize.
param left:Amount of pixels to resize left edge.
param top:Amount of pixels to resize top edge.
param right:Amount of pixels to resize right edge.
param bottom:Amount of pixels to resize bottom edge.

Usage examples:

${region}= Find Element ocr:"Net Assets" ${resized_region}= Resize Region ${region} bottom=10
region = desktop.find_element('ocr:"Net Assets"') resized_region = desktop.resize_region(region, bottom=10)

Write given value to system clipboard.

Arguments

ArgumentTypeDefault valueDescription
textstrnull

Examples

Set clipboard value This is some text. Paste from clipboard coordinates:822,710

Set the default template matching confidence.

Arguments

ArgumentTypeDefault valueDescription
confidencefloat, NoneNoneValue from 1 to 100
param confidence:
 Value from 1 to 100

Set the default time to wait for elements.

Arguments

ArgumentTypeDefault valueDescription
timeoutfloat3.0Time in seconds
param timeout:Time in seconds

Take a screenshot of the whole screen, or an element identified by the given locator.

Arguments

ArgumentTypeDefault valueDescription
pathstr, NoneNonePath to screenshot. The string {index} will be replaced with an index number to avoid overwriting previous screenshots.
locatorstr, Locator, NoneNoneElement to crop screenshot to
embedboolTrueEmbed screenshot into Robot Framework log
param path:Path to screenshot. The string {index} will be replaced with an index number to avoid overwriting previous screenshots.
param locator:Element to crop screenshot to
param embed:Embed screenshot into Robot Framework log

Type text one letter at a time.

Arguments

ArgumentTypeDefault valueDescription
textstrnullText to write
modifiersstrnullModifier or functions keys held during typing
enterboolFalsePress Enter / Return key after typing text
param text:Text to write
param modifiers:
 Modifier or functions keys held during typing
param enter:Press Enter / Return key after typing text

Examples

Type text this text will be uppercase shift

Type text at the position indicated by given locator.

Arguments

ArgumentTypeDefault valueDescription
locatorstr, LocatornullLocator of input element
textstrnullText to write
clearboolFalseClear element before writing
enterboolFalsePress Enter / Return key after typing text
param locator:Locator of input element
param text:Text to write
param clear:Clear element before writing
param enter:Press Enter / Return key after typing text

Examples

Type text into LoginForm.Name Marky Mark Type text into LoginForm.Password ${PASSWORD}

Wait for an element defined by locator to exist, or raise a TimeoutException if none were found within timeout.

Arguments

ArgumentTypeDefault valueDescription
locatorstr, LocatornullLocator string
timeoutfloat, NoneNone
intervalfloat0.5
param locator:Locator string

Examples

Wait for element alias:CookieConsent timeout=30 Click image:%{ROBOT_ROOT}/accept.png