Boot Time In Seconds From Epoch

Get machine boot time

return:boot time in seconds from Epoch

Examples

*** Tasks ***
${epoch}  Boot Time In Seconds From Epoch

Calculate Rectangle Center

Calculate x and y center coordinates from rectangle.

Arguments

Argument Type Default value Description
rectangle typing.Anyelement rectangle coordinates
param rectangle:
 element rectangle coordinates
return:x and y coordinates of rectangle center

Examples

*** Tasks ***
Open Using Run Dialog   calc  Calculator
&{rect}=        Get Element Rectangle    CalculatorResults
${x}  ${y}=     Calculate Rectangle Center   ${rect}

Click Type

Mouse click on coordinates x and y.

Arguments

Argument Type Default value Description
x int Nonehorizontal coordinate for click, defaults to None
y int Nonevertical coordinate for click, defaults to None
click_type str click"click", "right" or "double", defaults to "click"

Default click type is click meaning left

param x:horizontal coordinate for click, defaults to None
param y:vertical coordinate for click, defaults to None
param click_type:
 "click", "right" or "double", defaults to "click"
raises ValueError:
 if coordinates are not valid

Examples

*** Tasks ***
Click Type  x=450  y=100
Click Type  x=450  y=100  click_type=right
Click Type  x=450  y=100  click_type=double

Close All Applications

Close all applications

Examples

*** Tasks ***
Open Application   Excel
Open Application   Word
Open Executable    notepad.exe   Untitled - Notepad
Close All Applications

Connect By Handle

Connect to application by its handle

Arguments

Argument Type Default value Description
handle strhandle of the application
windowtitle str None
existing_app bool False
param handle:handle of the application

Examples

*** Tasks ***
${appid}  Connect By Handle  88112

Connect By Pid

Connect to application by its pid

Arguments

Argument Type Default value Description
app_pid strprocess id of the application
windowtitle str None
param app_pid:process id of the application

Examples

*** Tasks ***
${appid}  Connect By PID  3231

Drag And Drop

Drag elements from source and drop them on target.

Arguments

Argument Type Default value Description
src typing.Anyapplication object or instance id
target typing.Anyapplication object or instance id
src_locator strelements to move
target_locator str None
handle_ctrl_key bool FalseTrue if keyword should press CTRL down dragging
drop_delay float 2.0how many seconds to wait until releasing mouse drop, default 2.0

Please note that if CTRL is not pressed down during drag and drop then operation is MOVE operation, on CTRL down the operation is COPY operation.

There will be also overwrite notification if dropping over existing files.

param src:application object or instance id
param target:application object or instance id
param src_locator:
 elements to move
param handle_ctrl_key:
 True if keyword should press CTRL down dragging
param drop_delay:
 how many seconds to wait until releasing mouse drop, default 2.0
raises ValueError:
 on validation errors

Examples

*** Tasks ***
${app1}=        Open Using Run Dialog    explorer.exe{VK_SPACE}C:\workfiles\movethese   movethese
${app2}=        Open Using Run Dialog    wordpad.exe   Document - WordPad
Drag And Drop   ${app1}   ${app2}   regexp:testfile_\d.txt  name:Rich Text Window   handle_ctrl_key=${True}
Drag And Drop   ${app1}   ${app1}   regexp:testfile_\d.txt  name:subdir  handle_ctrl_key=${True}

Find Element

Find element from window by locator and criteria.

Arguments

Argument Type Default value Description
locator strname of the locator
search_criteria str Nonecriteria by which element is matched
param locator:name of the locator
param search_criteria:
 criteria by which element is matched
return:list of matching elements and locators that were found on the window

Examples

*** Tasks ***
@{elements}   Find Element   CalculatorResults
Log Many  ${elements[0]}     # list of matching elements
Log Many  ${elements[1]}     # list of all available locators

Get App

Get application object by id

Arguments

Argument Type Default value Description
app_id int Noneid of the application to get, defaults to None

By default returns active_application application object.

param app_id:id of the application to get, defaults to None
return:application object

Examples

*** Tasks ***
${app1}        Open Application   Excel
&{appdetails}  Get App   ${app1}

Get Boot Time

Get computer boot time in seconds from Epoch or in datetime string.

Arguments

Argument Type Default value Description
as_datetime bool Falseif True returns datetime string, otherwise seconds, defaults to False
datetime_format str %Sdatetime string format, defaults to "%Y-%m-%d %H:%M:%S"
param as_datetime:
 if True returns datetime string, otherwise seconds, defaults to False
param datetime_format:
 datetime string format, defaults to "%Y-%m-%d %H:%M:%S"
return:seconds from Epoch or datetime string

Examples

*** Tasks ***
${boottime}  Get Boot Time
${boottime}  Get Boot Time   as_datetime=True
${boottime}  Get Boot Time   as_datetime=True  datetime_format=%d.%m.%Y

Get Dialog Rectangle

Get dialog rectangle coordinates

Arguments

Argument Type Default value Description
ctrl typing.Any None
as_dict bool False

If ctrl is None then get coordinates from dialog :param ctrl: name of the window control object, defaults to None :return: coordinates: left, top, right, bottom

Examples

*** Tasks ***
${left}  ${top}  ${right}  ${bottom}=  Get Dialog Rectangle
&{coords}  Get Dialog Rectangle  as_dict=True
Log  top=${coords.top} left=${coords.left}

Get Element

Get element by locator.

Arguments

Argument Type Default value Description
locator strname of the locator
screenshot bool Falsetakes element screenshot if True, defaults to False
open_dialog bool TrueTrue if dialog should be reopened, default to True
param locator:name of the locator
param screenshot:
 takes element screenshot if True, defaults to False
param open_dialog:
 True if dialog should be reopened, default to True
return:element if element was identified, else False

Examples

*** Tasks ***
${element}  Get Element  CalculatorResults
${element}  Get Element  Result      screenshot=True

Get Element Center

Get element center coordinates

Arguments

Argument Type Default value Description
element dictdictionary of element items
param element:dictionary of element items
return:coordinates, x and y

Examples

*** Tasks ***
@{element}   Find Element  CalculatorResults
${x}  ${y}=  Get Element Center  ${elements[0][0]}

Get Element Rectangle

Get value of element rectangle attribute.

Arguments

Argument Type Default value Description
locator strelement locator
as_dict bool Falsereturn values in a dictionary, default False
param locator:element locator
param as_dict:return values in a dictionary, default False
return:(left, top, right, bottom) values if found, else False

Examples

*** Tasks ***
${left}  ${top}  ${right}  ${bottom}=  Get Element Rectangle  CalculatorResults
&{coords}  Get Element Rectangle  CalculatorResults  as_dict=True
Log  top=${coords.top} left=${coords.left}

Get Element Rich Text

Get value of element rich text attribute.

Arguments

Argument Type Default value Description
locator strelement locator
param locator:element locator
return:rich_text value if found, else False

Examples

*** Tasks ***
${text}  Get Element Rich Text  CalculatorResults

Get Machine Name

Get machine name

return:machine name as string

Examples

*** Tasks ***
${machine}  Get Machine Name

Get Memory Stats

Get computer memory stats and return those in bytes or in humanized memory format.

Arguments

Argument Type Default value Description
humanized bool Trueif False returns memory information in bytes, defaults to True

Get computer memory stats and return those in bytes or in humanized memory format.

param humanized:
 if False returns memory information in bytes, defaults to True
return:memory information in dictionary format

Examples

*** Tasks ***
&{mem}     Get Memory Stats
&{mem}     Get Memory Stats   humanized=False

Get Open Applications

Get list of all open applications

Returns a dictionary

Examples

*** Tasks ***
${app1}    Open Application   Excel
${app2}    Open Executable    calc.exe  Calculator
${app3}    Open File          /path/to/myfile.txt
&{apps}    Get Open Applications

Get Spaced String

Replace spaces in a text with pywinauto.keyboard space characters {VK_SPACE}

Arguments

Argument Type Default value Description
textreplace spaces in this string

Replace spaces in a text with pywinauto.keyboard space characters {VK_SPACE}

param text:replace spaces in this string

Examples

*** Tasks ***
${txt}    Get Spaced String   My name is Bond
# ${txt} = My{VK_SPACE}name{VK_SPACE}is{VK_SPACE}Bond

Get Text

Get text from element

Arguments

Argument Type Default value Description
locator strelement locator
param locator:element locator

Examples

*** Tasks ***
Open Using Run Dialog  calc     Calculator
Type Into    CalculatorResults   11
Type Into    CalculatorResults   55
&{val}       Get Text   CalculatorResults

Get Username

Get username of logged in user

return:username as string

Examples

*** Tasks ***
${user}  Get Username

Get Window Elements

Get element information about all window dialog controls and their descendants.

Arguments

Argument Type Default value Description
screenshot bool Falsesave element screenshot if True, defaults to False
element_json bool Falsesave element json if True, defaults to False
outline bool Falsehighlight elements if True, defaults to False

Get element information about all window dialog controls and their descendants.

param screenshot:
 save element screenshot if True, defaults to False
param element_json:
 save element json if True, defaults to False
param outline:highlight elements if True, defaults to False
return:all controls and all elements

Examples

*** Tasks ***
@{elements}   Get Window Elements
Log Many      ${elements[0]}     # list of all available locators
Log Many      ${elements[1]}     # list of matching elements
@{elements}   Get Window Elements  screenshot=True  element_json=True  outline=True

Get Window List

Get list of open windows

Window dictionaries contain:

  • automation_id
  • control_id
  • title
  • pid
  • handle
  • is_active
  • keyboard_focus
  • rectangle
return:list of window dictionaries

Examples

*** Tasks ***
@{windows}    Get Window List
FOR  ${window}  IN  @{windows}
    Log Many  ${window}
END

Is Element Enabled

Is element enabled.

Arguments

Argument Type Default value Description
locator strelement locator
param locator:element locator
return:True if enabled, else False

Examples

*** Tasks ***
${res}=   Is Element Enabled  CalculatorResults

Is Element Matching

Is element matching. Check if locator is found in any field or criteria field in the window items.

Arguments

Argument Type Default value Description
itemdict dict
locator strname of the locator
criteria strcriteria on which to match element
wildcard bool Falsewhether to do reg exp match or not, default False

Is element matching. Check if locator is found in any field or criteria field in the window items.

param itemDict:dictionary of element items
param locator:name of the locator
param criteria:criteria on which to match element
param wildcard:whether to do reg exp match or not, default False
return:True if element is matching locator and criteria, False if not

Is Element Visible

Is element visible.

Arguments

Argument Type Default value Description
locator strelement locator
param locator:element locator
return:True if visible, else False

Examples

*** Tasks ***
${res}=   Is Element Visible  CalculatorResults

Kill Process

Kill process by name

Arguments

Argument Type Default value Description
process_name strname of the process
param process_name:
 name of the process
return:True if succeeds False if not

Examples

*** Tasks ***
${process}  Process Exists  calc  strict=False
${status}   Kill Process    ${process.name()}

Kill Process By Pid

Kill process by pid

Arguments

Argument Type Default value Description
pid intprocess identifier
param pid:process identifier

Examples

*** Tasks ***
${process}  Process Exists  calc  strict=False
${status}   Kill Process    ${process.pid}

Lock Screen

Put windows into lock mode

Examples

*** Tasks ***
Lock Screen

Log In

Log into Windows domain with username and password.

Arguments

Argument Type Default value Description
username strname of the user
password strpassword of the user
domain str .windows domain for the user, defaults to "."
param username:name of the user
param password:password of the user
param domain:windows domain for the user, defaults to "."
return:handle

Examples

*** Tasks ***
Log In  username=myname  password=mypassword  domain=company

Minimize Dialog

Minimize window by its title

Arguments

Argument Type Default value Description
windowtitle str Nonename of the window, default None means that active window is going to be minimized
param windowtitle:
 name of the window, default None means that active window is going to be minimized

Examples

*** Tasks ***
Open Using Run Dialog  calc     Calculator
Open Using Run Dialog  notepad  Untitled - Notepad
Minimize Dialog    # Current window (Notepad)
Minimize Dialog    Calculator

Mouse Click

Mouse click locator, coordinates, or image

Arguments

Argument Type Default value Description
locator str Noneelement locator on active window
x int 0coordinate x on desktop
y int 0coordinate y on desktop
off_x int 0offset x (used for locator and image clicks)
off_y int 0offset y (used for locator and image clicks)
image str Noneimage to click on desktop
method str locatorone of the available methods to mouse click, default "locator"
ctype str clicktype of mouse click
**kwargs

When using method locator,image or ocr mouse is clicked by default at center coordinates.

Click types are:

  • click normal left button mouse click
  • double
  • right
param locator:element locator on active window
param x:coordinate x on desktop
param y:coordinate y on desktop
param off_x:offset x (used for locator and image clicks)
param off_y:offset y (used for locator and image clicks)
param image:image to click on desktop
param method:one of the available methods to mouse click, default "locator"
param ctype:type of mouse click
param kwargs:these keyword arguments can be used to pass arguments to underlying Images library to finetune image template matching, for example. tolerance=0.5 would adjust image tolerance for the image matching

Examples

*** Tasks ***
Mouse Click  method=coordinates  100   100
Mouse Click  CalculatorResults
Mouse Click  method=image  image=myimage.png  off_x=10  off_y=10  ctype=right
Mouse Click  method=image  image=myimage.png  tolerance=0.8
${elements}  ${other}=     Find Element  class:Button
FOR  ${element}  IN  @{elements}
    Run Keyword If   ${element}[visible]   Mouse Click  ${element}
END

Mouse Click Coords

Click at coordinates on desktop

Arguments

Argument Type Default value Description
x inthorizontal coordinate on the windows to click
y intvertical coordinate on the windows to click
ctype str clickclick type "click", "right" or "double", defaults to "click"
delay_time float None
param x:horizontal coordinate on the windows to click
param y:vertical coordinate on the windows to click
param ctype:click type "click", "right" or "double", defaults to "click"
param delay:delay in seconds after, default is no delay

Examples

*** Tasks ***
Mouse Click Coords  x=450  y=100
Mouse Click Coords  x=300  y=300  ctype=right
Mouse Click Coords  x=450  y=100  delay=5.0

Mouse Click Image

Click at template image on desktop

Arguments

Argument Type Default value Description
template str
off_x int 0horizontal offset from top left corner to click on
off_y int 0vertical offset from top left corner to click on
ctype str clicktype of mouse click
**kwargs
param image:image to click on desktop
param off_x:horizontal offset from top left corner to click on
param off_y:vertical offset from top left corner to click on
param ctype:type of mouse click
param kwargs:these keyword arguments can be used to pass arguments to underlying Images library to finetune image template matching, for example. tolerance=0.5 would adjust image tolerance for the image matching

Examples

*** Tasks ***
Mouse Click  image=myimage.png  off_x=10  off_y=10  ctype=right
Mouse Click  image=myimage.png  tolerance=0.8

Open Application

Open application by dispatch method

Arguments

Argument Type Default value Description
application strname of the application as str

This keyword is used to launch Microsoft applications like Excel, Word, Outlook and Powerpoint.

param application:
 name of the application as str
return:application instance id

Examples

*** Tasks ***
${app1}    Open Application   Excel
${app2}    Open Application   Word

Open Dialog

Open window by its title.

Arguments

Argument Type Default value Description
windowtitle str Nonename of the window, defaults to active window if None
highlight bool Falsedraw outline for window if True, defaults to False
timeout int 10time to wait for dialog to appear
existing_app bool False
param windowtitle:
 name of the window, defaults to active window if None
param highlight:
 draw outline for window if True, defaults to False
param timeout:time to wait for dialog to appear

Examples

*** Tasks ***
Open Dialog       Untitled - Notepad
Open Dialog       Untitled - Notepad   highlight=True   timeout=5

Open Executable

Open Windows executable. Window title name is required to get handle on the application.

Arguments

Argument Type Default value Description
executable strname of the executable
windowtitle strname of the window
backend str Noneset Windows backend, default None means using library default value
work_dir str Nonepath to working directory, default None

Open Windows executable. Window title name is required to get handle on the application.

param executable:
 name of the executable
param windowtitle:
 name of the window
param backend:set Windows backend, default None means using library default value
param work_dir:path to working directory, default None
return:application instance id

Examples

*** Tasks ***
${app1}    Open Executable   calc.exe  Calculator

Open File

Open associated application when opening file

Arguments

Argument Type Default value Description
filename strpath to file
param filename:path to file
return:True if application is opened, False if not

Examples

*** Tasks ***
${app1}    Open File   /path/to/myfile.txt

Open Using Run Dialog

Open application using Windows run dialog. Window title name is required to get handle on the application.

Arguments

Argument Type Default value Description
executable strname of the executable
windowtitle strname of the window
timeout int 10time to wait for dialog to appear

Open application using Windows run dialog. Window title name is required to get handle on the application.

param executable:
 name of the executable
param windowtitle:
 name of the window
param timeout:time to wait for dialog to appear
return:application instance id

Examples

*** Tasks ***
${app1}    Open Using Run Dialog  notepad  Untitled - Notepad

Process Exists

Check if process exists by its name

Arguments

Argument Type Default value Description
process_name strsearch for this process
strict bool Truedefines how match is made, default True which means that process name needs to be exact match and False does inclusive matching
param process_name:
 search for this process
param strict:defines how match is made, default True which means that process name needs to be exact match and False does inclusive matching
return:process instance or False

Examples

*** Tasks ***
${process}  Process Exists  calc
${process}  Process Exists  calc  strict=False

Put System To Sleep

Put Windows into sleep mode

Examples

*** Tasks ***
Put System To Sleep

Quit Application

Quit an application by application id or active application if app_id is None.

Arguments

Argument Type Default value Description
app_id str Noneapplication_id, defaults to None
send_keys bool False

Quit an application by application id or active application if app_id is None.

param app_id:application_id, defaults to None

Examples

*** Tasks ***
${app1}   Open Application   Excel
${app2}   Open Application   Word
Quit Application  ${app1}

Restore Dialog

Restore window by its title

Arguments

Argument Type Default value Description
windowtitle str Nonename of the window, default None means that active window is going to be restored
param windowtitle:
 name of the window, default None means that active window is going to be restored

Examples

*** Tasks ***
Open Using Run Dialog  notepad  Untitled - Notepad
Minimize Dialog
Sleep             1s
Restore Dialog
Sleep             1s
Restore Dialog    Untitled - Notepad

Screenshot

Save screenshot into filename.

Arguments

Argument Type Default value Description
filename strname of the file
element dict Nonetake element screenshot, defaults to None
ctrl typing.Any Nonetake control screenshot, defaults to None
desktop bool Falsetake desktop screenshot if True, defaults to False
overwrite bool Falsefile is overwritten if True, defaults to False
param filename:name of the file
param element:take element screenshot, defaults to None
param ctrl:take control screenshot, defaults to None
param desktop:take desktop screenshot if True, defaults to False
param overwrite:
 file is overwritten if True, defaults to False

Examples

*** Tasks ***
@{element}   Find Element  CalculatorResults
Screenshot   element.png   ${elements[0][0]}
Screenshot   desktop.png   desktop=True
Screenshot   desktop.png   desktop=True  overwrite=True

Send Keys

Send keys into active windows.

Arguments

Argument Type Default value Description
keys strlist of keys to send
param keys:list of keys to send

Examples

*** Tasks ***
Open Executable  calc.exe  Calculator
Send Keys        2{+}3=

Send Keys To Input

Send keys to windows and add ENTER if with_enter is True

Arguments

Argument Type Default value Description
keys_to_type strkeys to type into Windows
with_enter bool Truesend ENTER if with_enter is True
send_delay float 0.5delay after send_keys
enter_delay float 1.5delay after ENTER

At the end of send_keys there is by default 0.5 second delay. At the end of ENTER there is by default 1.5 second delay.

param keys_to_type:
 keys to type into Windows
param with_enter:
 send ENTER if with_enter is True
param send_delay:
 delay after send_keys
param enter_delay:
 delay after ENTER

Examples

*** Tasks ***
${txt}    Get Spaced String   My name is Bond, James Bond
Send Keys To Input  ${txt}    with_enter=False
Send Keys To Input  {ENTER}THE   send_delay=5.0  with_enter=False
Send Keys To Input  {VK_SPACE}-{VK_SPACE}END   enter_delay=5.0

Set Windows Backend

Set Windows backend which is used to interact with Windows applications

Arguments

Argument Type Default value Description
backend strname of the backend to use

Set Windows backend which is used to interact with Windows applications

Allowed values defined by SUPPORTED_BACKENDS

param backend:name of the backend to use

Examples

*** Tasks ***
Set Windows Backend   uia
Open Executable   calc.exe  Calculator
Set Windows Backend   win32
Open Executable   calc.exe  Calculator

Switch To Application

Switch to application by id.

Arguments

Argument Type Default value Description
app_id intapplication's id
param app_id:application's id
raises ValueError:
 if application is not found by given id

Examples

*** Tasks ***
${app1}    Open Application   Excel
${app2}    Open Application   Word
Switch To Application   ${app1}

Type Into

Type keys into element matched by given locator.

Arguments

Argument Type Default value Description
locator strelement locator
keys strlist of keys to type
empty_field bool False
param locator:element locator
param keys:list of keys to type

Examples

*** Tasks ***
Open Executable  calc.exe  Calculator
Type Into        CalculatorResults  11
Type Into        CalculatorResults  22  empty_field=True

Type Keys

Type keys into active window element.

Arguments

Argument Type Default value Description
keys strlist of keys to type
param keys:list of keys to type

Examples

*** Tasks ***
Open Executable  notepad.exe  Untitled - Notepad
Type Keys   My text

Wait For Element

Wait for element to appear into the window.

Arguments

Argument Type Default value Description
locator strname of the locator
search_criteria str Nonecriteria by which element is matched
timeout float 30.0defines how long to wait for element to appear, defaults to 30.0 seconds
interval float 2.0how often to poll for element, defaults to 2.0 seconds (minimum is 0.5 seconds)

Can return 1 or more elements matching locator, or raises ElementNotFoundError if element is not found within timeout.

param locator:name of the locator
param search_criteria:
 criteria by which element is matched
param timeout:defines how long to wait for element to appear, defaults to 30.0 seconds
param interval:how often to poll for element, defaults to 2.0 seconds (minimum is 0.5 seconds)

Examples

*** Tasks ***
@{elements}  Wait For Element  CalculatorResults
@{elements}  Wait For Element  Results   timeout=10  interval=1.5