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

Description

Scrolls the window or element to a particular set of coordinates inside a given window or element.

Scope

Web, Mobile Web.

Browser Compatibility

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)

top

Value Description
number The pixel along the vertical axis of the document/element that you want displayed in the upper left.

left

Value Description
number The pixel along the horizontal axis of the document/element that you want displayed in the upper left.

behavior

Value Description
smooth, auto Specifies whether the scrolling should animate smoothly, or happen instantly in a single jump.

W3C Web Driver Protocol

https://www.w3.org/TR/webdriver/#execute-script

Examples

Example no. 1

Can be tested on

Scrolls the page overflow by 1000 pixels from top.

Action Rule (JSON)

{
    "action": "Scroll",
    "argument": "1000"
}

Rhino Literal

scroll {1000}

CSharp

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

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

Python

action_rule = {
    "action": "Scroll",
    "argument": "1000"
}

Java Script

var actionRule = {
    action: "Scroll",
    argument: "1000"
};

Java

ActionRule actionRule = new ActionRule()
        .setAction("Scroll")
        .setArgument("1000");

Example no. 2

Can be tested on

Scrolls the page overflow by 1000 pixels from top.

Action Rule (JSON)

{
    "action": "Scroll",
    "argument": "{{$ --top:1000}}"
}

Rhino Literal

scroll {{$ --top:1000}}

CSharp

// option no.1
var actionRule = new ActionRule
{
    Action = PluginsList.Scroll,
    Argument = "{{$ --top:1000}}"
};

// option no.2
var actionRule = new
{
    Action = "Scroll",
    Argument = "{{$ --top:1000}}"
};

Python

action_rule = {
    "action": "Scroll",
    "argument": "{{$ --top:1000}}"
}

Java Script

var actionRule = {
    action: "Scroll",
    argument: "{{$ --top:1000}}"
};

Java

ActionRule actionRule = new ActionRule()
        .setAction("Scroll")
        .setArgument("{{$ --top:1000}}");

Example no. 3

Can be tested on

Scroll the element overflow by 1000 pixels from top.

Action Rule (JSON)

{
    "action": "Scroll",
    "argument": "1000",
    "onElement": "text_area_enabled",
    "locator": "Id"
}

Rhino Literal

scroll {1000} on {text_area_enabled} using {id}

CSharp

// option no.1
var actionRule = new ActionRule
{
    Action = PluginsList.Scroll,
    Argument = "1000",
    OnElement = "text_area_enabled",
    Locator = LocatorsList.Id
};

// option no.2
var actionRule = new
{
    Action = "Scroll",
    Argument = "1000",
    OnElement = "text_area_enabled",
    Locator = LocatorsList.Id
};

Python

action_rule = {
    "action": "Scroll",
    "argument": "1000",
    "onElement": "text_area_enabled",
    "locator": "Id"
}

Java Script

var actionRule = {
    "action": "Scroll",
    "argument": "1000",
    "onElement": "text_area_enabled",
    "locator": "Id"
};

Java

ActionRule actionRule = new ActionRule()
        .setAction("Scroll")
        .setArgument("1000")
        .setOnElement("text_area_enabled")
        .setLocator("Id");

Example no. 4

Can be tested on

Scroll the element overflow by 1000 pixels from top.

Action Rule (JSON)

{
    "action": "Scroll",
    "argument": "{{$ --top:1000}}",
    "onElement": "text_area_enabled",
    "locator": "Id"
}

Rhino Literal

scroll {{$ --top:1000}} on {text_area_enabled} using {id}

CSharp

// option no.1
var actionRule = new ActionRule
{
    Action = PluginsList.Scroll,
    Argument = "{{$ --top:1000}}",
    OnElement = "text_area_enabled",
    Locator = LocatorsList.Id
};

// option no.2
var actionRule = new
{
    Action = "Scroll",
    Argument = "{{$ --top:1000}}",
    OnElement = "text_area_enabled",
    Locator = LocatorsList.Id
};

Python

action_rule = {
    "action": "Scroll",
    "argument": "{{$ --top:1000}}",
    "onElement": "text_area_enabled",
    "locator": "Id"
}

Java Script

var actionRule = {
    "action": "Scroll",
    "argument": "{{$ --top:1000}}",
    "onElement": "text_area_enabled",
    "locator": "Id"
};

Java

ActionRule actionRule = new ActionRule()
        .setAction("Scroll")
        .setArgument("{{$ --top:1000}}")
        .setOnElement("text_area_enabled")
        .setLocator("Id");

Example no. 5

Can be tested on

Scroll the element overflow by 1000 pixels from left.

Action Rule (JSON)

{
    "action": "Scroll",
    "argument": "{{$ --left:1000}}",
    "onElement": "text_area_enabled",
    "locator": "Id"
}

Rhino Literal

scroll {{$ --left:1000}} on {text_area_enabled} using {id}

CSharp

// option no.1
var actionRule = new ActionRule
{
    Action = PluginsList.Scroll,
    Argument = "{{$ --left:1000}}",
    OnElement = "text_area_enabled",
    Locator = LocatorsList.Id
};

// option no.2
var actionRule = new
{
    Action = "Scroll",
    Argument = "{{$ --left:1000}}",
    OnElement = "text_area_enabled",
    Locator = LocatorsList.Id
};

Python

action_rule = {
    "action": "Scroll",
    "argument": "{{$ --left:1000}}",
    "onElement": "text_area_enabled",
    "locator": "Id"
}

Java Script

var actionRule = {
    "action": "Scroll",
    "argument": "{{$ --left:1000}}",
    "onElement": "text_area_enabled",
    "locator": "Id"
};

Java

ActionRule actionRule = new ActionRule()
        .setAction("Scroll")
        .setArgument("{{$ --left:1000}}")
        .setOnElement("text_area_enabled")
        .setLocator("Id");

Example no. 6

Can be tested on

Scroll the element overflow by 1000 pixels from top and 1000 from left.

Action Rule (JSON)

{
    "action": "Scroll",
    "argument": "{{$ --top:1000 --left:1000}}",
    "onElement": "text_area_enabled",
    "locator": "Id"
}

Rhino Literal

scroll {{$ --top:1000 --left:1000}} on {text_area_enabled} using {id}

CSharp

// option no.1
var actionRule = new ActionRule
{
    Action = PluginsList.Scroll,
    Argument = "{{$ --top:1000 --left:1000}}",
    OnElement = "text_area_enabled",
    Locator = LocatorsList.Id
};

// option no.2
var actionRule = new
{
    Action = "Scroll",
    Argument = "{{$ --top:1000 --left:1000}}",
    OnElement = "text_area_enabled",
    Locator = LocatorsList.Id
};

Python

action_rule = {
    "action": "Scroll",
    "argument": "{{$ --top:1000 --left:1000}}",
    "onElement": "text_area_enabled",
    "locator": "Id"
}

Java Script

var actionRule = {
    "action": "Scroll",
    "argument": "{{$ --top:1000 --left:1000}}",
    "onElement": "text_area_enabled",
    "locator": "Id"
};

Java

ActionRule actionRule = new ActionRule()
        .setAction("Scroll")
        .setArgument("{{$ --top:1000 --left:1000}}")
        .setOnElement("text_area_enabled")
        .setLocator("Id");

Example no. 7

Can be tested on

Smoothly scroll the element overflow by 1000 pixels from top and 1000 from left.

Action Rule (JSON)

{
    "action": "Scroll",
    "argument": "{{$ --top:1000 --left:1000 --behavior:smooth}}",
    "onElement": "text_area_enabled",
    "locator": "Id"
}

Rhino Literal

scroll {{$ --top:1000 --left:1000 --behavior:smooth}} on {text_area_enabled} using {id}

CSharp

// option no.1
var actionRule = new ActionRule
{
    Action = PluginsList.Scroll,
    Argument = "{{$ --top:1000 --left:1000 --behavior:smooth}}",
    OnElement = "text_area_enabled",
    Locator = LocatorsList.Id
};

// option no.2
var actionRule = new
{
    Action = "Scroll",
    Argument = "{{$ --top:1000 --left:1000 --behavior:smooth}}",
    OnElement = "text_area_enabled",
    Locator = LocatorsList.Id
};

Python

action_rule = {
    "action": "Scroll",
    "argument": "{{$ --top:1000 --left:1000 --behavior:smooth}}",
    "onElement": "text_area_enabled",
    "locator": "Id"
}

Java Script

var actionRule = {
    "action": "Scroll",
    "argument": "{{$ --top:1000 --left:1000 --behavior:smooth}}",
    "onElement": "text_area_enabled",
    "locator": "Id"
};

Java

ActionRule actionRule = new ActionRule()
        .setAction("Scroll")
        .setArgument("{{$ --top:1000 --left:1000 --behavior:smooth}}")
        .setOnElement("text_area_enabled")
        .setLocator("Id");

Example no. 8

Can be tested on

Smoothly scroll the page overflow by 1000 pixels from top.

Action Rule (JSON)

{
    "action": "Scroll",
    "argument": "{{$ --top:1000 --behavior:smooth}}"
}

Rhino Literal

scroll {{$ --top:1000 --behavior:smooth}}

CSharp

// option no.1
var actionRule = new ActionRule
{
    Action = PluginsList.Scroll,
    Argument = "{{$ --top:1000 --behavior:smooth}}"
};

// option no.2
var actionRule = new
{
    Action = "Scroll",
    Argument = "{{$ --top:1000 --behavior:smooth}}"
};

Python

action_rule = {
    "action": "Scroll",
    "argument": "{{$ --top:1000 --behavior:smooth}}"
}

Java Script

var actionRule = {
    "action": "Scroll",
    "argument": "{{$ --top:1000 --behavior:smooth}}"
};

Java

ActionRule actionRule = new ActionRule()
        .setAction("Scroll")
        .setArgument("{{$ --top:1000 --behavior:smooth}}");

Clone this wiki locally