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
  1. Overview
  2. SDKs
  3. Typescript

Examples

Simple example

const GptDriver = require("gpt-driver-node");
const { remote } = require("webdriverio");

const localAndroidCapabilities = {
    platformName: 'Android',
    'appium:automationName': 'UiAutomator2',
};

const wdOpts = {
    hostname: process.env.APPIUM_HOST || 'localhost',
    port: parseInt(process.env.APPIUM_PORT, 10) || 4723,
    logLevel: 'info',
    capabilities: localAndroidCapabilities,
};

const localAppiumServerUrl = 'http://127.0.0.1:4723'

const gptDriverApiKey = "..."

const testing = async () => {

    const driver = await remote(wdOpts);

    const gptDriver = new GptDriver({
        apiKey: gptDriverApiKey,
        driver,
        serverConfig: {
            url: localAppiumServerUrl,
        }
    });

    await gptDriver.startSession();


    await gptDriver.execute("tap on youtube")

    await gptDriver.assert("the youtube app is open")


    await gptDriver.stopSession("success")
    
}

testing();
PreviousSetupNextReference

Last updated 9 months ago