Skip to content

condition_samples_no2

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

Content

Examples: driver

Example no. 1

Can be tested on

Executes nested actions if IWebDriver.FullName equals OpenQA.Selenium.Remote.RemoteWebDriver.

Action Rule (JSON)

{
    "action": "Condition",
    "argument": "{{$ --driver --eq:OpenQA.Selenium.Remote.RemoteWebDriver}}",
    "actions": [
        {
            "action": "SendKeys",
            "argument": "Carson",
            "onElement": "SearchString",
            "locator": "Id"
        },
        {
            "action": "Click",
            "onElement": "SearchButton",
            "locator": "Id"
        }
    ]
}

Rhino Literal

condition {{$ --driver --eq:OpenQA.Selenium.Remote.RemoteWebDriver}}
    > type {Carson} into {SearchString} using {id}
    > click on {SearchButton} using {id}

CSharp

var actionRule = new ActionRule
{
    Action = PluginsList.Condition,
    Argument = "{{$ --driver --eq:OpenQA.Selenium.Remote.RemoteWebDriver}}",
    Actions = new[]
    {
        new ActionRule
        {
            Action = PluginsList.SendKeys,
            Argument = "Carson",
            OnElement = "SearchString",
            Locator = LocatorsList.Id,
        },
        new ActionRule
        {
            Action = PluginsList.Click,
            OnElement = "SearchButton",
            Locator = LocatorsList.Id,
        }
    }
};

Python

action_rule = {
    "action": "Condition",
    "argument": "{{$ --driver --eq:OpenQA.Selenium.Remote.RemoteWebDriver}}",
    "actions": [
        {
            "action": "SendKeys",
            "argument": "Carson",
            "onElement": "SearchString",
            "locator": "Id"
        },
        {
            "action": "Click",
            "onElement": "SearchButton",
            "locator": "Id"
        }
    ]
}

Java Script

var actionRule = {
    action: "Condition",
    argument: "{{$ --driver --eq:OpenQA.Selenium.Remote.RemoteWebDriver}}",
    actions: [
        {
            action: "SendKeys",
            argument: "Carson",
            onElement: "SearchString",
            locator: "Id"
        },
        {
            action: "Click",
            onElement: "SearchButton",
            locator: "Id"
        }
    ]
};

Java

ActionRule actionRule = new ActionRule()
        .setAction("Condition")
        .setArgument("{{$ --driver --eq:OpenQA.Selenium.Remote.RemoteWebDriver}}")
        .setActions(
            new ActionRule()
                    .setAction("SendKeys")
                    .setArgument("Carson")
                    .setOnElement("SearchString")
                    .setLocator("Id"),
            new ActionRule()
                    .setAction("Click")
                    .setOnElement("SearchButton")
                    .setLocator("Id"));

Example no. 2

Can be tested on

Executes nested actions if IWebDriver.FullName not equals not_a_driver.

Action Rule (JSON)

{
    "action": "Condition",
    "argument": "{{$ --driver --ne:not_a_driver}}",
    "actions": [
        {
            "action": "SendKeys",
            "argument": "Carson",
            "onElement": "SearchString",
            "locator": "Id"
        },
        {
            "action": "Click",
            "onElement": "SearchButton",
            "locator": "Id"
        }
    ]
}

Rhino Literal

condition {{$ --driver --ne:not_a_driver}}
    > type {Carson} into {SearchString} using {id}
    > click on {SearchButton} using {id}

CSharp

var actionRule = new ActionRule
{
    Action = PluginsList.Condition,
    Argument = "{{$ --driver --ne:not_a_driver}}",
    Actions = new[]
    {
        new ActionRule
        {
            Action = PluginsList.SendKeys,
            Argument = "Carson",
            OnElement = "SearchString",
            Locator = LocatorsList.Id,
        },
        new ActionRule
        {
            Action = PluginsList.Click,
            OnElement = "SearchButton",
            Locator = LocatorsList.Id,
        }
    }
};

Python

action_rule = {
    "action": "Condition",
    "argument": "{{$ --driver --ne:not_a_driver}}",
    "actions": [
        {
            "action": "SendKeys",
            "argument": "Carson",
            "onElement": "SearchString",
            "locator": "Id"
        },
        {
            "action": "Click",
            "onElement": "SearchButton",
            "locator": "Id"
        }
    ]
}

Java Script

var actionRule = {
    action: "Condition",
    argument: "{{$ --driver --ne:not_a_driver}}",
    actions: [
        {
            action: "SendKeys",
            argument: "Carson",
            onElement: "SearchString",
            locator: "Id"
        },
        {
            action: "Click",
            onElement: "SearchButton",
            locator: "Id"
        }
    ]
};

Java

ActionRule actionRule = new ActionRule()
        .setAction("Condition")
        .setArgument("{{$ --driver --ne:not_a_driver}}")
        .setActions(
            new ActionRule()
                    .setAction("SendKeys")
                    .setArgument("Carson")
                    .setOnElement("SearchString")
                    .setLocator("Id"),
            new ActionRule()
                    .setAction("Click")
                    .setOnElement("SearchButton")
                    .setLocator("Id"));

Example no. 3

Can be tested on

Executes nested actions if IWebDriver.FullName match RemoteWebDriver.

Action Rule (JSON)

{
    "action": "Condition",
    "argument": "{{$ --driver --match:RemoteWebDriver}}",
    "actions": [
        {
            "action": "SendKeys",
            "argument": "Carson",
            "onElement": "SearchString",
            "locator": "Id"
        },
        {
            "action": "Click",
            "onElement": "SearchButton",
            "locator": "Id"
        }
    ]
}

Rhino Literal

condition {{$ --driver --match:RemoteWebDriver}}
    > type {Carson} into {SearchString} using {id}
    > click on {SearchButton} using {id}

CSharp

var actionRule = new ActionRule
{
    Action = PluginsList.Condition,
    Argument = "{{$ --driver --match:RemoteWebDriver}}",
    Actions = new[]
    {
        new ActionRule
        {
            Action = PluginsList.SendKeys,
            Argument = "Carson",
            OnElement = "SearchString",
            Locator = LocatorsList.Id,
        },
        new ActionRule
        {
            Action = PluginsList.Click,
            OnElement = "SearchButton",
            Locator = LocatorsList.Id,
        }
    }
};

Python

action_rule = {
    "action": "Condition",
    "argument": "{{$ --driver --match:RemoteWebDriver}}",
    "actions": [
        {
            "action": "SendKeys",
            "argument": "Carson",
            "onElement": "SearchString",
            "locator": "Id"
        },
        {
            "action": "Click",
            "onElement": "SearchButton",
            "locator": "Id"
        }
    ]
}

Java Script

var actionRule = {
    action: "Condition",
    argument: "{{$ --driver --match:RemoteWebDriver}}",
    actions: [
        {
            action: "SendKeys",
            argument: "Carson",
            onElement: "SearchString",
            locator: "Id"
        },
        {
            action: "Click",
            onElement: "SearchButton",
            locator: "Id"
        }
    ]
};

Java

ActionRule actionRule = new ActionRule()
        .setAction("Condition")
        .setArgument("{{$ --driver --match:RemoteWebDriver}}")
        .setActions(
            new ActionRule()
                    .setAction("SendKeys")
                    .setArgument("Carson")
                    .setOnElement("SearchString")
                    .setLocator("Id"),
            new ActionRule()
                    .setAction("Click")
                    .setOnElement("SearchButton")
                    .setLocator("Id"));

Example no. 4

Can be tested on

Executes nested actions if IWebDriver.FullName not match not_a_driver.

Action Rule (JSON)

{
    "action": "Condition",
    "argument": "{{$ --driver --not_match:not_a_driver}}",
    "actions": [
        {
            "action": "SendKeys",
            "argument": "Carson",
            "onElement": "SearchString",
            "locator": "Id"
        },
        {
            "action": "Click",
            "onElement": "SearchButton",
            "locator": "Id"
        }
    ]
}

Rhino Literal

condition {{$ --driver --not_match:not_a_driver}}
    > type {Carson} into {SearchString} using {id}
    > click on {SearchButton} using {id}

CSharp

var actionRule = new ActionRule
{
    Action = PluginsList.Condition,
    Argument = "{{$ --driver --not_match:not_a_driver}}",
    Actions = new[]
    {
        new ActionRule
        {
            Action = PluginsList.SendKeys,
            Argument = "Carson",
            OnElement = "SearchString",
            Locator = LocatorsList.Id,
        },
        new ActionRule
        {
            Action = PluginsList.Click,
            OnElement = "SearchButton",
            Locator = LocatorsList.Id,
        }
    }
};

Python

action_rule = {
    "action": "Condition",
    "argument": "{{$ --driver --not_match:not_a_driver}}",
    "actions": [
        {
            "action": "SendKeys",
            "argument": "Carson",
            "onElement": "SearchString",
            "locator": "Id"
        },
        {
            "action": "Click",
            "onElement": "SearchButton",
            "locator": "Id"
        }
    ]
}

Java Script

var actionRule = {
    action: "Condition",
    argument: "{{$ --driver --not_match:not_a_driver}}",
    actions: [
        {
            action: "SendKeys",
            argument: "Carson",
            onElement: "SearchString",
            locator: "Id"
        },
        {
            action: "Click",
            onElement: "SearchButton",
            locator: "Id"
        }
    ]
};

Java

ActionRule actionRule = new ActionRule()
        .setAction("Condition")
        .setArgument("{{$ --driver --not_match:not_a_driver}}")
        .setActions(
            new ActionRule()
                    .setAction("SendKeys")
                    .setArgument("Carson")
                    .setOnElement("SearchString")
                    .setLocator("Id"),
            new ActionRule()
                    .setAction("Click")
                    .setOnElement("SearchButton")
                    .setLocator("Id"));

Examples: enabled

Example no. 1

Can be tested on

Executes nested actions if <input id="input_enabled"> element is enabled.

Action Rule (JSON)

{
    "action": "Condition",
    "argument": "{{$ --enabled}}",
    "onElement": "input_enabled",
    "locator": "Id"
    "actions": [
        {
            "action": "SendKeys",
            "argument": "20",
            "onElement": "number_of_alerts",
            "locator": "Id"
        }
    ]
}

Rhino Literal

condition {{$ --enabled}} on {input_enabled} using {id}
    > type {20} into {number_of_alerts} using {id}

CSharp

var actionRule = new ActionRule
{
    Action = PluginsList.Condition,
    Argument = "argument": "{{$ --enabled}}",
    OnElement = "input_enabled",
    Locator = LocatorsList.Id,
    Actions = new[]
    {
        new ActionRule
        {
            Action = PluginsList.SendKeys,
            Argument = "20",
            OnElement = "number_of_alerts",
            Locator = LocatorsList.Id
        }
    }
};

Python

action_rule = {
    "action": "Condition",
    "argument": "{{$ --enabled}}",
    "onElement": "input_enabled",
    "locator": "Id"
    "actions": [
        {
            "action": "SendKeys",
            "argument": "20",
            "onElement": "number_of_alerts",
            "locator": "Id"
        }
    ]
}

Java Script

var actionRule = {
    action: "Condition",
    argument: "{{$ --enabled}}",
    onElement: "input_enabled",
    locator: "Id"
    actions: [
        {
            action: "SendKeys",
            argument: "20",
            onElement: "number_of_alerts",
            locator: "Id"
        }
    ]
};

Java

ActionRule actionRule = new ActionRule()
        .setAction("Condition")
        .setArgument("{{$ --enabled}}")
        .setOnElement("input_enabled")
        .setLocator("Id")
        .setActions(
            new ActionRule()
                    .setAction("SendKeys")
                    .setArgument("20")
                    .setOnElement("number_of_alerts")
                    .setLocator("Id"));

Examples: exists

Example no. 1

Can be tested on

Executes nested actions if <input id="input_hidden"> element is exists.

Action Rule (JSON)

{
    "action": "Condition",
    "argument": "{{$ --exists}}",
    "onElement": "input_hidden",
    "locator": "Id"
    "actions": [
        {
            "action": "SendKeys",
            "argument": "20",
            "onElement": "number_of_alerts",
            "locator": "Id"
        }
    ]
}

Rhino Literal

condition {{$ --exists}} on {input_hidden} using {id}
    > type {20} into {number_of_alerts} using {id}

CSharp

var actionRule = new ActionRule
{
    Action = PluginsList.Condition,
    Argument = "argument": "{{$ --exists}}",
    OnElement = "input_hidden",
    Locator = LocatorsList.Id,
    Actions = new[]
    {
        new ActionRule
        {
            Action = PluginsList.SendKeys,
            Argument = "20",
            OnElement = "number_of_alerts",
            Locator = LocatorsList.Id
        }
    }
};

Python

action_rule = {
    "action": "Condition",
    "argument": "{{$ --exists}}",
    "onElement": "input_hidden",
    "locator": "Id"
    "actions": [
        {
            "action": "SendKeys",
            "argument": "20",
            "onElement": "number_of_alerts",
            "locator": "Id"
        }
    ]
}

Java Script

var actionRule = {
    action: "Condition",
    argument: "{{$ --exists}}",
    onElement: "input_hidden",
    locator: "Id"
    actions: [
        {
            "action": "SendKeys",
            "argument": "20",
            "onElement": "number_of_alerts",
            "locator": "Id"
        }
    ]
};

Java

ActionRule actionRule = new ActionRule()
        .setAction("Condition")
        .setArgument("{{$ --exists}}")
        .setOnElement("input_hidden")
        .setLocator("Id")
        .setActions(
            new ActionRule()
                    .setAction("SendKeys")
                    .setArgument("20")
                    .setOnElement("number_of_alerts")
                    .setLocator("Id"));

Examples: hidden

Example no. 1

Can be tested on

Executes nested actions if <input id="input_hidden"> element is hidden.

Action Rule (JSON)

{
    "action": "Condition",
    "argument": "{{$ --hidden}}",
    "onElement": "input_hidden",
    "locator": "Id"
    "actions": [
        {
            "action": "SendKeys",
            "argument": "20",
            "onElement": "number_of_alerts",
            "locator": "Id"
        }
    ]
}

Rhino Literal

condition {{$ --hidden}} on {input_hidden} using {id}
    > type {20} into {number_of_alerts} using {id}

CSharp

var actionRule = new ActionRule
{
    Action = PluginsList.Condition,
    Argument = "argument": "{{$ --hidden}}",
    OnElement = "input_hidden",
    Locator = LocatorsList.Id,
    Actions = new[]
    {
        new ActionRule
        {
            Action = PluginsList.SendKeys,
            Argument = "20",
            OnElement = "number_of_alerts",
            Locator = LocatorsList.Id
        }
    }
};

Python

action_rule = {
    "action": "Condition",
    "argument": "{{$ --hidden}}",
    "onElement": "input_hidden",
    "locator": "Id"
    "actions": [
        {
            "action": "SendKeys",
            "argument": "20",
            "onElement": "number_of_alerts",
            "locator": "Id"
        }
    ]
}

Java Script

var actionRule = {
    action: "Condition",
    argument: "{{$ --hidden}}",
    onElement: "input_hidden",
    locator: "Id"
    actions: [
        {
            "action": "SendKeys",
            "argument": "20",
            "onElement": "number_of_alerts",
            "locator": "Id"
        }
    ]
};

Java

ActionRule actionRule = new ActionRule()
        .setAction("Condition")
        .setArgument("{{$ --hidden}}")
        .setOnElement("input_hidden")
        .setLocator("Id")
        .setActions(
            new ActionRule()
                    .setAction("SendKeys")
                    .setArgument("20")
                    .setOnElement("number_of_alerts")
                    .setLocator("Id"));

Examples: not_exists

Example no. 1

Can be tested on

Executes nested actions if <input id="no_element"> element is not exists.

Action Rule (JSON)

{
    "action": "Condition",
    "argument": "{{$ --not_exists}}",
    "onElement": "no_element",
    "locator": "Id"
    "actions": [
        {
            "action": "SendKeys",
            "argument": "20",
            "onElement": "number_of_alerts",
            "locator": "Id"
        }
    ]
}

Rhino Literal

condition {{$ --not_exists}} on {no_element} using {id}
    > type {20} into {number_of_alerts} using {id}

CSharp

var actionRule = new ActionRule
{
    Action = PluginsList.Condition,
    Argument = "argument": "{{$ --not_exists}}",
    OnElement = "no_element",
    Locator = LocatorsList.Id,
    Actions = new[]
    {
        new ActionRule
        {
            Action = PluginsList.SendKeys,
            Argument = "20",
            OnElement = "number_of_alerts",
            Locator = LocatorsList.Id
        }
    }
};

Python

action_rule = {
    "action": "Condition",
    "argument": "{{$ --not_exists}}",
    "onElement": "no_element",
    "locator": "Id"
    "actions": [
        {
            "action": "SendKeys",
            "argument": "20",
            "onElement": "number_of_alerts",
            "locator": "Id"
        }
    ]
}

Java Script

var actionRule = {
    action: "Condition",
    argument: "{{$ --not_exists}}",
    onElement: "no_element",
    locator: "Id"
    actions: [
        {
            "action": "SendKeys",
            "argument": "20",
            "onElement": "number_of_alerts",
            "locator": "Id"
        }
    ]
};

Java

ActionRule actionRule = new ActionRule()
        .setAction("Condition")
        .setArgument("{{$ --not_exists}}")
        .setOnElement("no_element")
        .setLocator("Id")
        .setActions(
            new ActionRule()
                    .setAction("SendKeys")
                    .setArgument("20")
                    .setOnElement("number_of_alerts")
                    .setLocator("Id"));

Examples: not_selected

Example no. 1

Can be tested on

Executes nested actions if <input id="input_not_selected"> element is not selected.

Action Rule (JSON)

{
    "action": "Condition",
    "argument": "{{$ --not_selected}}",
    "onElement": "input_not_selected",
    "locator": "Id"
    "actions": [
        {
            "action": "SendKeys",
            "argument": "20",
            "onElement": "number_of_alerts",
            "locator": "Id"
        }
    ]
}

Rhino Literal

condition {{$ --not_selected}} on {input_not_selected} using {id}
    > type {20} into {number_of_alerts} using {id}

CSharp

var actionRule = new ActionRule
{
    Action = PluginsList.Condition,
    Argument = "argument": "{{$ --not_selected}}",
    OnElement = "input_not_selected",
    Locator = LocatorsList.Id,
    Actions = new[]
    {
        new ActionRule
        {
            Action = PluginsList.SendKeys,
            Argument = "20",
            OnElement = "number_of_alerts",
            Locator = LocatorsList.Id
        }
    }
};

Python

action_rule = {
    "action": "Condition",
    "argument": "{{$ --not_selected}}",
    "onElement": "input_not_selected",
    "locator": "Id"
    "actions": [
        {
            "action": "SendKeys",
            "argument": "20",
            "onElement": "number_of_alerts",
            "locator": "Id"
        }
    ]
}

Java Script

var actionRule = {
    action: "Condition",
    argument: "{{$ --not_selected}}",
    onElement: "input_not_selected",
    locator: "Id"
    actions: [
        {
            "action": "SendKeys",
            "argument": "20",
            "onElement": "number_of_alerts",
            "locator": "Id"
        }
    ]
};

Java

ActionRule actionRule = new ActionRule()
        .setAction("Condition")
        .setArgument("{{$ --not_selected}}")
        .setOnElement("input_not_selected")
        .setLocator("Id")
        .setActions(
            new ActionRule()
                    .setAction("SendKeys")
                    .setArgument("20")
                    .setOnElement("number_of_alerts")
                    .setLocator("Id"));

Clone this wiki locally