Documentation Index
Fetch the complete documentation index at: https://docs.testdriver.ai/llms.txt
Use this file to discover all available pages before exploring further.
Overview
TestDriver SDK - Parse Test (Vitest) Opens Airbnb and runs the .parse() SDK command to analyze the screen.
Review the source code below to understand the implementation details and patterns used.
Live Test Run
Watch this test execute in a real sandbox environment:
Source Code
/**
* TestDriver SDK - Parse Test (Vitest)
* Opens Airbnb and runs the .parse() SDK command to analyze the screen.
*/
import { describe, it } from "vitest";
import { TestDriver } from "testdriverai/vitest/hooks";
describe("Parse Test", () => {
it("should open Airbnb and parse the screen", async (context) => {
const testdriver = TestDriver(context, { ip: context.ip || process.env.TD_IP});
await testdriver.provision.chrome({ url: "https://www.airbnb.com" });
// The SDK automatically outputs elements as a formatted table
const result = await testdriver.parse();
console.log(`Found ${result.elements?.length || 0} elements`);
});
});
Running This Example
# Clone the TestDriver repository
git clone https://github.com/testdriverai/testdriverai
# Install dependencies
cd testdriverai
npm install
# Run this specific example
npx vitest run examples/parse.test.mjs
Make sure you have TD_API_KEY set in your environment. Get one at testdriver.ai.