Will execute a given natural language instruction. Please refer to our Prompt Guide for best practices.
// simple instructions
gd.execute("tap on the login button");
// more abstract instructions
gd.execute("Navigate to the settings screen");
// complex instructions
gd.execute("Check that you see a list of hotel room options, if so tap on the cheapest room option");
assert
Verify something without taking any action. The function will pass or throw an error
gd.assert(`The total price is ${price}`);
assertBulk
Check multiple conditions are met in one go. The function will throw an error if any of the assertions is not true.
gd.assertBulk([
`The total price is ${price}`,
"The VAT is calculated correctly",
"The delivery date is shown in the format dd.mm.YYYY"
]);
checkBulk
Check multiple conditions are met in one go. The function will return a object with true and false values for each conditions.
const checkResults = gd.checkBulk([
`The total price is ${price}`,
"The VAT is calculated correctly",
"The delivery date is shown in the format dd.mm.YYYY"
]);
extract
Extract information from current screen. Returns an object with the extracted values.
// Example to extract flight information from a screen.
const flightInformation = gd.extract([
"departureAirportCode",
"destinationAirportCode",
"departureTime",
"destinationTime",
"travelTime"
]);
// Which can later be used in assertions.
gd.assertBulk([
`departure airport is ${flightInformation['departureAirportCode']}`,
`destination airport is ${flightInformation['destinationAirportCode']}`
]);