-
Notifications
You must be signed in to change notification settings - Fork 1
Variables
In Builder, you can store information from the pages the script navigates to in variables for later use. For example, if you want to compare the title of a document with the content of a particular element, you can get the text of that element, store it in a variable, and then use it to assert or verify against the title:
You can use any of the store steps, such as storeText or storeTitle, to store a value in a variable.
In step parameters, expressions of the form ${varname} will be replaced with the content of the variable varname. For example, if the content of the variable title is Home, the expression My ${title} becomes My Home during playback.
This also works with exporting the script to a specific programming language: the generated code uses the variables syntax of that language. For example, in Java, the above example exports to:
String title = wd.findElement(By.cssSelector("h2")).getText();
if (!wd.getTitle().equals(title)) {
System.out.println("verifyTitle failed");
}