Article Overview:
This article will cover how you can achieve the following:
How to use keyboard commands or special keys in the Virtuoso.
Problem Statement:
In web automation, there are scenarios where users need to simulate keyboard actions—either single key presses or combinations of keys—on web elements to automate tasks like filling forms, navigating fields, or triggering actions. However, users often struggle to efficiently simulate complex keyboard actions like pressing special keys (e.g., Ctrl+P or Shift+Enter) in Virtuoso, which can slow down the automation process.
This article provides a comprehensive solution for executing keyboard commands or special key combinations in Virtuoso using the "Press" command, ensuring users can simulate these actions accurately for their automation needs.
Solution:
To execute single or combined key presses, use the "Press" command in Virtuoso.
Key Points to Remember:
- Simultaneous Key Presses: Use underscores (_) to link keys that should be pressed simultaneously (e.g., Press CTRL_SHIFT_ALT).
- Text Sequences: To input sequences of text, separate each character with a space. For example, to type "SpotQA", the NLP step would be - Press “S p o t Q A"
- Spaces: To include a space, explicitly write "SPACE." For example, to type "Spot QA", the NLP step would be - Press "S p o t SPACE Q A"
How the Press Command Works :
Active Element: The active element is the currently focused element on the web page where actions (like key presses) will be executed.
In the absence of a specified target, the press command operates on this active element.
Examples of pressing buttons on an active element
press TAB
press CTRL_SHIFT_X
press X
press '1 2 3 4'
press "Hello SPACE world"
press 'TAB First Name TAB Last N a m e TAB ENTER'
Target Element:
The target element is the specific element you want to interact with.
To specify a target, include it in the command.
Examples of Pressing Keys on a Target Element:
press ENTER in "Search"
press SHIFT_A in "target"
press 'H E L L O SPACE W O R L D' in "Element"
press $variable
Using Expression :
The Press command currently doesn't support expressions directly. As a workaround, store value ${expression} in a variable and then use this variable in the press command.
Examples of using Expressions:
Store value "${"TAB DELETE TAB DELETE TAB DELETE TAB DELETE TAB DELETE TAB DELETE "} in $events
Press $events
Notes:
1. Special Keys: Special keys (e.g., ENTER, SHIFT, CTRL, SPACE, UNDERSCORE, COMMAND) must be in ALL CAPS.
2. Default Target: If no specific target is mentioned, press commands will act on the active element.
Comments
0 comments
Please sign in to leave a comment.