Library scope: | GLOBAL |
---|
QVision Robot Framework library.
Collect all available keywords from the keyword libraries.
Initialize self. See help(type(self)) for accurate signature.
Activate and focus a window
Activate the given window and show it on foreground. Works on Windows OS only.
ActivateWindow Word
Appstate is a pre-condition of a test case.
Appstate is a PaceWords convention of setting the application under test to a correct, known state. Appstate simply executes the provided Robot Framework keyword. The keyword could be called directly as well. Appstate makes it explicit that the test scripts follow the convention of explicitly declaring the starting state of each test case.
# Assuming user has implemented a Login keyword Appstate Login # With arguments Appstate Login username password
Clear field
Clears the currently active UI field.
ClearField
Click cell based on row and column
Clicks the crossing defined by row and column texts
ClickCell Row 1 Finished
Click checkbox on the screen
Finds the checkbox on the screen and clicks it.
This keyword is experimental. This means that it may not yet work properly in many cases and its signature may change in future versions.
*** Keywords *** Examples ClickCheckbox Register ClickCheckbox Register checked ClickCheckbox Register unchecked
Click icon
Click an icon on the screen.
ClickIcon ok ClickIcon ok tol=0.5
Click text until another text appears
Repeatedly click text_to_click until text is visible on the screen.
ClickIconUntil Welcome John login_icon
Click icon while a given text or the icon is visible
Repeatedly click icon_to_click while text is visible on the screen or the icon_to_click disappears.
ClickIconWhile login_icon ClickIconWhile item scroll_icon
Click text on the screen
Finds the text on the screen and clicks it.
ClickText New File ClickText Cancel OK ClickText Name right=1
Click text until another text appears
Repeatedly click text_to_click until text is visible on the screen.
ClickUntil Welcome John Login
Click target text while a given text is visible
Repeatedly click text_to_click while text is visible on the screen.
ClickWhile Login ClickWhile Username Login
Close the current focused window using win32 libraries.
Optionally, a window header can be given to focus and close that window. Works on Windows OS only.
CloseWindow CloseWindow Word
Perform a copy
Copies whatever is active at the UI to the clipboard. If text is provided copies that to the clipboard.
# Regular copy Copy # Copy the provided text Copy text to clipboard
Double click text
Finds text on the screen and double clicks it.
DoubleClick WordPad
Double click cell based on row and column
Double clicks the crossing defined by row and column texts
DoubleClickCell Row 1 Finished
Double click icon
Double click an icon on the screen.
DoubleClickIcon ok DoubleClickIcon ok tol=0.5
Drag object under the current position to destination
Use HoverText to move over the object to be dragged.
HoverText Start DragTo Destination
Make applicable inputs animated
EnableAnimations
Get a configuration value.
If no configuration is specified the method returns a copy of all the configuration values in a python dictionary.
config : str
# Get the value for the "default_timeout" configuration. GetConfig default_timeout # Get a copy of all configs GetConfig
Get the current position of the input device
This is mostly used for testing and debugging purposes
${pos}= GetCurrentPosition
Copies text from the nearest input field and returns it
This method is experimental and may not yet work reliably.
GetInputValue First Name
Get text from UI
The text must be copyable (e.g. using ctrl + c). For reading text e.g. from images, use read_text instead.
read_text : Read text using OCR
# Get currently highlighted text GetText # Get the sentence where this word appears GetText word GetText Some text above the desired text below=2 # Assuming there is a text "CODE: 12345X" GetText CODE: between=CODE: ???X # '12345' # Same with regular expressions GetText CODE: regexp=CODE: (.*)X
Returns the number of occurrences of a text.
int
${n}= GetTextCount N380
Press a hot key combination
Press the given keys down. HotKey can be passed several key strings which will be pressed down in order, and then released in reverse order.
Below is a list of supported keys that can be pressed in addition to keys that consist of a single character (like 'c' or '?').
Additional keys may be supported based on the underlying keyboard handling library. The default library in Python is pynput, see https://pythonhosted.org/pynput/keyboard.html for a list of keys.
HotKey tab HotKey win HotKey ctrl c HotKey ctrl alt del HotKey altleft w
Hover cell based on row and column
Hovers the crossing defined by row and column texts
HoverCell Row 1 Finished
Hover color
Hovers over colored element on the screen. This is an experimental feature that may change or be removed in the future.
This method does not currently perform well on images, but on UI with rather solid background.
HoverColor red HoverColor blue right=1
Hover icon
Move mouse over an icon on the screen.
HoverIcon ok HoverIcon ok tol=0.5
Hover text
Finds text on the screen and hovers over it.
HoverText New File HoverText Name right=1
Is icon on the screen currently
Checks if icon is currently on the screen.
bool
IsIcon ok IsIcon ok tol=0.95
Check if text exists on the screen
Returns True if text is found on the screen, False if not.
${dialog}= IsText Do you want to save changes? ${active}= IsText File MyApplication title
Returns true if a window with the header exist currently
bool
${window}= IsWindow Word
Add screenshot to the robot log
Useful for debugging purposes.
LogScreenshot annotated
Maximize focused window
Maximizes the current focused window. Optionally, a window header can be given to focus and maximize that windows. Works on Windows OS only.
MaximizeWindow MaximizeWindow Word
Minimize focused window
Minimizes the current focused window. Optionally, a window header can be given to focus and Minimize that window. Works on Windows OS only.
MinimizeWindow MinimizeWindow Word
Normalize the focused window
Optionally, a window header can be given to focus and normalize that window. Works on Windows OS only.
NormalizeWindow NormalizeWindow Word
Open application
Helper for opening popular applications using the GUI of the operating system. In Windows it uses the "Run" -dialog.
Remember to verify the state after opening an application.
Application to open. Current options are Browsers - 'chrome' - 'edge' - 'firefox
Office - 'excel' - 'powerpoint' - 'word'
Other - 'remote desktop connection' or 'rdp' - 'wordpad'
Default supported GUI languages are English, Finnish or German. For other languages, please provide the run_translation argument.
Currently supports only Windows.
run_command : Run an arbitrary command
OpenApplication wordpad
Page down
Perform a page down/keypress event.
PageDown 1
Page up
Perform page up event/keypress.
PageUp 1
Performs a paste from the clipboard
If text is provided pastes that instead. Useful for adding large amounts of text to the UI.
If text is provided, may overwrite any previous content in the clipboard
# Regular paste Paste Paste ${long_string_variable}
Press a key until text is visible
Repeatedly press a key until the text is visible on the screen.
PressUntil Item pagedown
Press a key while text is visible
Repeatedly press a key while the text is visible on the screen.
PressUntil Item pagedown
Connect to a Remote Desktop Server.
Connects to a Remote Desktop Server.
This feature is experimental and may change in future versions. It is currently designed for Pace cloud. It is based on the Remmina linux RDP client.
None
Disconnect from a Remote Desktop Connection.
This feature is experimental and may change in future versions. It is based on the Remmina linux RDP client.
None
Read clipboard
Return the contents of the clipboard
${clipboard_contents}= ReadClipboard
Reads text from a table cell
Finds a table cell based on the table row (left column) and column headers. Then reads text from it.
table_caption can be used as additional anchor. It's usually another text close to / above table. It's optional, but can be useful if there are multiple tables with same columns.
ReadTableCell Product A Price ReadTableCell John Doe Salary Payroll Data
Reads text depending on the given text and currently set direction.
Uses anchor to select text location if multiple occurences found. Minoffset and maxoffset can be used to control how far values are read from.
ReadText First name ReadText First name Order
Reset configurations to their default value.
# Reset all configs to their default values ResetConfigs # Reset "default_timeout" configuration to its default value ResetConfigs default_timeout
Right click text
Finds text and clicks it with the right mouse button.
RightClick New Event
Right click cell based on row and column
Right clicks the crossing defined by row and column texts
RightClickCell Row 1 Finished
Right click an icon
Right click an icon on the screen.
RightClickIcon ok RightClickIcon ok tol=0.5
Run a command
Runs the given command in the Windows Run -dialog.
Supports Windows GUI in either English, Finnish or German.
RunCommand wordpad RunCommand wordpad filename.rtf
Click text until another text is visible
Click text until text_to_appear is visible.
click_until
This is a QWeb compatibility method with the signature adapted to QVision. Consider using ClickUntil instead.
ScanClick Cart Cart contents ScanClick Cart Cart contents 1 5s ScanClick Cart Cart contents Main Cart 20s 3s
Scroll to text
Scrolls until the text is visible on the screen
ScrollTo Item
Scroll to text
Scrolls until the text is visible on the screen
ScrollTo Item
Scroll while text is visible
Scrolls until the text is not visible on the screen.
ScrollWhile Item
Select text from the UI
Selects (highlights) text from the UI based on locator_text.
Based on the reach parameter the selection is performed by:
SelectText First SelectText Target Path below=1 SelectText Price anchor=Total right=3
Set a configuration value.
Configurations allow you to change how QVision works. For instance you can adjust the time how long QVision retries PaceWords before allowing them to fail.
Below is a list of all the available configurations, their explanations and default values.
General configs:
Screen related configs:
Input related configs:
Computer vision and OCR related configs:
# General configurations SetConfig default_timeout 15.0 SetConfig default_pause 0.1 # Screen related configurations SetConfig monitor 0 SetConfig region ${None} SetConfig use_active_window True # Input related configurations SetConfig characters_per_second 100 SetConfig click_interval 0.6 SetConfig input_interval 0.05 SetConfig scroll_amount 200 # Computer vision and OCR related configs SetConfig ignore_case sentence SetConfig ignored_chars _ SetConfig ocr_scale 1.0 SetConfig search_direction right SetConfig tolerance_icon 0.9 SetConfig tolerance_text 0.8
Sets the global direction used for finding elements.
For instance TypeText uses this direction to find text fields.
SetDirection right SetDirection down
Set the display scale manually
In Windows 10 this value is found by clicking the desktop with the right mouse button and selecting the option "Display settings".
This parameter is currently not used.
SetDisplayScale 125%
Set input device
Earlier device name screen is deprecated and will be removed in a future version.
SetInputDevice host
Set input device
engine_name : str
SetOcrEngine default SetOcrEngine RevisionEngine SetOcrEngine Legacy1_2Engine
Set the OCR language
Setting a language will allow the OCR engine to use dictionary for more accurate recognition results.
SetOcrLanguage eng SetOcrLanguage fin
Sets reference folder for image files.
SetReferenceFolder ${CURDIR}/reference_images
Sets the source for capturing screenshots
Set the source device for capturing screenshots from, e.g. the screen of the host computer.
SetScreenDevice pyautogui SetScreenDevice screen monitor=1
Click text while another text is visible
Click text while text_to_disappear is visible on the screen.
click_while
This is a QWeb compatibility method with the signature adapted to QVision. Consider using ClickWhile instead.
ScanClick Cart Cart contents
Make a swipe down starting from text.
If text is None, swipe from middle of screen.
SwipeDown Advertisement
Make a left swipe starting from text.
If text is None, swipe from middle of screen.
SwipeLeft Advertisement
Make a right swipe starting from text.
If text is None, swipe from middle of screen.
SwipeRight Advertisement
Make a swipe up starting from text.
If text is None, swipe from middle of screen.
SwipeUp Advertisement
Add text to a table cell
Finds a table cell based on the table row and column headers. Then inserts text into it.
TableCell 11 A 13.00 TableCell John Salary 3500
Triple click text
Finds text on the screen and triple clicks it.
TripleClick New event
Triple click cell based on row and column
Triple clicks the crossing defined by row and column texts
TripleClickCell Row 1 Finished
Type a secret to an input field
The secret will be censored from logs.
Generally all secret credentials in Robot FW scripts should be provided as external variables. Secrets should not be stored to the test script or version control.
type_text : Type text to an input field write_secret : Write a secret
# Provide PASSWD outside the Robot FW script as follows: # robot --variable PASSWD:mypass123 test.robot TypeSecret password ${PASSWD}
Type a partially shown secret to an input field
Only the first 3 characters will be shown of the secret.
type_text : Type text to an input field write_secret3 : Write a secret
Generally all secret credentials in Robot FW scripts should be provided as external variables. Secrets should not be stored to the test script or version control.
# Provide PASSWD outside the Robot FW script as follows: # robot --variable PASSWD:mypass123 test.robot TypeSecret password ${PASSWD}
Type text to a text field
Type text to a text field. You can use offsets or try automatic input field detection (experimental feature).
In case offsets are provided, they are used to activate the input field before typing. Otherwise this keywords attempts to automatically detect the input field.
Automatic input field detection is still an experimental feature.
TypeText Name John Doe TypeText Price 1,00 EUR # Specify the location of the input field TypeText Name John Doe right=5
Verifies any of the given texts
Verify that at least one of the texts is found. Useful for handling session dependent states, such as logins or popups.
VerifyAny Login Front Page # Follow up to check which state ${login}= IsText Login
Verify that checkbox is checked
Verifies that the checkbox is checked
This keyword is experimental. This means that it may not yet work properly in many cases and its signature may change in future versions.
*** Keywords *** Examples VerifyChecked Allow advertisement email
Verify that icon is visible on the screen
Verifies that icon is visible on the screen. Verification fails if icon is not found within a timeout.
KeywordFailException
VerifyIcon ok VerifyIcon ok tol=0.6
Verifies that text does not exists on the row.
Retries the keyword until text is not found on the row or the timeout is reached.
VerifyRow Finished VerifyRow Finished Row 1
Verifies that text is not found on the screen.
If text is visible, retries the keyword until the text disappears or the timeout is reached.
VerifyNoText Order number
Verify that checkbox is not checked
Verifies that the checkbox is not checked
This keyword is experimental. This means that it may not yet work properly in many cases and its signature may change in future versions.
*** Keywords *** Examples VerifyChecked Allow advertisement email
Verifies that text exists on the row.
Retries the keyword until text is found on the row or the timeout is reached.
VerifyRow Finished VerifyRow Finished Row 1
Verifies selected text on UI
Verifies that the currently selected text on UI matches the given text.
The selection must be copyable.
VerifySelected package.zip
Verifies text from a table cell
Finds a table cell based on the table row (left column) and column headers. Then compares text from it with the expected text.
table_caption can be used as additional anchor. It's usually another text close to / above table. It's optional, but can be useful if there are multiple tables with same columns.
VerifyTableCell John Salary 120000 Payroll Data
Verifies that text is found on the screen.
Retries the keyword until text is found on the screen or the timeout is reached.
VerifyText Order number VerifyText File Edit
Wait for an amount of time
Calling this function will also trigger a screen refresh.
Wait 3.0 Wait 1 min
Write a secret
Write a secret that will be censored from logs.
secret : str
Generally all secret credentials in Robot FW scripts should be provided as external variables. Secrets should not be stored to the test script or version control.
# Provide PASSWD outside the Robot FW script as follows: # robot --variable PASSWD:mypass123 test.robot WriteSecret ${PASSWD}
Write a partially shown secret
Only the first 3 characters will be shown of the secret.
Generally all secret credentials in Robot FW scripts should be provided as external variables. Secrets should not be stored to the test script or version control.
# Provide PASSWD outside the Robot FW script as follows: # robot --variable PASSWD:mypass123 test.robot WriteSecret ${PASSWD}
Write text
Write text to the active UI element.
WriteText Hello World!