Gherkin Syntax

Mesmer Gherkin Documentation

Gherkin is Mesmer's domain-specific language for expressing things you can do to an app.
Our dialect of Gherkin has a syntax that looks a lot like plain English, but has a structure that's more similar to a LISP-family programming language. This lets you write app actions easily, but gives you the flexibility to write more complicated functionality if you need to.
You can attach a Gherkin snippet to any step of a Mesmer test. When test execution reaches some Gherkin, our bots will run exactly what you've written against the current state of the device. Your instructions can call on all of the data that the bots use to run tests---anything from system DOM attributes, to AI-powered element categorization and text recognition.

Overview

Before we dig into the details, let's go over the general structure of a Gherkin test. Each test has a few coarse parts, which fit together to form the test:
Snippets wrap and organize the Steps of a test. Each Step is either an Action (performing a physical effect on the device) or an Assertion (evaluating to a pass/fail condition).
Each Step is built out of various combinations of three main parts:
    Selectors, which evaluate to a flat list of elements (like buttons, checkboxes, or layouts),
    Conditions, which evaluate to a boolean true or false, and
    Values, which evaluate to a string of text.
When you write Gherkin, you compose Selectors, Conditions, and Values together, in order to precisely encode the intent of your test.
If we diagram out a few simple examples, you can see how the pieces fit together:
1
When I tap the first "OK" button
2
# ^ Implicit Selector : all elements on the screen
3
# ------ Selector : all buttons
4
# ---- Value : the string "OK"
5
# ----------- Selector : all buttons with "OK" text
6
# --------------------- Selector : first among all ok buttons
7
# --------------------------- Action : tap that button
8
# -------------------------------- Step : gherkin 'When' clause
9
10
Then I check the first list item is actionable
11
# ^ Implicit Selector : all elements on the screen
12
# --------- Selector : all list-item elements
13
# ------------------- Selector : ordinal, just the first list-item
14
# ---------- ConditionAttr : elements that are actionable
15
# --------------------------------- Condition : we can tap the first list-item on the screen
16
# ----------------------------------------- Assertion : evaluate to a pass/fail condition
17
# ---------------------------------------------- Step : gherkin 'Then' clause
Copied!

Snippet

A snippet is a freestanding list of test steps.
Snippets are exposed as a parser entry point.
For example:
1
When a context $main-list is the first list
2
Then check that the context <main-list> contains an enabled button "Edit"
3
Then check that we see a list item in the context of $main-list
4
When we click the enabled button "Edit" in the context of the $main-list
5
And we click the "Done" button
6
Then we see "Edited" in the $main-list
Copied!

Step

A step is an element of a Snippet or Test.
A test step has two variants: either a Action, or an Assertion. In Gherkin, the Given and When directives map to Actions, while the Then directives map to Assertions. For instance, in a test snippet:
1
# Parsed as an Action
2
Given I go to "settings" > "network"
3
When I tap the button
4
And I tap the second list
5
6
# Parsed as an Assertion
7
Then I see a check
8
And I see "OK"
Copied!

Action

An action is an expression which represents a side effect: either performed directly on a device (tap the first button) or performed on the execution context (the context <list> is the first list).

Tap Action

Issue a tap on the first element in the given selector. A tap action is invalid if the selector returns more than one element.
1
I tap on <selector>
2
tap <selector>
3
click on <selector>
4
we press <selector>
5
I select <selector>
Copied!

Long Tap Action

Issue a long-tap on the first element in the given selector. A long-tap action is invalid if the selector returns more than one element.
1
I long tap <selector>
2
I long press on <selector>
3
tap-and-hold <selector>
4
we tap-hold <selector>
Copied!

Swipe Action

Issue a swipe, starting at the center of a given element onscreen, and traveling at the given angle and length.\
1
# Directional swipes, starting from the center of the screen
2
# (note: you can use 'drag' and 'swipe' interchangably)
3
swipe down
4
swipe up
5
drag left
6
drag right
7
8
# Other swipe directions
9
swipe north
10
swipe east
11
swipe south
12
swipe west
13
14
# Precise angle specification, in degrees north of east
15
swipe at 30 degrees
16
swipe at 270deg
17
18
# Start at an element
19
swipe down on the first button
20
swipe the list-item left
21
22
# Swipe distance, in px
23
drag the list item down 100px
24
swipe left 300px
25
26
# Swipe distance, in percent of element dimension
27
drag the text left 50%
28
29
# Everything all together
30
# (order is interchangable)
31
swipe $el by 300px at 20 degrees
32
swipe down 300px on the first button
Copied!

Type Action

Type the given text into the first element matching the given selector. A type action is invalid if the selector returns more than one element, or if the element it returns is not editable.
1
type "some text" into the first editable
2
enter $value in $element
3
input $value in to $element
4
5
# You can use dynamic values here
6
enter the first button's content description into the editable
Copied!
In sequence, issue a tap on the first element of each selector in the sequence, waiting for the screen to advance between each interaction. Invalid if any selector returns more than one element.
1
Go to <selector-1> > <more-selectors> > <selector-n>
2
We go to "Settings" > "Network" > "WiFi"
3
Open "Facebook" > search icon
4
Navigate to "Chrome" > settings icon
5
go "Options" | "Privacy"
Copied!

Wait-Until Action

Pause execution, continuing only when the given condition evaluates to True.
1
wait until button is visible
2
wait until $context contains a list item
3
wait until either a success message is visible or we see "OK"
Copied!

Set Context Action

Evaluate the given selector, and store it in the execution context with the given name. Later on, you can reference a context with its name, using the $bash-identifier-style or the <gherkin-identifier-style> interchangably.
1
The context <identifier-name> is <selector>
2
The context $first-list is the first list
3
context $cart is the first list containing "Shopping Cart"
Copied!

Set Condition Action

Store the given condition, unevaluated, in the execution context, with the given name. Later on, you can reference a condition with its name, using the $bash-identifier-style or the <gherkin-identifier-style> interchangably.
Conditions can contain a special selector called It (or the element). The It selector functions as a parameter to the condition: when found inside a condition selector, different elements will be repeatedly substituted for the value of It. The condition selector will evaluate to the list of elements where the condition evaluated to True.
1
The condition <identifier> is <condition>
2
The condition $listy is that either the element is a list or the element contains a list item
3
condition $useful is that the first list contains it
4
condition $always-true is that either true or both false and true
Copied!

Set Value Action

Store the given value expression in the execution context, with the given name. Later on, you can reference a value with its name, using the $bash-identifier-style or <gherkin-identifier-style> interchangably.
1
the value <identifier> is <value>
2
the value $first-name is the text on the first label in the context of <user-profile>
3
value $literal is "Some string literal"
Copied!

Script Action

This action will run an execution script. The exact scripting API is implementation-defined. Scripts take the form of fenced code snippets (like Markdown), with a language name matching [A-z0-9._\-]+ (alphanumeric, plus _ - .).
Code snippets must have a valid opening and closing fence.
1
# Scripts are fenced by three backticks
2
```js
3
console.log("executed by an implementation-defuned scripting engine")
4
```
5
6
# You can interleave code snippets with other test steps
7
When I tap "login"
8
```lua.execution-v23
9
action("do something that displays a button")
10
```
11
Then I see button
Copied!

Back Action

Perform a back action: on Android, a back-button press; and on iOS, finding a back button onscreen and tapping it.
1
go back
2
navigate back
Copied!

Relaunch Action

Relaunch the app.
1
relaunch the app
2
reload the application
3
reopen app
Copied!

Sign In Action

Sign in to the app. This action uses test data and heuristics to "do the right thing."
1
sign in to the app
2
Log in
3
login to the application
Copied!

Assertion

Condition Assertion

Passes iff the given condition evaluates to true without error.
1
<any-condition>
2
true
3
false
4
we see a button
Copied!

Snapshot Assertion

Passes iff the selected element visually matches itself from a prior ('baseline') test run. Invalid if multiple elements match the selector.
1
snapshots match # match the entire screen
2
<selector> matches snapshots # match a specific element
3
the first list inside $general-context matches snapshots
Copied!

Selector

A selector is an expression that evaluates to a flat list of elements.
Every selector expression has a 'child selector', which it filters elements from. The only Selector which has no children is the All selector, which is special: it can only be specified implicitly, at the end of some input; and it will always evaluate to a flat list of every element on the screen.
Selectors 'map' across their children: so, for instance, the button "Go" will first get the list of all elements on the screen (using the All selector), then filter that list for elements containing "Go" (using the Text selector), then filter that list for elements that are buttons (using the Category selector).
Sometimes, a Selector will be used where we really only expect one element---for instance, in a tap action. In that case, evaluation will fail at runtime if the selector returns anything other than exactly one element: asserting implicitly that the selector only matches one element.

Position Selector

Returns every element from the given child selector overlapping the given screen coordinate.
1
Tap (100, 100)
2
Tap at (100,100)
3
4
5
Tap the button at (100, 100) in the <main-list>
6
# ^ All selector
7
# ------------------ Child selector (all elements in $main-list)
8
# -------------------------------- Position selector (anything overlapping (100,100))
9
# ------------------------------------------- Category selector (just the buttons)
Copied!

Text Selector

Returns every element from the given child selector with text content equal to the given string.
1
Tap "Go" # Find an element with text "Go", and tap it
2
Tap the button "Go" # Find a button with text "Go", and tap it.
3
Tap the first "Open" button # Find
4
5
Tap the list item containing "Continue"
6
# ^ All Selector
7
# ---------- Text Selector
8
# --------------------- Contains Selector (all elements containing that text element)
9
# ----------------------------------- Category Selector (...filtered by category = listitem)
Copied!

Category Selector

Returns every element from the given child selector matching the specified category.
1
Tap the button
2
Tap the checkbox
3
Tap the list item # or 'listitem'
4
Tap the text # or 'label'
5
Tap the radio button # or 'radiobutton', 'radio-button'
6
7
# Several icon names are supported
8
Tap the info icon # 'icon' is optional
9
Tap collapse right
10
Tap the 3-dot menu
11
Tap the location pointer
Copied!
The main categories, which you'll probably use most frequently, are:
    button
    list
    item, list item, list-item
    icon
    text
    image
    label
    radio button, radiobutton
    link
    checkbox
However, we support many more categories---listed below by type.
Screens - `advertisement` - `agreement` - `audio player` - `bottom sheet` - `camera` - `chat` - `checkout` - `contact us` - `dialpad` - `edit profile` - `faqs` - `forgot password` - `gift cards` - `hamburger open` - `home` - `item details` - `item list` - `loading` - `login landing` - `login` - `map details` - `map` - `notifications dropdown` - `onboarding` - `other form` - `other info` - `popup` - `review` - `rewards promotion trail` - `search droplist` - `search` - `signup` - `video player` - `web view`
Layouts - `address bar` - `advertisement region` - `android virtual menu` - `banner ads` - `bottom menu` - `bottom sheet region` - `breadcrumb` - `calendar` - `carrier status` - `chart region` - `collection view` - `data form` - `error message` - `hamburger open region` - `info message` - `item layout` - `keyboard` - `keypad` - `list item` - `list container` - `list header` - `login region` - `map region` - `map detail region` - `notification region` - `option list` - `popup region` - `search bar` - `success message` - `tab bar` - `table view` - `title bar` - `top menu`
Controls - `badge` - `burger menu` - `carousel swipe` - `checkbox` - `floating button` - `image` - `label` - `link` - `option item` - `picker wheel` - `progress bar` - `quantity` - `radio button` - `rating` - `scan code` - `select box` - `slider` - `switch button` - `text` - `toast notification` - `video`
Icons (referenced as "$name icon") - `360view` - `3 dot menu` - `add to list` - `add user` - `add` - `amazon` - `android beam` - `apple` - `arrow back` - `arrow down` - `arrow right` - `arrow up` - `attachment` - `battery` - `bicycle` - `binoculars` - `bluetooth` - `bookmark` - `book` - `briefcase` - `broadcast` - `burger` - `bus` - `calculator` - `calendar` - `call` - `camera` - `card` - `car` - `catering` - `check` - `chrome` - `clipboard` - `clock` - `coffee` - `coin` - `collapse down` - `collapse left` - `collapse right` - `collapse up` - `comments` - `compass` - `computer` - `copy clipboard` - `cross` - `dashboard` - `delete` - `deposit` - `devices` - `dine in` - `direction send` - `dislike` - `document` - `dollar sign` - `download` - `drive thru` - `dropbox` - `ebay` - `edit` - `email` - `emoji` - `engine` - `error` - `espn` - `expand` - `facebook` - `fast backward` - `fast forward` - `favorite` - `filter` - `fingerprint` - `firefox` - `flag` - `flash` - `flipboard` - `folder` - `font` - `fuel` - `game console` - `gdrive` - `gift` - `globe` - `gmail` - `google assistant` - `google map` - `google play` - `google translate` - `google` - `gplus` - `grid` - `group` - `hangouts` - `help` - `hideshow pwd` - `history` - `home` - `hourglass` - `icecream` - `info` - `instagram` - `item shipping` - `keyboard icon` - `keyhole` - `keypad icon` - `keys` - `library` - `like` - `list icon` - `loader` - `location crosshair` - `location pointer` - `lock` - `login` - `logout` - `map bank` - `map building` - `map cafe` - `map fuel` - `map home` - `map hospital` - `map hotel` - `map library` - `map others` - `map parking` - `map park` - `map pin` - `map point of interest` - `map restaurant` - `map school` - `map shopping` - `map vehicle` - `markup` - `mcdonalds` - `mic` - `minus` - `mobile` - `more` - `movies` - `music` - `newspaper` - `next` - `night mode` - `notification` - `opera` - `outdoor` - `parking` - `pause` - `photo` - `pick order` - `playlist` - `play` - `previous` - `printer` - `reload` - `restore` - `reward` - `samsung internet` - `save` - `scan code` - `search icon` - `services` - `settings` - `share` - `shield` - `shopping bag` - `shopping cart` - `shuffle` - `skype` - `sort` - `sound waves` - `speaker` - `spectacles` - `spotify` - `swap` - `tag` - `target` - `timeline` - `trending` - `twitter` - `unsubscribe` - `upload` - `user` - `video call` - `voice mail` - `volume` - `walk` - `weather` - `wifi direct` - `wifi` - `wikipedia` - `yahoo` - `youtube` - `zoom in` - `zoom out`
Buttons (referenced "$name button") - `accept` - `add cart` - `add` - `alert` - `allow` - `all` - `answer question` - `apply` - `ask question` - `back` - `browse` - `call` - `cancel` - `carryout` - `checkout` - `circle` - `clear` - `close` - `confirm` - `contact` - `continue` - `crash` - `customize` - `dashboard` - `delete` - `delivery` - `details` - `directions` - `discard` - `dismiss` - `done` - `download` - `edit` - `enable` - `end` - `facebook` - `favorites` - `filter` - `find` - `finish` - `following` - `follow` - `forgot` - `get` - `help` - `home` - `inbox` - `login` - `logout` - `menu` - `more` - `my location` - `next` - `no` - `ok` - `open` - `order` - `pause` - `pay` - `playlist` - `redeem` - `reload` - `reset` - `save` - `scan` - `search` - `see all` - `send` - `settings` - `share` - `show` - `signup` - `skip` - `sort` - `start` - `submit` - `subscribe` - `tab` - `text` - `update` - `verifyg` - `view` - `voice` - `write` - `yes`

Attribute Selector

Returns every element from the given child selector with the given attribute (or, if negated, where the given attribute is not present).
1
# Filtering by attributes
2
Tap the enabled button
3
Tap the scrollable list
4
# Tap the editable
5
6
# Negation
7
Tap the disabled button
8
Tap the non-scrollable list
9
# Tap the uneditable element
Copied!

Tag Selector

Returns every element from the given child selector tagged manually with the given tag.
1
I tap tagged "continue-button"
2
Tap matching the tag "some-useful-tag"
3
Long-press the button tagged as "continue"
4
5
Tap tagged "important" in the <main-list>
6
# ^ All selector
7
# --------------- Context selector (stored context)
8
# ------------------ Inside selector (everything in that context)
9
# ------------------------------------- Tag selector
Copied!

Ordinal Selector

Returns the 'nth' element found in the child selector.
1
Tap the first button
2
Tap the second list item
3
Tap the 999th checkbox
4
Tap the 123rd volume icon
Copied!

Union Selector

Returns a unique set of all elements from each child selector.
1
Tap the first either button or list item
2
3
Tap the first button either "ok" or in <important-area>
4
# ^ ^ All selectors
5
# ---------------- Context selector (stored)
6
# ------------------- Inside selector (everything in that context)
7
# ---- Text selector (all "OK")
8
# ---------------------------------- Union selector: everything labeled "OK" or in <important-area>
9
# ----------------------------------------------- Ordinal selector
Copied!

Inside selector

Returns every element that is a child of any element in the child selector.
1
Tap the first list item in the list
2
Tap the button in the list
3
Tap the instagram icon in context <social-menu>
Copied!

Outside selector

Returns every element that is a parent of any element of the child selector.
1
Tap the first list item containing "Next"
2
Tap the first button containing a settings icon
Copied!

Named Selector

Returns the elements in the context named by the given identifier. This value is taken from the execution context of the test, generally set with the Set Context action.
1
Tap <named-context>
2
Tap the first button in <named-context> # \
3
Tap the first button in $named-context # (equivalent)
Copied!

Contition Selector

Returns every element from the child selector that, when that element is substituted for all occurences of the It selector in the condition, causes the condition to evaluate to true.
1
Tap where <some-condition>
2
Tap the element where <some-other-condition>
3
Tap the first element where $some-important-predicate in <some-useful-context>
4
5
# Usage of the `It` selector: conditions with arguments
6
Tap the button where it is enabled
7
# -- It selector (argument, substituted as each element)
8
# ------------- Attribute condition (anything is enabled)
9
# ------------------- Condition selector (does the substituting)
10
# -------------------------- Category selector
11
12
# Nested conditions are forbidden: this won't compile.
13
# Tap the button where it contains where it contains "something-useless"
14
# If you need to form complex predicates like this, split them out into separate
15
# named contexts.
Copied!

All Selector

Returns every element on the screen. This selector doesn't have any syntax associated with it: it's automatically inserted at the end of any other selector expression (other than the It selector). The all selector functions as one of the AST's few leaf nodes.

It Selector

The It selector is similar to a named argument to a function. Elements are substituted into its place repeatedly by the Condition Selector in order to exaluate a predicate.

Value

A Value is a string-valued expression. You can get a Value either by specifying it literally ("Some Text"), or by extracting an element's attribute.
You can store Values in the execution context with the set value action.

Literal Value

You can specify Values as a literal string:
1
The value $str1 is "Some String"
2
# ------------- Literal Value
3
#------------------------------- Set Value Action
Copied!

Named Value

You can get a value from the execution context (either passed in to the test data, or set by a previous set value action):
1
The value $label is $some-other-value
2
3
Tap the button where its text is $label
4
# ------ Named Value
5
# ------------------ Attribute Condition
6
# ------------------------ Condition Selector
7
# ----------------------------------- Attribute Selector
Copied!

Attribute Value

You can use a text-valued attribute of any element as a Value with an Attribute Value, like so:
1
The value $btn-text is the text of the first button
2
The value $btn-category is the category of the first button
3
The value $btn-bounds is the bounds of the first button
4
5
# System DOM attributes for iOS
6
The value $label is the label attribute of the first button
7
The value $name is the first button's name
8
9
# System DOM attributes for Android
10
The value $frag-class is the fragment attr of the button
Copied!
The attributes supported are:
    text
    type
    bounds
    category
    subcategory, sub category, sub-category
    object id, objectid, object-id
    resource id, resource-id (System DOM, Android)
    fragment class, fragment-class, fragment (System DOM, Android)
    activity class, activity-class, activity (System DOM, Android)
    class name, classname, class-name, class (System DOM, Android, iOS)
    content description, content-description, content desc (System DOM, Android)
    label (System DOM, iOS)
    name (System DOM, iOS)
    value (System DOM, iOS)

Condition

A Condition is a boolean-valued expression: either true or false. Conditions are used for almost all assertions with a Gherkin Then expression. If a condition contains an It selector, it can be used as a predicate to filter elements.
Conditions can be stored symbolically in the execution context with the set condition action. Combined with the It selector, this lets you re-use important predicates throughout your test. The condition is re-eveluated whereever the named condition appears.

True Condition

The True condition always evaluates to true.
1
true
2
False
Copied!

False Condition

The False condition always evaluates to false.
1
false
2
False
Copied!

And Condition

The And condition performs a boolean AND between two child conditions.
Note the use of the both token: this makes sure that sequences of and, or, and not operations parse unambiguously.
1
both true and true # True
2
both true and false # False
3
both false and true # False
4
both false and false # False
Copied!

Or Condition

The Or condition performs a boolean OR between two child conditions.
Note the use of the either token: this makes sure that sequences of and, or, and not operations parse unambiguously.
1
either true or true # True
2
either true or false # True
3
either false or true # True
4
either false or false # False
Copied!

Not Condition

The Not condition performs a boolean NOT between two child conditions.
1
not true # False
2
not false # True
3
4
# Operator grouping with `both` and `either`
5
both either true or false and true
6
# -------------------- Or Condition
7
#--------------------------------- And Condition (true)
Copied!

Equals Condition

The Equals condition compares two child Values for equality, evaluating to the result of the comparison.
1
# Check for equality
2
$lhs is $rhs
3
$lhs equals $rhs
4
$lhs == $rhs
5
6
# Check for inequality
7
$lhs is not $rhs
8
$lhs isn't $rhs
9
$lhs does not equal $rhs
10
$lhs != $rhs
Copied!

Numeric Condition

The Numeric condition converts two child Values to numbers, and compares them, evaluating to true only if the condition holds.
1
# Numeric equals
2
# Note: to disambiguate with a text comparison, you need to specify
3
# that the comparison is 'numerically' or between 'number's.
4
check that the number $lhs equals $rhs
5
check that $lhs == $rhs numerically
6
check that $lhs mathematically equals $rhs
7
check that $lhs equals $rhs numerically
8
9
# Less than
10
check that $lhs < $rhs
11
check that $lhs < 3
12
check that $lhs is less than $rhs
13
14
# Less than or equal to
15
check that $lhs <= $rhs
16
check that $lhs is less than or equals $rhs
17
18
# Greater than or equal to
19
check that $lhs >= $rhs
20
check that $lhs is greater than or equals $rhs
21
22
# Greater than
23
check that $lhs > $rhs
24
check that $lhs > -2.123
25
check that $lhs is greater than $rhs
Copied!

Exists Condition

The Exists condition evaluates to true only if there is at least one element matching the child selector.
1
a button exists
2
I see a button
3
<some-context> exists
Copied!

Contains Condition

The Contains condition evaluates to true only if every element of the outer selecter contains, in turn, every element of the inner selector.
1
<some-context> contains a button
2
the list contains a button
3
the button contains text
Copied!

Category Condition

The Category condition evaluates to true only if every element in the child selector has the given category.
1
<some-element> is a button
2
3
I see where either it is a button or it is a list item
Copied!

Tag Condition

The Tag condition evaluates to true only if every element in the child selector has the given tag.
1
the button is tagged "some-button"
2
the button has tag "some-button"
3
the button matches the tag "some-button"
Copied!

Named Condition

The named condition evaluates to the contents of given identifier, stored in the execution context.
1
$some-named-condition
2
3
I see the button where $some-condition
Copied!
1
tap the list item where $list-item-is-important
Copied!

Attribute Condition

The attribute condition evaluates to true only if the given attribute of all the elements in the nested selector equals true; or, if negated, all equals false.
1
list item is enabled
2
checkbox is checked
3
checkbox is unchecked
4
checkbox is not checked
5
6
# System DOM attributes for iOS and Android
7
the text is focused
8
9
# System DOM attributes for Android
10
the button is clickable
11
the button isn't clickable
12
the button is checkable
13
the button is non-checkable
Copied!
1
tap the first checkbox where it is unchecked
2
# -- It selector
3
# --------------- Attribute condition (negated)
4
# --------------------- Condition selector
5
# ------------------------------ Category selector
6
# ------------------------------------ Ordinal selector
Copied!
The supported attributes are:
    actionable
    checked
    enabled
    editable
    scrollable
    visible
    focused (System DOM, Android, iOS)
    clickable (System DOM, Android)
    checkable (System DOM, Android)
The expression can be negated like so:
1
$item is not checked
2
$item is invisible
3
$item is disabled
4
$item is not enabled
5
$item is non-editable
Copied!
You can mix up the negation syntax: isn't, non-, un- and so on are compatible with each other.

Regex Condition

The regex condition evaluates to true if the given value matches a regular expression.
1
$val matches regex "some-regex"
2
$val matches the regular expression "some-regex"
3
$val matches regexp ".+"
4
5
the first button's text matches regex "(Buy|Get Started) Now"
Copied!

Match Condition

The match condition evaluates to true if some search text is found in another Value
The match condition can match:
    At the beginning of the body (a prefix)
    At the end of the body (a suffix)
    Anywhere in the body (contains text)
Additionally, it can be configured to match the text either case-sensitively, or case-insensitively.
Note that, to disambiguate the syntax from a contains condition, we require the contains text syntax. Otherwise, the left and right side could be wrongly interpreted as text selectors.
1
# Prefix
2
$body starts with $search
3
$body starts with $search ignoring case
4
5
# Suffix
6
$body ends with $search
7
$body ends with $search ignoring case
8
9
# Contains
10
$body contains text $search
11
$body contains text $search ignoring case
12
13
# Some other examples
14
the button's text starts with "Continue" ignoring case
15
the label's text ends with "stupendous"
16
"ABCDEFG" starts with the text of <alphabet-button>
Copied!
Last modified 1mo ago