Article Overview:
This article will cover how you can achieve the following:
How to use keyboard commands or special keys in Virtuoso.
Problem Statement:
How can a user effectively use keyboard commands or special key combinations, such as Ctrl+P, within Virtuoso to interact with elements on a webpage?
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 "} 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: Press commands will act on the active element if no specific target is mentioned.
Comments
0 comments
Please sign in to leave a comment.