Skip to content

close_window

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

Description

Close the given window, quitting the browser if it is the last window currently open.

Scope

Web, Mobile Web or any other Web Driver implementation which implements Close Window.

Properties

Property Description
argument The window (zero based) index while 0 is the first (main) window.

Command Line Arguments (CLI)

None

W3C Web Driver Protocol

https://www.w3.org/TR/webdriver/#close-window

Examples

Example no. 1

Can be tested on

Close the given window by it's position index, quitting the browser if it is the last window currently open.

Action Rule (JSON)

{
    "action": "CloseWindow",
    "argument": "2"
}

Rhino Literal

close window {2}

CSharp

// option no.1
var actionRule = new ActionRule
{
    Action = PluginsList.CloseWindow,
    Argument = "2"
};

// option no.2
var actionRule = new
{
    Action = "CloseBrowser",
    Argument = "2"
};

Python

action_rule = {
    "action": "CloseWindow",
    "argument": "2"
}

Java Script

var actionRule = {
    action: "CloseWindow",
    argument: "2"
};

Java

ActionRule actionRule = new ActionRule()
        .setAction("CloseWindow")
        .setArgument("2");

Clone this wiki locally