Clear Anchor

Clears control anchor set by ``Set Anchor``

Clears control anchor set by Set Anchor

This means that all following keywords accessing elements will use active window or desktop as root element.

Click

Mouse click on element matching given locator.

Arguments

Argument Type Default value Description
locatorWindowsElement, strnullstring locator or Control element
wait_timefloat, NoneNonetime to wait after click, default is a library wait_time, see keyword Set Wait Time
timeoutfloat, NoneNonefloat value in seconds, see keyword Set Global Timeout

Exception ActionNotPossible is raised if element does not allow Click action.

param locator:string locator or Control element
param wait_time:
 time to wait after click, default is a library wait_time, see keyword Set Wait Time
param timeout:float value in seconds, see keyword Set Global Timeout
return:WindowsElement object

Examples

*** Tasks ***
Click  id:button1
Click  id:button2 offset:10,10
${element}=  Click  name:SendButton  wait_time=5.0

Close Current Window

Closes current active window or logs a warning message.

return:True if close was successful, False if not

Examples

*** Tasks ***
${status}=  Close Current Window

Control Child Window

Get control of child window of the active window by locator.

Arguments

Argument Type Default value Description
locatorWindowsElement, str, NoneNonestring locator or Control element
foregroundboolTrueTrue to bring window to foreground
wait_timefloat, NoneNonetime to wait after activeting a window
timeoutfloat, NoneNonefloat value in seconds, see keyword Set Global Timeout

Get control of child window of the active window by locator.

param locator:string locator or Control element
param foreground:
 True to bring window to foreground
param wait_time:
 time to wait after activeting a window
param timeout:float value in seconds, see keyword Set Global Timeout
return:WindowsElement object

Examples

*** Tasks ***
Control Window   subname:'Sage 50' type:Window
# actions on the main application window
# ...
# get control of child window of Sage application
Control Child Window   subname:'Test Company' depth:1

Control Window

Controls the window defined by the locator.

Arguments

Argument Type Default value Description
locatorWindowsElement, str, NoneNonestring locator or Control element
foregroundboolTrueTrue to bring window to foreground
wait_timefloat, NoneNonetime to wait after activating a window
timeoutfloat, NoneNonefloat value in seconds, see keyword Set Global Timeout
mainboolTrueon True (default) starts search from desktop level, on False will continue search on child elements of current active window

This means that this window is used as a root element for all the following keywords using locators.

Returns WindowsElement.

param locator:string locator or Control element
param foreground:
 True to bring window to foreground
param wait_time:
 time to wait after activating a window
param timeout:float value in seconds, see keyword Set Global Timeout
param main:on True (default) starts search from desktop level, on False will continue search on child elements of current active window
return:WindowsElement object

Examples

*** Tasks ***
Control Window   Calculator
Control Window   name:Calculator
Control Window   subname:Notepad
Control Window   regex:.*Notepad
${window}=  Control Window   executable:Spotify.exe

Double Click

Double mouse click on element matching given locator.

Arguments

Argument Type Default value Description
locatorWindowsElement, strnullstring locator or Control element
wait_timefloat, NoneNonetime to wait after click, default is a library wait_time, see keyword Set Wait Time
timeoutfloat, NoneNonefloat value in seconds, see keyword Set Global Timeout

Exception ActionNotPossible is raised if element does not allow Click action.

param locator:string locator or Control element
param wait_time:
 time to wait after click, default is a library wait_time, see keyword Set Wait Time
param timeout:float value in seconds, see keyword Set Global Timeout
return:WindowsElement object

Examples

*** Tasks ***
${element}=  Double Click  name:ResetButton

Foreground Window

Bring the current active window or the window defined by the locator to the foreground.

Arguments

Argument Type Default value Description
locatorWindowsElement, str, NoneNonestring locator or Control element

Bring the current active window or the window defined by the locator to the foreground.

param locator:string locator or Control element
return:WindowsElement object

Examples

*** Tasks ***
${window}=  Foreground Window   Calculator

Get Attribute

Get attribute value of the element defined by the locator.

Arguments

Argument Type Default value Description
locatorWindowsElement, strnullstring locator or Control element
attributestrnullname of the attribute to get
param locator:string locator or Control element
param attribute:
 name of the attribute to get
return:value of attribute

Examples

*** Tasks ***
${id}=   Get Attribute  type:Edit name:firstname   AutomationId

Get Element

Get Control element defined by the locator.

Arguments

Argument Type Default value Description
locatorWindowsElement, str, NoneNonelocator as a string or as a element
search_depthint8how deep the element search will traverse (default 8)
root_elementWindowsElement, NoneNonecan be used to set search root element
timeoutfloat, NoneNonefloat value in seconds, see keyword Set Global Timeout

Returned element can be used instead of a locator string for keywords accepting locator.

Keyword Get Attribute can be used to read element attribute values.

If locator is None then returned element will be in order of preference:

  1. anchor element if that has been set with Set Anchor
  2. current active window if that has been set with Control Window
  3. final option is the Desktop
param locator:locator as a string or as a element
param search_depth:
 how deep the element search will traverse (default 8)
param root_element:
 can be used to set search root element
param timeout:float value in seconds, see keyword Set Global Timeout
return:WindowsElement object

Examples

*** Tasks ***
${element}=    Get Element    name:'Text Editor*
Set Value   ${element}  note to myself

Get Elements

Get list of elements matching locator.

Arguments

Argument Type Default value Description
locatorstr, WindowsElementnulllocator as a string or as a element
search_depthint8how deep the element search will traverse (default 8)
root_elementWindowsElement, NoneNonecan be used to set search root element
timeoutfloat, NoneNonefloat value in seconds, see keyword Set Global Timeout
param locator:locator as a string or as a element
param search_depth:
 how deep the element search will traverse (default 8)
param root_element:
 can be used to set search root element
param timeout:float value in seconds, see keyword Set Global Timeout
return:list of WindowsElement objects

Examples

*** Tasks ***
Set Anchor    id:DataGrid
${elements}=    Get Elements    type:HeaderItem
FOR    ${el}    IN    @{elements}
    Log To Console    ${el.Name}
END

Get Text

Get text from Control element defined by the locator.

Arguments

Argument Type Default value Description
locatorWindowsElement, strnullstring locator or Control element

Exception ActionNotPossible is raised if element does not allow GetWindowText action.

param locator:string locator or Control element
return:value of WindowText attribute of an element

Examples

*** Tasks ***
${date}=  Get Text   type:Edit name:'Date of birth'

Get Value

Get value of the element defined by the locator.

Arguments

Argument Type Default value Description
locatorWindowsElement, strnullstring locator or Control element

Exception ActionNotPossible is raised if element does not allow GetValuePattern action.

param locator:string locator or Control element
return:value of ValuePattern attribute of an element

Examples

*** Tasks ***
${value}=   Get Value   type:DataItem name:column1

List Attributes

List all element attributes.

Arguments

Argument Type Default value Description
locatorWindowsElement, strnullstring locator or Control element
param locator:string locator or Control element
return:list of element attributes (strings)

List Windows

List all window element on the system.

return:list of dictionaries containing information about Window elements

Examples

*** Tasks ***
${windows}=  List Windows
FOR  ${window}  IN  @{windows}
    Log  Window title:${window}[title]
    Log  Window process name:${window}[name]
    Log  Window process id:${window}[pid]
    Log  Window process handle:${window}[handle]
END

Maximize Window

Minimize the current active window or the window defined by the locator.

Arguments

Argument Type Default value Description
locatorWindowsElement, str, NoneNonestring locator or Control element

Minimize the current active window or the window defined by the locator.

param locator:string locator or Control element
return:WindowsElement object

Examples

*** Tasks ***
Maximize Window   # Current active window
${window}=  Maximize Window   executable:Spotify.exe

Middle Click

Right mouse click on element matching given locator.

Arguments

Argument Type Default value Description
locatorWindowsElement, strnullstring locator or Control element
wait_timefloat, NoneNonetime to wait after click, default is a library wait_time, see keyword Set Wait Time
timeoutfloat, NoneNonefloat value in seconds, see keyword Set Global Timeout

Exception ActionNotPossible is raised if element does not allow Click action.

param locator:string locator or Control element
param wait_time:
 time to wait after click, default is a library wait_time, see keyword Set Wait Time
param timeout:float value in seconds, see keyword Set Global Timeout
return:WindowsElement object

Examples

*** Tasks ***
${element}=  Middle Click  name:button2

Minimize Window

Minimize the current active window or the window defined by the locator.

Arguments

Argument Type Default value Description
locatorWindowsElement, str, NoneNonestring locator or Control element

Minimize the current active window or the window defined by the locator.

param locator:string locator or Control element
return:WindowsElement object

Examples

*** Tasks ***
${window}=  Minimize Window   # Current active window
Minimize Window   executable:Spotify.exe

Restore Window

Window restore the current active window or the window defined by the locator.

Arguments

Argument Type Default value Description
locatorWindowsElement, str, NoneNonestring locator or Control element

Window restore the current active window or the window defined by the locator.

param locator:string locator or Control element
return:WindowsElement object

Examples

*** Tasks ***
${window}=  Restore Window   # Current active window
Restore Window   executable:Spotify.exe

Right Click

Right mouse click on element matching given locator.

Arguments

Argument Type Default value Description
locatorWindowsElement, strnullstring locator or Control element
wait_timefloat, NoneNonetime to wait after click, default is a library wait_time, see keyword Set Wait Time
timeoutfloat, NoneNonefloat value in seconds, see keyword Set Global Timeout

Exception ActionNotPossible is raised if element does not allow Click action.

param locator:string locator or Control element
param wait_time:
 time to wait after click, default is a library wait_time, see keyword Set Wait Time
param timeout:float value in seconds, see keyword Set Global Timeout
return:WindowsElement object

Examples

*** Tasks ***
${element}=  Right Click  name:MenuButton

Screenshot

Take a screenshot of the element defined by the locator.

Arguments

Argument Type Default value Description
locatorWindowsElement, strnullstring locator or Control element
filenamestrnullimage filename

Exception ActionNotPossible is raised if element does not allow CaptureToImage action.

param locator:string locator or Control element
param filename:image filename
return:absolute path to the screenshot file

Examples

*** Tasks ***
Screenshot  desktop   desktop.png
Screenshot  subname:Notepad   notepad.png

Select

Select value on Control element if action is supported.

Arguments

Argument Type Default value Description
locatorWindowsElement, strnullstring locator or Control element
valuestrnullstring value to select on Control element

Exception ActionNotPossible is raised if element does not allow Select action.

param locator:string locator or Control element
param value:string value to select on Control element
return:WindowsElement object

Examples

*** Tasks ***
Select  type:SelectControl   option2

Send Keys

Send keys to desktop, current window or to Control element defined by given locator.

Arguments

Argument Type Default value Description
locatorWindowsElement, str, NoneNonestring locator or Control element (default None means desktop)
keysstr, NoneNonethe keys to send
intervalfloat0.01time between sending keys, default 0.01 seconds
wait_timefloat, NoneNonetime to wait after sending keys, default is a library wait_time, see keyword Set Wait Time
send_enterboolFalseif True then {Enter} is sent at the end of the keys

Send keys to desktop, current window or to Control element defined by given locator.

If locator is None then keys are sent to desktop.

Exception ActionNotPossible is raised if element does not allow SendKeys action.

param locator:string locator or Control element (default None means desktop)
param keys:the keys to send
param interval:time between sending keys, default 0.01 seconds
param wait_time:
 time to wait after sending keys, default is a library wait_time, see keyword Set Wait Time
param send_enter:
 if True then {Enter} is sent at the end of the keys
return:WindowsElement object

Examples

*** Tasks ***
Send Keys  desktop   {Ctrl}{F4}
Send Keys  keys={Ctrl}{F4}   # locator will be NONE, keys send to desktop
${element}=   Send Keys  id:input5  username   send_enter=True
${element}=   Get Element   id:pass
Send Keys  ${element}  password   send_enter=True

Set Anchor

Set anchor to an element specified by the locator.

Arguments

Argument Type Default value Description
locatorWindowsElement, strnullstring locator or Control element
timeoutfloat10timeout in seconds for element lookup (default 5.0)

All following keywords using locators will use this element as an root element. Specific use case could be setting anchor to TableControl element and then getting column data belonging to that TableControl element.

To release anchor call Clear Anchor keyword.

param locator:string locator or Control element
param timeout:timeout in seconds for element lookup (default 5.0)

Examples

*** Tasks ***
Set Anchor  type:Table name:Orders depth:16
FOR  ${row}  IN RANGE  200
    ${number}=  Get Value   name:number row ${row}
    Exit For Loop If   $number == ${EMPTY}
    ${sum}=  Get Value   name:sum row ${row}
    Log   Order number:${number} has sum:{sum}
END
Clear Anchor

Set Global Timeout

Set global timeout for element search. Applies also to ``Control Window`` keyword.

Arguments

Argument Type Default value Description
timeoutfloatnullfloat value in seconds

Set global timeout for element search. Applies also to Control Window keyword.

By default library has timeout of 10 seconds.

param timeout:float value in seconds
return:previous timeout value

Examples

*** Tasks ***
${old_timeout}=  Set Global Timeout  20
${old_timeout}=  Set Global Timeout  9.5

Set Value

Set value of the element defined by the locator.

Arguments

Argument Type Default value Description
locatorWindowsElement, str, NoneNonestring locator or Control element
valuestr, NoneNonestring value to set
appendboolFalseFalse for setting value, True for appending value
enterboolFalseset True to press enter key at the end of the line
newlineboolFalseset True to add newline to the end of value

Note. Anchor works only on element structures where it can be relied on that root/child element tree will remain the same. Usually these kind of structures are tables.

Exception ActionNotPossible is raised if element does not allow SetValue action.

param locator:string locator or Control element
param value:string value to set
param append:False for setting value, True for appending value
param enter:set True to press enter key at the end of the line
param newline:set True to add newline to the end of value
return:WindowsElement object

Note. It is important to set append=True if you want keep text in the element. Other option is to read current text into a variable and modify that value to pass for Set Value keyword.

Examples

*** Tasks ***
Set Value   type:DataItem name:column1   ab c  # Set value to "ab c"
# Press ENTER after setting the value
Set Value    type:Edit name:'File name:'    console.txt    enter=True

# Add newline (manually) at the end of the string (Notepad example)
Set Value    name:'Text Editor'  abc\n
# Add newline with parameter
Set Value    name:'Text Editor'  abc   newline=True

# Clear Notepad window and start appending text
Set Anchor  name:'Text Editor'
# all following keyword calls will use anchor element as locator
# UNLESS they specify locator specifically or Clear Anchor is used
${time}=    Get Time
# Clears when append=False (default)
Set Value    value=time now is ${time}
# Append text and add newline to the end
Set Value    value= and it's task run time    append=True    newline=True
# Continue appending
Set Value    value=this will appear on the 2nd line    append=True

Set Wait Time

Set library wait time for action keywords.

Arguments

Argument Type Default value Description
wait_timefloatnullfloat value (in seconds), e.g. 0.1

The wait_time is spent after each keyword performing mouse or keyboard action.

Library default wait_time is 0.5

Returns value of the previous wait_time value.

param wait_time:
 float value (in seconds), e.g. 0.1
return:previous wait value

Examples

*** Tasks ***
${old_wait_time}=  Set Wait Time  0.2

Windows Run

Use Windows run window to launch application.

Arguments

Argument Type Default value Description
textstrnulltext to enter into run input field
wait_timefloat3.0sleep time after search has been entered (default 3.0 seconds)

Activated by pressing win + r.

param text:text to enter into run input field
param wait_time:
 sleep time after search has been entered (default 3.0 seconds)

Examples

*** Tasks ***
Windows Run   explorer.exe