GPT Driver User Guide
GPT Driver SDK
GPT Driver SDK
  • 👋Welcome
  • Overview
    • 💡Why GPTD
    • SDKs
      • Prerequisites
      • Python
        • Setup
        • Examples
        • Reference
      • Typescript
        • Setup
        • Examples
        • Reference
      • Java
        • Setup
        • Examples
          • GPT Driver + TestNG
          • GPTD + Lambdatest
          • GPTD + SauceLabs
          • GPT Driver + BrowserStack
        • Reference
        • Use within Android
      • Android Native (Java/Kotlin)
        • Setup
        • Example
        • Reference
      • Swift
        • Setup
        • Usage
Powered by GitBook
On this page
  • execute
  • assert
  • assertBulk
  • checkBulk
  • extract
  1. Overview
  2. SDKs
  3. Python

Reference

execute

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(f"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([
    f"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 assertResults = gd.assertBulk([
    f"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 informationn from a screen
flightInformation = gd.extract([
    "departureAirportCode",
    "destinationAirportCode",
    "departureTime",
    "destinationTime",
    "travelTime"
])

# which can later be used in assertions
gd.assertBulk([
    f"departue airport is ${flightInformation[departureAirportCode]}",
    f"detination airport is ${flightInformation[destinationAirportCode]}"
])
PreviousExamplesNextTypescript

Last updated 9 months ago