desktop » typeByLocator(locator,text)
Description
This command automates a series of keystrokes on a desktop element denoted by locator
. The keystroke sequence, denoted
by text
, may be a series of printable characters (such as AbCdEf
or 123
) or function keys (such as {CTRL}F
), or
the combination of the two.
Note that Nexial is not performing any validation as to whether the target element will accept the specified keystrokes.
The target element might be, for example, a button or a checkbox. As such, almost any keystroke sequence would render
meaningless (with the exception of the ENTER or SPACE key, perhaps). Also, one should take special care when using
keystroke sequences that might be OS-specific, such as {COMMAND}Q
(Mac only) or {CONTEXT}
(Windows only).
If the target element can be resolved via the specified locator
, the corresponding step will be considered as a FAIL
.
Function and Control Key Mapping
Nexial's key mapping supports all common PC-104 and Mac keyboard keys. Modifiers and function keys are enclosed within{...}
(see below). Regular keys can be expressed as is.Modifiers
(may be use in combination, such as{CONTROL}{ALT}F
)
{SHIFT}
{CONTROL}
,{CTRL}
{ALT}
{WINDOWS}
,{WIN}
(PC-104 keyboard only){COMMAND}
,{META}
(Mac keyboard only)
Function keys
{F1}
through{F12}
{ESCAPE}
,{ESC}
{BACKSPACE}
,{BKSP}
{INSERT}
{DELETE}
,{DEL}
{TAB}
{SPACE}
{ENTER}
Directional keys
{HOME}
{END}
{PAGEUP}
{PAGEDOWN}
{UP}
{DOWN}
{LEFT}
{RIGHT}
Legacy desktop application support
The key mapping described above should suffice for most desktop application as well as modern browser. However,
there are some older applications where these key mapping might not yield the desired effect. Older, or
legacy, applications tend to use "ASCII-based" key mapping instead of the
newer
Unicode PUA (Private Use Area) code points (which, incidentally, is what Selenium is based on).
In order to properly simulate key presses on legacy applications, or applications that only support
ASCII-based key mapping, one would enable such feature via the System variable
nexial.desktop.useAsciiKey
by
setting it to true
. The default for this System variable is false
.
Parameters
- locator - this parameter is the locator of the element.
- text - this parameter is the text to be entered on the identified element.