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

Description

Clicks the mouse at the last known mouse coordinates or on the specified element. If the click causes a new page to load, the Click method will attempt to block until the page has loaded.

Scope

Web, Mobile Web, Mobile Native or any other Web Driver implementation which implements Click.

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)

until

Repeats the click action until condition is met.

Value Description
no_alert If alert pops when clicking is performed, dismiss alert and repeat the click action.

W3C Web Driver Protocol

https://www.w3.org/TR/webdriver/#actions

Examples

Example no. 1

Can be tested on

Clicks the mouse on the specified element.

Action Rule (JSON)

{
    "action": "Click",
    "onElement": "//a[.='Departments']"
}

Rhino Literal

click on {//a[.='Departments']}

CSharp

// option no.1
var actionRule = new ActionRule
{
    Action = PluginsList.Click,
    OnElement = "//a[.='Departments']"
};

// option no.2
var actionRule = new
{
    Action = "Click",
    OnElement = "//a[.='Departments']"
};

Python

action_rule = {
    "action": "Click",
    "onElement": "//a[.='Departments']"
}

Java Script

var actionRule = {
    action: "Click",
    onElement: "//a[.='Departments']"
};

Java

ActionRule actionRule = new ActionRule()
        .setAction("Click")
        .setOnElement("//a[.='Departments']");

Example no. 2

Can be tested on

Clicks the mouse at the last known mouse coordinates.

Action Rule (JSON)

{
    "action": "Click"
}

Rhino Literal

click

CSharp

// option no.1
var actionRule = new ActionRule
{
    Action = PluginsList.Click
};

// option no.2
var actionRule = new
{
    Action = "Click"
};

Python

action_rule = {
    "action": "Click"
}

Java Script

var actionRule = {
    action: "Click"
};

Java

ActionRule actionRule = new ActionRule().setAction("Click");

Example no. 3

Can be tested on

Clicks the mouse on the specified element. If alert is present after that click, it will be dismissed and the click action repeats. The action repeats until no alert or until page load timeout reached.

This is a Web only action (not for native). This action is currently not supported by the following:

  1. iOS + Safari
  2. Internet Explorer 11

Action Rule (JSON)

{
    "action": "Click",
    "argument": "{{$ --until:no_alert}}",
    "onElement": "pop_alert",
    "locator": "Id"
}

Rhino Literal

click {{$ --until:no_alert}} on {pop_alert} using {id}

CSharp

// option no.1
var actionRule = new ActionRule
{
    Action = PluginsList.Click,
    Argument = "{{$ --until:no_alert}}",
    OnElement = "pop_alert",
    Locator = LocatorsList.Id
};

// option no.2
var actionRule = new
{
    Action = "Click",
    Argument = "{{$ --until:no_alert}}",
    OnElement = "pop_alert",
    Locator = "Id"
};

Python

action_rule = {
    "action": "Click",
    "argument": "{{$ --until:no_alert}}",
    "onElement": "pop_alert",
    "locator": "Id"
}

Java Script

var actionRule = {
    action: "Click",
    argument: "{{$ --until:no_alert}}",
    onElement: "pop_alert",
    locator: "Id"
};

Java

ActionRule actionRule = new ActionRule()
        .setAction("Click")
        .setArgument("{{$ --until:no_alert}}")
        .setOnElement("pop_alert")
        .setLocator("Id");

Clone this wiki locally