simplex-ts
v1.0.5
Published
A TypeScript package for the Simplex API
Downloads
332
Readme
Simplex TypeScript
A TypeScript package for interacting with the Simplex API, providing a clean and type-safe interface for browser automation and web interaction.
Installation
npm install simplex-ts
Usage
import { Simplex } from 'simplex-ts';
// Initialize with your API key
const simplex = new Simplex('your-api-key');
// Create a session
const [sessionId, livestreamUrl] = await simplex.createSession();
// Navigate to a URL
await simplex.goto('https://example.com');
// Click elements
await simplex.click('button with text "Submit"');
// Type text
await simplex.type('Hello, World!');
// Extract text
const text = await simplex.extractText('element with text');
// Close the session when done
await simplex.closeSession();
Features
- Type-safe API interactions
- Browser automation capabilities
- Element interaction (click, type, scroll)
- Text and image extraction
- File upload/download support
- Session management
- Live streaming support
API Reference
Constructor
constructor(apiKey: string)
Methods
createSession
createSession(
showInConsole?: boolean,
proxies?: boolean,
workflowName?: string,
sessionData?: SessionData | string
): Promise<[string, string]>
goto
goto(url: string, cdpUrl?: string): Promise<void>
click
click(elementDescription: string, cdpUrl?: string): Promise<string>
type
type(text: string, cdpUrl?: string): Promise<void>
extractText
extractText(elementDescription: string, cdpUrl?: string): Promise<string>
extractImage
extractImage(elementDescription: string, cdpUrl?: string): Promise<string>
closeSession
closeSession(): Promise<void>
License
MIT