Skip to content

keyboard

roei sabag edited this page Jul 12, 2020 · 1 revision

Description

Simulates keys able to be pressed that are not text keys to the browser.

Full list of supported keys can be found here

Scope

Web, Mobile Web or any other Web Driver implementation which implements Value.

Properties

Property Description
argument Plugin conditions and additional information.
onElement The locator value by which the element will be found.
locator The locator type by which the element will be found.

Command Line Arguments (CLI)

None

W3C Web Driver Protocol

https://www.w3.org/TR/webdriver/#element-send-keys

Examples

Example no. 1

Can be tested on

Perform keyboard Enter action (press enter) on the specified element.

Action Rule (JSON)

{
    "action": "Keyboard",
    "argument": "Enter",
    "onElement": "SearchString",
    "locator": "Id"
}

Rhino Literal

keyboard {Enter} into {SearchString} using {id}

CSharp

// option no.1
var actionRule = new ActionRule
{
    Action = PluginsList.Keyboard,
    Argument: "Enter",
    OnElement: "SearchString",
    Locator: "Id"
};

// option no.2
var actionRule = new
{
    Action = "Keyboard",
    Argument: "Enter",
    OnElement: "SearchString",
    Locator: "Id"
};

Python

action_rule = {
    "action": "Keyboard",
    "argument": "Enter",
    "onElement": "SearchString",
    "locator": "Id"
}

Java Script

var actionRule = {
    action: "Keyboard",
    argument: "Enter",
    onElement: "SearchString",
    locator: "Id"
};

Java

ActionRule actionRule = new ActionRule()
        .setAction("Keyboard")
        .setArgument("Enter")
        .setOnElement("SearchString")
        .setLocator("Id");

Example no. 2

Can be tested on

Perform keyboard Control+A action (ctrl+A) on the specified element.

Action Rule (JSON)

{
    "action": "Keyboard",
    "argument": "Control,a",
    "onElement": "text_area_enabled",
    "locator": "Id"
}

Rhino Literal

keyboard {Control,a} into {text_area_enabled} using {id}

CSharp

// option no.1
var actionRule = new ActionRule
{
    Action = PluginsList.Keyboard,
    Argument: "Control,a",
    OnElement: "text_area_enabled",
    Locator: "Id"
};

// option no.2
var actionRule = new
{
    Action = "Keyboard",
    Argument: "Control,a",
    OnElement: "text_area_enabled",
    Locator: "Id"
};

Python

action_rule = {
    "action": "Keyboard",
    "argument": "Control,a",
    "onElement": "text_area_enabled",
    "locator": "Id"
}

Java Script

var actionRule = {
    action: "Keyboard",
    argument: "Control,a",
    onElement: "text_area_enabled",
    locator: "Id"
};

Java

ActionRule actionRule = new ActionRule()
        .setAction("Keyboard")
        .setArgument("Control,a")
        .setOnElement("text_area_enabled")
        .setLocator("Id");

Clone this wiki locally