Skip to content

condition_samples_no1

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

Content

Examples: attribute

Example no. 1

Can be tested on

Executes nested actions if class attribute of an element equals btn btn-default.

Action Rule (JSON)

{
    "action": "Condition",
    "argument": "{{$ --attribute --eq:btn btn-default}}",
    "onElement": "SearchButton",
    "onAttribute": "class",
    "locator": "Id"
    "actions": [
        {
            "action": "SendKeys",
            "argument": "Carson",
            "onElement": "SearchString",
            "locator": "Id"
        },
        {
            "action": "Click",
            "onElement": "SearchButton",
            "locator": "Id"
        }
    ]
}

Rhino Literal

condition {{$ --attribute --eq:btn btn-default}} on {SearchButton} from {class} using {id}
    > type {Carson} into {SearchString} using {id}
    > click on {SearchButton} using {id}

CSharp

var actionRule = new ActionRule
{
    Action = PluginsList.Condition,
    Argument = "{{$ --attribute --eq:btn btn-default}}",
    OnElement = "SearchButton",
    OnAttribute = "class",
    Locator = LocatorsList.Id,
    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": "{{$ --attribute --eq:btn btn-default}}",
    "onElement": "SearchButton",
    "onAttribute": "class",
    "locator": "Id"
    "actions": [
        {
            "action": "SendKeys",
            "argument": "Carson",
            "onElement": "SearchString",
            "locator": "Id"
        },
        {
            "action": "Click",
            "onElement": "SearchButton",
            "locator": "Id"
        }
    ]
}

Java Script

var actionRule = {
    action: "Condition",
    argument: "{{$ --attribute --eq:btn btn-default}}",
    onElement: "SearchButton",
    onAttribute: "class",
    locator: "Id"
    actions: [
        {
            action: "SendKeys",
            argument: "Carson",
            onElement: "SearchString",
            locator: "Id"
        },
        {
            action: "Click",
            onElement: "SearchButton",
            locator: "Id"
        }
    ]
};

Java

ActionRule actionRule = new ActionRule()
        .setAction("Condition")
        .setArgument("{{$ --attribute --eq:btn btn-default}}")
        .setOnElement("SearchButton")
        .setOnAttribute("class")
        .setLocator("Id")
        .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 class attribute of an element not equals btn-default btn.

Action Rule (JSON)

{
    "action": "Condition",
    "argument": "{{$ --attribute --ne:btn-default btn}}",
    "onElement": "SearchButton",
    "onAttribute": "class",
    "locator": "Id"
    "actions": [
        {
            "action": "SendKeys",
            "argument": "Carson",
            "onElement": "SearchString",
            "locator": "Id"
        },
        {
            "action": "Click",
            "onElement": "SearchButton",
            "locator": "Id"
        }
    ]
}

Rhino Literal

condition {{$ --attribute --ne:btn-default btn}} on {SearchButton} from {class} using {id}
    > type {Carson} into {SearchString} using {id}
    > click on {SearchButton} using {id}

CSharp

var actionRule = new ActionRule
{
    Action = PluginsList.Condition,
    Argument = "{{$ --attribute --ne:btn-default btn}}",
    OnElement = "SearchButton",
    OnAttribute = "class",
    Locator = LocatorsList.Id,
    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": "{{$ --attribute --ne:btn-default btn}}",
    "onElement": "SearchButton",
    "onAttribute": "class",
    "locator": "Id"
    "actions": [
        {
            "action": "SendKeys",
            "argument": "Carson",
            "onElement": "SearchString",
            "locator": "Id"
        },
        {
            "action": "Click",
            "onElement": "SearchButton",
            "locator": "Id"
        }
    ]
}

Java Script

var actionRule = {
    action: "Condition",
    argument: "{{$ --attribute --ne:btn-default btn}}",
    onElement: "SearchButton",
    onAttribute: "class",
    locator: "Id"
    actions: [
        {
            action: "SendKeys",
            argument: "Carson",
            onElement: "SearchString",
            locator: "Id"
        },
        {
            action: "Click",
            onElement: "SearchButton",
            locator: "Id"
        }
    ]
};

Java

ActionRule actionRule = new ActionRule()
        .setAction("Condition")
        .setArgument("{{$ --attribute --ne:btn-default btn}}")
        .setOnElement("SearchButton")
        .setOnAttribute("class")
        .setLocator("Id")
        .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 class attribute of an element match ^btn btn-default$.

Action Rule (JSON)

{
    "action": "Condition",
    "argument": "{{$ --attribute --match:^btn btn-default$}}",
    "onElement": "SearchButton",
    "onAttribute": "class",
    "locator": "Id"
    "actions": [
        {
            "action": "SendKeys",
            "argument": "Carson",
            "onElement": "SearchString",
            "locator": "Id"
        },
        {
            "action": "Click",
            "onElement": "SearchButton",
            "locator": "Id"
        }
    ]
}

Rhino Literal

condition {{$ --attribute --match:^btn btn-default$}} on {SearchButton} from {class} using {id}
    > type {Carson} into {SearchString} using {id}
    > click on {SearchButton} using {id}

CSharp

var actionRule = new ActionRule
{
    Action = PluginsList.Condition,
    Argument = "{{$ --attribute --match:^btn btn-default$}}",
    OnElement = "SearchButton",
    OnAttribute = "class",
    Locator = LocatorsList.Id,
    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": "{{$ --attribute --match:^btn btn-default$}}",
    "onElement": "SearchButton",
    "onAttribute": "class",
    "locator": "Id"
    "actions": [
        {
            "action": "SendKeys",
            "argument": "Carson",
            "onElement": "SearchString",
            "locator": "Id"
        },
        {
            "action": "Click",
            "onElement": "SearchButton",
            "locator": "Id"
        }
    ]
}

Java Script

var actionRule = {
    action: "Condition",
    argument: "{{$ --attribute --match:^btn btn-default$}}",
    onElement: "SearchButton",
    onAttribute: "class",
    locator: "Id"
    actions: [
        {
            action: "SendKeys",
            argument: "Carson",
            onElement: "SearchString",
            locator: "Id"
        },
        {
            action: "Click",
            onElement: "SearchButton",
            locator: "Id"
        }
    ]
};

Java

ActionRule actionRule = new ActionRule()
        .setAction("Condition")
        .setArgument("{{$ --attribute --match:^btn btn-default$}}")
        .setOnElement("SearchButton")
        .setOnAttribute("class")
        .setLocator("Id")
        .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 class attribute of an element not match ^btn-default btn$.

Action Rule (JSON)

{
    "action": "Condition",
    "argument": "{{$ --attribute --not_match:^btn-default btn$}}",
    "onElement": "SearchButton",
    "onAttribute": "class",
    "locator": "Id"
    "actions": [
        {
            "action": "SendKeys",
            "argument": "Carson",
            "onElement": "SearchString",
            "locator": "Id"
        },
        {
            "action": "Click",
            "onElement": "SearchButton",
            "locator": "Id"
        }
    ]
}

Rhino Literal

condition {{$ --attribute --not_match:^btn-default btn$}} on {SearchButton} from {class} using {id}
    > type {Carson} into {SearchString} using {id}
    > click on {SearchButton} using {id}

CSharp

var actionRule = new ActionRule
{
    Action = PluginsList.Condition,
    Argument = "{{$ --attribute --not_match:^btn-default btn$}}",
    OnElement = "SearchButton",
    OnAttribute = "class",
    Locator = LocatorsList.Id,
    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": "{{$ --attribute --not_match:^btn-default btn$}}",
    "onElement": "SearchButton",
    "onAttribute": "class",
    "locator": "Id"
    "actions": [
        {
            "action": "SendKeys",
            "argument": "Carson",
            "onElement": "SearchString",
            "locator": "Id"
        },
        {
            "action": "Click",
            "onElement": "SearchButton",
            "locator": "Id"
        }
    ]
}

Java Script

var actionRule = {
    action: "Condition",
    argument: "{{$ --attribute --not_match:^btn-default btn$}}",
    onElement: "SearchButton",
    onAttribute: "class",
    locator: "Id"
    actions: [
        {
            action: "SendKeys",
            argument: "Carson",
            onElement: "SearchString",
            locator: "Id"
        },
        {
            action: "Click",
            onElement: "SearchButton",
            locator: "Id"
        }
    ]
};

Java

ActionRule actionRule = new ActionRule()
        .setAction("Condition")
        .setArgument("{{$ --attribute --not_match:^btn-default btn$}}")
        .setOnElement("SearchButton")
        .setOnAttribute("class")
        .setLocator("Id")
        .setActions(
            new ActionRule()
                    .setAction("SendKeys")
                    .setArgument("Carson")
                    .setOnElement("SearchString")
                    .setLocator("Id"),
            new ActionRule()
                    .setAction("Click")
                    .setOnElement("SearchButton")
                    .setLocator("Id"));

Example no. 5

Can be tested on

Executes nested actions if href attribute of an element filtered by \d+ regular expression greater than 0.

Action Rule (JSON)

{
    "action": "Condition",
    "argument": "{{$ --attribute --gt:0}}",
    "onElement": "Edit",
    "onAttribute": "href",
    "locator": "LinkText",
    "regularExpression": "\\d+"
    "actions": [
        {
            "action": "SendKeys",
            "argument": "Carson",
            "onElement": "SearchString",
            "locator": "Id"
        },
        {
            "action": "Click",
            "onElement": "SearchButton",
            "locator": "Id"
        }
    ]
}

Rhino Literal

condition {{$ --attribute --gt:0}} on {Edit} from {href} using {link text} filter {\d+}
    > type {Carson} into {SearchString} using {id}
    > click on {SearchButton} using {id}

CSharp

var actionRule = new ActionRule
{
    Action = PluginsList.Condition,
    Argument = "{{$ --attribute --gt:0}}",
    OnElement = "Edit",
    OnAttribute = "href",
    Locator = LocatorsList.LinkText,
    RegularExpression = "\\d+",
    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": "{{$ --attribute --gt:0}}",
    "onElement": "Edit",
    "onAttribute": "href",
    "locator": "LinkText",
    "regularExpression": "\\d+"
    "actions": [
        {
            "action": "SendKeys",
            "argument": "Carson",
            "onElement": "SearchString",
            "locator": "Id"
        },
        {
            "action": "Click",
            "onElement": "SearchButton",
            "locator": "Id"
        }
    ]
}

Java Script

var actionRule = {
    action: "Condition",
    argument: "{{$ --attribute --gt:0}}",
    onElement: "Edit",
    onAttribute: "href",
    locator: "LinkText",
    regularExpression: "\\d+"
    actions: [
        {
            "action": "SendKeys",
            "argument": "Carson",
            "onElement": "SearchString",
            "locator": "Id"
        },
        {
            "action": "Click",
            "onElement": "SearchButton",
            "locator": "Id"
        }
    ]
};

Java

ActionRule actionRule = new ActionRule()
        .setAction("Condition")
        .setArgument("{{$ --attribute --gt:0}}")
        .setOnElement("Edit")
        .setOnAttribute("href")
        .setLocator("LinkText")
        .setRegularExpression("\\d+")
        .setActions(
            new ActionRule()
                    .setAction("SendKeys")
                    .setArgument("Carson")
                    .setOnElement("SearchString")
                    .setLocator("Id"),
            new ActionRule()
                    .setAction("Click")
                    .setOnElement("SearchButton")
                    .setLocator("Id"));

Example no. 6

Can be tested on

Executes nested actions if href attribute of an element filtered by \d+ regular expression lower than 1000.

Action Rule (JSON)

{
    "action": "Condition",
    "argument": "{{$ --attribute --lt:1000}}",
    "onElement": "Edit",
    "onAttribute": "href",
    "locator": "LinkText",
    "regularExpression": "\\d+"
    "actions": [
        {
            "action": "SendKeys",
            "argument": "Carson",
            "onElement": "SearchString",
            "locator": "Id"
        },
        {
            "action": "Click",
            "onElement": "SearchButton",
            "locator": "Id"
        }
    ]
}

Rhino Literal

condition {{$ --attribute --lt:1000}} on {Edit} from {href} using {link text} filter {\d+}
    > type {Carson} into {SearchString} using {id}
    > click on {SearchButton} using {id}

CSharp

var actionRule = new ActionRule
{
    Action = PluginsList.Condition,
    Argument = "{{$ --attribute --lt:1000}}",
    OnElement = "Edit",
    OnAttribute = "href",
    Locator = LocatorsList.LinkText,
    RegularExpression = "\\d+",
    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": "{{$ --attribute --lt:1000}}",
    "onElement": "Edit",
    "onAttribute": "href",
    "locator": "LinkText",
    "regularExpression": "\\d+"
    "actions": [
        {
            "action": "SendKeys",
            "argument": "Carson",
            "onElement": "SearchString",
            "locator": "Id"
        },
        {
            "action": "Click",
            "onElement": "SearchButton",
            "locator": "Id"
        }
    ]
}

Java Script

var actionRule = {
    action: "Condition",
    argument: "{{$ --attribute --lt:1000}}",
    onElement: "Edit",
    onAttribute: "href",
    locator: "LinkText",
    regularExpression: "\\d+"
    actions: [
        {
            "action": "SendKeys",
            "argument": "Carson",
            "onElement": "SearchString",
            "locator": "Id"
        },
        {
            "action": "Click",
            "onElement": "SearchButton",
            "locator": "Id"
        }
    ]
};

Java

ActionRule actionRule = new ActionRule()
        .setAction("Condition")
        .setArgument("{{$ --attribute --lt:1000}}")
        .setOnElement("Edit")
        .setOnAttribute("href")
        .setLocator("LinkText")
        .setRegularExpression("\\d+")
        .setActions(
            new ActionRule()
                    .setAction("SendKeys")
                    .setArgument("Carson")
                    .setOnElement("SearchString")
                    .setLocator("Id"),
            new ActionRule()
                    .setAction("Click")
                    .setOnElement("SearchButton")
                    .setLocator("Id"));

Example no. 7

Can be tested on

Executes nested actions if href attribute of an element filtered by \d+ regular expression greater or equal 0.

Action Rule (JSON)

{
    "action": "Condition",
    "argument": "{{$ --attribute --ge:0}}",
    "onElement": "Edit",
    "onAttribute": "href",
    "locator": "LinkText",
    "regularExpression": "\\d+"
    "actions": [
        {
            "action": "SendKeys",
            "argument": "Carson",
            "onElement": "SearchString",
            "locator": "Id"
        },
        {
            "action": "Click",
            "onElement": "SearchButton",
            "locator": "Id"
        }
    ]
}

Rhino Literal

condition {{$ --attribute --ge:0}} on {Edit} from {href} using {link text} filter {\d+}
    > type {Carson} into {SearchString} using {id}
    > click on {SearchButton} using {id}

CSharp

var actionRule = new ActionRule
{
    Action = PluginsList.Condition,
    Argument = "{{$ --attribute --ge:0}}",
    OnElement = "Edit",
    OnAttribute = "href",
    Locator = LocatorsList.LinkText,
    RegularExpression = "\\d+",
    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": "{{$ --attribute --ge:0}}",
    "onElement": "Edit",
    "onAttribute": "href",
    "locator": "LinkText",
    "regularExpression": "\\d+"
    "actions": [
        {
            "action": "SendKeys",
            "argument": "Carson",
            "onElement": "SearchString",
            "locator": "Id"
        },
        {
            "action": "Click",
            "onElement": "SearchButton",
            "locator": "Id"
        }
    ]
}

Java Script

var actionRule = {
    action: "Condition",
    argument: "{{$ --attribute --ge:0}}",
    onElement: "Edit",
    onAttribute: "href",
    locator: "LinkText",
    regularExpression: "\\d+"
    actions: [
        {
            "action": "SendKeys",
            "argument": "Carson",
            "onElement": "SearchString",
            "locator": "Id"
        },
        {
            "action": "Click",
            "onElement": "SearchButton",
            "locator": "Id"
        }
    ]
};

Java

ActionRule actionRule = new ActionRule()
        .setAction("Condition")
        .setArgument("{{$ --attribute --ge:0}}")
        .setOnElement("Edit")
        .setOnAttribute("href")
        .setLocator("LinkText")
        .setRegularExpression("\\d+")
        .setActions(
            new ActionRule()
                    .setAction("SendKeys")
                    .setArgument("Carson")
                    .setOnElement("SearchString")
                    .setLocator("Id"),
            new ActionRule()
                    .setAction("Click")
                    .setOnElement("SearchButton")
                    .setLocator("Id"));

Example no. 8

Can be tested on

Executes nested actions if href attribute of an element filtered by \d+ regular expression lower or equal 1.

Action Rule (JSON)

{
    "action": "Condition",
    "argument": "{{$ --attribute --le:1}}",
    "onElement": "Edit",
    "onAttribute": "href",
    "locator": "LinkText",
    "regularExpression": "\\d+"
    "actions": [
        {
            "action": "SendKeys",
            "argument": "Carson",
            "onElement": "SearchString",
            "locator": "Id"
        },
        {
            "action": "Click",
            "onElement": "SearchButton",
            "locator": "Id"
        }
    ]
}

Rhino Literal

condition {{$ --attribute --le:1}} on {Edit} from {href} using {link text} filter {\d+}
    > type {Carson} into {SearchString} using {id}
    > click on {SearchButton} using {id}

CSharp

var actionRule = new ActionRule
{
    Action = PluginsList.Condition,
    Argument = "{{$ --attribute --le:1}}",
    OnElement = "Edit",
    OnAttribute = "href",
    Locator = LocatorsList.LinkText,
    RegularExpression = "\\d+",
    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": "{{$ --attribute --le:1}}",
    "onElement": "Edit",
    "onAttribute": "href",
    "locator": "LinkText",
    "regularExpression": "\\d+"
    "actions": [
        {
            "action": "SendKeys",
            "argument": "Carson",
            "onElement": "SearchString",
            "locator": "Id"
        },
        {
            "action": "Click",
            "onElement": "SearchButton",
            "locator": "Id"
        }
    ]
}

Java Script

var actionRule = {
    action: "Condition",
    argument: "{{$ --attribute --le:1}}",
    onElement: "Edit",
    onAttribute: "href",
    locator: "LinkText",
    regularExpression: "\\d+"
    actions: [
        {
            "action": "SendKeys",
            "argument": "Carson",
            "onElement": "SearchString",
            "locator": "Id"
        },
        {
            "action": "Click",
            "onElement": "SearchButton",
            "locator": "Id"
        }
    ]
};

Java

ActionRule actionRule = new ActionRule()
        .setAction("Condition")
        .setArgument("{{$ --attribute --le:1}}")
        .setOnElement("Edit")
        .setOnAttribute("href")
        .setLocator("LinkText")
        .setRegularExpression("\\d+")
        .setActions(
            new ActionRule()
                    .setAction("SendKeys")
                    .setArgument("Carson")
                    .setOnElement("SearchString")
                    .setLocator("Id"),
            new ActionRule()
                    .setAction("Click")
                    .setOnElement("SearchButton")
                    .setLocator("Id"));

Examples: count

Example no. 1

Can be tested on

Executes nested actions if //tr[./td[@id]] elements count equals 3.

Action Rule (JSON)

{
    "action": "Condition",
    "argument": "{{$ --count --eq:3}}",
    "onElement": "//tr[./td[@id]]",
    "actions": [
        {
            "action": "SendKeys",
            "argument": "Carson",
            "onElement": "SearchString",
            "locator": "Id"
        },
        {
            "action": "Click",
            "onElement": "SearchButton",
            "locator": "Id"
        }
    ]
}

Rhino Literal

condition {{$ --count --eq:3}} on {//tr[./td[@id]]}
    > type {Carson} into {SearchString} using {id}
    > click on {SearchButton} using {id}

CSharp

var actionRule = new ActionRule
{
    Action = PluginsList.Condition,
    Argument = "{{$ --count --eq:3}}",
    OnElement = "//tr[./td[@id]]",
    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": "{{$ --count --eq:3}}",
    "onElement": "//tr[./td[@id]]",
    "actions": [
        {
            "action": "SendKeys",
            "argument": "Carson",
            "onElement": "SearchString",
            "locator": "Id"
        },
        {
            "action": "Click",
            "onElement": "SearchButton",
            "locator": "Id"
        }
    ]
}

Java Script

var actionRule = {
    action: "Condition",
    argument: "{{$ --count --eq:3}}",
    onElement: "//tr[./td[@id]]",
    actions: [
        {
            action: "SendKeys",
            argument: "Carson",
            onElement: "SearchString",
            locator: "Id"
        },
        {
            action: "Click",
            onElement: "SearchButton",
            locator: "Id"
        }
    ]
};

Java

ActionRule actionRule = new ActionRule()
        .setAction("Condition")
        .setArgument("{{$ --count --eq:3}}")
        .setOnElement("//tr[./td[@id]]")
        .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 //tr[./td[@id]] elements count not equals 1.

Action Rule (JSON)

{
    "action": "Condition",
    "argument": "{{$ --count --ne:1}}",
    "onElement": "//tr[./td[@id]]",
    "actions": [
        {
            "action": "SendKeys",
            "argument": "Carson",
            "onElement": "SearchString",
            "locator": "Id"
        },
        {
            "action": "Click",
            "onElement": "SearchButton",
            "locator": "Id"
        }
    ]
}

Rhino Literal

condition {{$ --count --ne:1}} on {//tr[./td[@id]]}
    > type {Carson} into {SearchString} using {id}
    > click on {SearchButton} using {id}

CSharp

var actionRule = new ActionRule
{
    Action = PluginsList.Condition,
    Argument = "{{$ --count --ne:1}}",
    OnElement = "//tr[./td[@id]]",
    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": "{{$ --count --ne:1}}",
    "onElement": "//tr[./td[@id]]",
    "actions": [
        {
            "action": "SendKeys",
            "argument": "Carson",
            "onElement": "SearchString",
            "locator": "Id"
        },
        {
            "action": "Click",
            "onElement": "SearchButton",
            "locator": "Id"
        }
    ]
}

Java Script

var actionRule = {
    action: "Condition",
    argument: "{{$ --count --ne:1}}",
    onElement: "//tr[./td[@id]]",
    actions: [
        {
            action: "SendKeys",
            argument: "Carson",
            onElement: "SearchString",
            locator: "Id"
        },
        {
            action: "Click",
            onElement: "SearchButton",
            locator: "Id"
        }
    ]
};

Java

ActionRule actionRule = new ActionRule()
        .setAction("Condition")
        .setArgument("{{$ --count --ne:1}}")
        .setOnElement("//tr[./td[@id]]")
        .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 //tr[./td[@id]] elements count match \d{1}.

Action Rule (JSON)

{
    "action": "Condition",
    "argument": "{{$ --count --match:\\d{1}}}",
    "onElement": "//tr[./td[@id]]",
    "actions": [
        {
            "action": "SendKeys",
            "argument": "Carson",
            "onElement": "SearchString",
            "locator": "Id"
        },
        {
            "action": "Click",
            "onElement": "SearchButton",
            "locator": "Id"
        }
    ]
}

Rhino Literal

condition {{$ --count --match:\d{1}}} on {//tr[./td[@id]]}
    > type {Carson} into {SearchString} using {id}
    > click on {SearchButton} using {id}

CSharp

var actionRule = new ActionRule
{
    Action = PluginsList.Condition,
    Argument = "{{$ --count --match:\\d{1}}}",
    OnElement = "//tr[./td[@id]]",
    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": "{{$ --count --match:\\d{1}}}",
    "onElement": "//tr[./td[@id]]",
    "actions": [
        {
            "action": "SendKeys",
            "argument": "Carson",
            "onElement": "SearchString",
            "locator": "Id"
        },
        {
            "action": "Click",
            "onElement": "SearchButton",
            "locator": "Id"
        }
    ]
}

Java Script

var actionRule = {
    action: "Condition",
    argument: "{{$ --count --match:\\d{1}}}",
    onElement: "//tr[./td[@id]]",
    actions: [
        {
            action: "SendKeys",
            argument: "Carson",
            onElement: "SearchString",
            locator: "Id"
        },
        {
            action: "Click",
            onElement: "SearchButton",
            locator: "Id"
        }
    ]
};

Java

ActionRule actionRule = new ActionRule()
        .setAction("Condition")
        .setArgument("{{$ --count --match:\\d{1}}}")
        .setOnElement("//tr[./td[@id]]")
        .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 //tr[./td[@id]] elements count not match \d{2}.

Action Rule (JSON)

{
    "action": "Condition",
    "argument": "{{$ --count --not_match:\\d{2}}}",
    "onElement": "//tr[./td[@id]]",
    "actions": [
        {
            "action": "SendKeys",
            "argument": "Carson",
            "onElement": "SearchString",
            "locator": "Id"
        },
        {
            "action": "Click",
            "onElement": "SearchButton",
            "locator": "Id"
        }
    ]
}

Rhino Literal

condition {{$ --count --not_match:\d{2}}} on {//tr[./td[@id]]}
    > type {Carson} into {SearchString} using {id}
    > click on {SearchButton} using {id}

CSharp

var actionRule = new ActionRule
{
    Action = PluginsList.Condition,
    Argument = "{{$ --count --not_match:\\d{2}}}",
    OnElement = "//tr[./td[@id]]",
    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": "{{$ --count --not_match:\\d{2}}}",
    "onElement": "//tr[./td[@id]]",
    "actions": [
        {
            "action": "SendKeys",
            "argument": "Carson",
            "onElement": "SearchString",
            "locator": "Id"
        },
        {
            "action": "Click",
            "onElement": "SearchButton",
            "locator": "Id"
        }
    ]
}

Java Script

var actionRule = {
    action: "Condition",
    argument: "{{$ --count --not_match:\\d{2}}}",
    onElement: "//tr[./td[@id]]",
    actions: [
        {
            action: "SendKeys",
            argument: "Carson",
            onElement: "SearchString",
            locator: "Id"
        },
        {
            action: "Click",
            onElement: "SearchButton",
            locator: "Id"
        }
    ]
};

Java

ActionRule actionRule = new ActionRule()
        .setAction("Condition")
        .setArgument("{{$ --count --not_match:\\d{2}}}")
        .setOnElement("//tr[./td[@id]]")
        .setActions(
            new ActionRule()
                    .setAction("SendKeys")
                    .setArgument("Carson")
                    .setOnElement("SearchString")
                    .setLocator("Id"),
            new ActionRule()
                    .setAction("Click")
                    .setOnElement("SearchButton")
                    .setLocator("Id"));

Example no. 5

Can be tested on

Executes nested actions if //tr[./td[@id]] elements count greater than 1.

Action Rule (JSON)

{
    "action": "Condition",
    "argument": "{{$ --count --gt:1}}",
    "onElement": "//tr[./td[@id]]",
    "actions": [
        {
            "action": "SendKeys",
            "argument": "Carson",
            "onElement": "SearchString",
            "locator": "Id"
        },
        {
            "action": "Click",
            "onElement": "SearchButton",
            "locator": "Id"
        }
    ]
}

Rhino Literal

condition {{$ --count --gt:1}} on {//tr[./td[@id]]}
    > type {Carson} into {SearchString} using {id}
    > click on {SearchButton} using {id}

CSharp

var actionRule = new ActionRule
{
    Action = PluginsList.Condition,
    Argument = "{{$ --count --gt:1}}",
    OnElement = "//tr[./td[@id]]",
    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": "{{$ --count --gt:1}}",
    "onElement": "//tr[./td[@id]]",
    "actions": [
        {
            "action": "SendKeys",
            "argument": "Carson",
            "onElement": "SearchString",
            "locator": "Id"
        },
        {
            "action": "Click",
            "onElement": "SearchButton",
            "locator": "Id"
        }
    ]
}

Java Script

var actionRule = {
    action: "Condition",
    argument: "{{$ --count --gt:1}}",
    onElement: "//tr[./td[@id]]",
    actions: [
        {
            action: "SendKeys",
            argument: "Carson",
            onElement: "SearchString",
            locator: "Id"
        },
        {
            action: "Click",
            onElement: "SearchButton",
            locator: "Id"
        }
    ]
};

Java

ActionRule actionRule = new ActionRule()
        .setAction("Condition")
        .setArgument("{{$ --count --gt:1}}")
        .setOnElement("//tr[./td[@id]]")
        .setActions(
            new ActionRule()
                    .setAction("SendKeys")
                    .setArgument("Carson")
                    .setOnElement("SearchString")
                    .setLocator("Id"),
            new ActionRule()
                    .setAction("Click")
                    .setOnElement("SearchButton")
                    .setLocator("Id"));

Example no. 6

Can be tested on

Executes nested actions if //tr[./td[@id]] elements count lower than 1000.

Action Rule (JSON)

{
    "action": "Condition",
    "argument": "{{$ --count --lt:1000}}",
    "onElement": "//tr[./td[@id]]",
    "actions": [
        {
            "action": "SendKeys",
            "argument": "Carson",
            "onElement": "SearchString",
            "locator": "Id"
        },
        {
            "action": "Click",
            "onElement": "SearchButton",
            "locator": "Id"
        }
    ]
}

Rhino Literal

condition {{$ --count --lt:1000}} on {//tr[./td[@id]]}
    > type {Carson} into {SearchString} using {id}
    > click on {SearchButton} using {id}

CSharp

var actionRule = new ActionRule
{
    Action = PluginsList.Condition,
    Argument = "{{$ --count --lt:1000}}",
    OnElement = "//tr[./td[@id]]",
    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": "{{$ --count --lt:1000}}",
    "onElement": "//tr[./td[@id]]",
    "actions": [
        {
            "action": "SendKeys",
            "argument": "Carson",
            "onElement": "SearchString",
            "locator": "Id"
        },
        {
            "action": "Click",
            "onElement": "SearchButton",
            "locator": "Id"
        }
    ]
}

Java Script

var actionRule = {
    action: "Condition",
    argument: "{{$ --count --lt:1000}}",
    onElement: "//tr[./td[@id]]",
    actions: [
        {
            action: "SendKeys",
            argument: "Carson",
            onElement: "SearchString",
            locator: "Id"
        },
        {
            action: "Click",
            onElement: "SearchButton",
            locator: "Id"
        }
    ]
};

Java

ActionRule actionRule = new ActionRule()
        .setAction("Condition")
        .setArgument("{{$ --count --lt:1000}}")
        .setOnElement("//tr[./td[@id]]")
        .setActions(
            new ActionRule()
                    .setAction("SendKeys")
                    .setArgument("Carson")
                    .setOnElement("SearchString")
                    .setLocator("Id"),
            new ActionRule()
                    .setAction("Click")
                    .setOnElement("SearchButton")
                    .setLocator("Id"));

Example no. 7

Can be tested on

Executes nested actions if //tr[./td[@id]] elements count greater or equal 1.

Action Rule (JSON)

{
    "action": "Condition",
    "argument": "{{$ --count --ge:1}}",
    "onElement": "//tr[./td[@id]]",
    "actions": [
        {
            "action": "SendKeys",
            "argument": "Carson",
            "onElement": "SearchString",
            "locator": "Id"
        },
        {
            "action": "Click",
            "onElement": "SearchButton",
            "locator": "Id"
        }
    ]
}

Rhino Literal

condition {{$ --count --ge:1}} on {//tr[./td[@id]]}
    > type {Carson} into {SearchString} using {id}
    > click on {SearchButton} using {id}

CSharp

var actionRule = new ActionRule
{
    Action = PluginsList.Condition,
    Argument = "{{$ --count --ge:1}}",
    OnElement = "//tr[./td[@id]]",
    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": "{{$ --count --ge:1}}",
    "onElement": "//tr[./td[@id]]",
    "actions": [
        {
            "action": "SendKeys",
            "argument": "Carson",
            "onElement": "SearchString",
            "locator": "Id"
        },
        {
            "action": "Click",
            "onElement": "SearchButton",
            "locator": "Id"
        }
    ]
}

Java Script

var actionRule = {
    action: "Condition",
    argument: "{{$ --count --ge:1}}",
    onElement: "//tr[./td[@id]]",
    actions: [
        {
            action: "SendKeys",
            argument: "Carson",
            onElement: "SearchString",
            locator: "Id"
        },
        {
            action: "Click",
            onElement: "SearchButton",
            locator: "Id"
        }
    ]
};

Java

ActionRule actionRule = new ActionRule()
        .setAction("Condition")
        .setArgument("{{$ --count --ge:1}}")
        .setOnElement("//tr[./td[@id]]")
        .setActions(
            new ActionRule()
                    .setAction("SendKeys")
                    .setArgument("Carson")
                    .setOnElement("SearchString")
                    .setLocator("Id"),
            new ActionRule()
                    .setAction("Click")
                    .setOnElement("SearchButton")
                    .setLocator("Id"));

Example no. 8

Can be tested on

Executes nested actions if //tr[./td[@id]] elements count lower or equal 1000.

Action Rule (JSON)

{
    "action": "Condition",
    "argument": "{{$ --count --le:1000}}",
    "onElement": "//tr[./td[@id]]",
    "actions": [
        {
            "action": "SendKeys",
            "argument": "Carson",
            "onElement": "SearchString",
            "locator": "Id"
        },
        {
            "action": "Click",
            "onElement": "SearchButton",
            "locator": "Id"
        }
    ]
}

Rhino Literal

condition {{$ --count --le:1000}} on {//tr[./td[@id]]}
    > type {Carson} into {SearchString} using {id}
    > click on {SearchButton} using {id}

CSharp

var actionRule = new ActionRule
{
    Action = PluginsList.Condition,
    Argument = "{{$ --count --le:1000}}",
    OnElement = "//tr[./td[@id]]",
    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": "{{$ --count --le:1000}}",
    "onElement": "//tr[./td[@id]]",
    "actions": [
        {
            "action": "SendKeys",
            "argument": "Carson",
            "onElement": "SearchString",
            "locator": "Id"
        },
        {
            "action": "Click",
            "onElement": "SearchButton",
            "locator": "Id"
        }
    ]
}

Java Script

var actionRule = {
    action: "Condition",
    argument: "{{$ --count --le:1000}}",
    onElement: "//tr[./td[@id]]",
    actions: [
        {
            action: "SendKeys",
            argument: "Carson",
            onElement: "SearchString",
            locator: "Id"
        },
        {
            action: "Click",
            onElement: "SearchButton",
            locator: "Id"
        }
    ]
};

Java

ActionRule actionRule = new ActionRule()
        .setAction("Condition")
        .setArgument("{{$ --count --le:1000}}")
        .setOnElement("//tr[./td[@id]]")
        .setActions(
            new ActionRule()
                    .setAction("SendKeys")
                    .setArgument("Carson")
                    .setOnElement("SearchString")
                    .setLocator("Id"),
            new ActionRule()
                    .setAction("Click")
                    .setOnElement("SearchButton")
                    .setLocator("Id"));

Examples: disabled

Example no. 1

Can be tested on

Executes nested actions if <input id="input_disabled"> element is disabled.

Action Rule (JSON)

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

Rhino Literal

condition {{$ --disabled}} on {input_disabled} using {id}
    > type {20} into {number_of_alerts} using {id}

CSharp

var actionRule = new ActionRule
{
    Action = PluginsList.Condition,
    Argument = "argument": "{{$ --disabled}}",
    OnElement = "input_disabled",
    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": "{{$ --disabled}}",
    "onElement": "input_disabled",
    "locator": "Id"
    "actions": [
        {
            "action": "SendKeys",
            "argument": "20",
            "onElement": "number_of_alerts",
            "locator": "Id"
        }
    ]
}

Java Script

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

Java

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

Clone this wiki locally