Keywords
Keywords without Variable
To add a keyword without a variable in the Herbie extension, follow these steps:
-
Navigate to the Keywords tab in the Herbie extension.
-
In the Enter keyword field, type your desired keyword, e.g.,
SubmitButton
. -
In the Enter XPath field, type the XPath of the element, e.g.,
//button[@id='submit']
. -
Leave the Has Variable checkbox unchecked.
-
Click the Add Keyword button to save the keyword.
-
The keyword will now appear under the Global Keywords section.
-
To use the added keyword in your Herbie script, navigate back to the Herbie tab and type the following:
click on 'SubmitButton'
This will simulate a click action on the element specified by the XPath in the keyword.
Keywords with Variable
To add a keyword with a variable in the Herbie extension, follow these steps:
-
Navigate to the Keywords tab in the Herbie extension.
-
In the Enter keyword field, type your desired keyword, e.g.,
DynamicLink
. -
In the Enter XPath field, type the XPath of the element with a variable, e.g.,
//a[contains(text(),"{$}")]
. -
Check the Has Variable checkbox to indicate that this XPath contains a variable.
-
Click the Add Keyword button to save the keyword.
-
The keyword will now appear under the Global Keywords section.
-
To use the added keyword in your Herbie script, navigate back to the Herbie tab and type the following:
click on "Click me" 'DynamicLink'
This will replace the variable in the XPath with "Click me" and simulate a click action on the matching element.