incogniton
v1.0.17
Published
TypeScript-supported JS client library for the Incogniton API, featuring browser automation capabilities
Readme
Incogniton Typescript SDK
The official JavaScript / TypeScript SDK for interacting with the Incogniton Antidetect Browser API and browser automation capabilities, including Playwright, Puppeteer, and Selenium. Visit our official website to learn more about Incogniton.
Overview
The Incogniton Browser Client provides two main components:
API Client: A robust interface for interacting with Incogniton's REST API, allowing you to manage browser profiles, cookies, and automation tasks programmatically.
Browser Automation: A powerful browser automation module that integrates with Puppeteer, enabling you to launch and control Incogniton browser instances with custom profiles.
Features
The Incogniton package contains two modules:
API Client
- Profile Management: Create, update, and manage browser profiles
- Cookie Management: Add, update, and manage cookies for profiles
- Automation Control: Launch and control browser instances
- Comprehensive TypeScript support with full type definitions
Browser Automation
- Seamless integration with Puppeteer
- Profile-based browser launching
- Headless mode support
- Custom browser arguments support
- Robust error handling and logging
Installation
npm install incogniton
# or
yarn add incognitonUsage
Before using the Incogniton API Client or Browser Automation, ensure that the Incogniton desktop app is running (open) locally. The client relies on the Incogniton app to manage profiles and perform browser automation tasks.
API Client
import { IncognitonClient } from 'incogniton';
const client = new IncognitonClient();
// Create a new browser profile
const profile = await client.profile.add({
profileData: {
name: 'MY PROFILE',
// ...
},
});
// Get all profiles
const profiles = await client.profile.list();
// Get a specific profile
const profileDetails = await client.profile.get('PROFILE_ID');Browser Automation
import { IncognitonBrowser } from 'incogniton';
const browser = new IncognitonBrowser({
profileId: 'your-profile-id',
headless: false,
});
// --- Puppeteer Example ---
// Launch a browser instance with Puppeteer
const puppeteerInstance = await browser.startPuppeteer();
const puppeteerPage = await puppeteerInstance.newPage();
await puppeteerPage.goto('https://example.com', { waitUntil: 'networkidle0' });
const puppeteerScreenshotBuffer = await puppeteerPage.screenshot({ path: 'example-screenshot.png' });
await browser.close(puppeteerInstance);
// --- Playwright Example ---
// Launch a browser instance with Playwright
const playwrightInstance = await browser.startPlaywright();
const playwrightPage = await playwrightInstance.newPage();
await playwrightPage.goto('https://example.com', { waitUntil: 'load' });
const playwrightScreenshotBuffer = await playwrightPage.screenshot({ path: 'example-screenshot.png' });
await browser.close(playwrightInstance);Configuration
API Client Configuration
port: Port number for the Incogniton instance (default: 35000)baseUrl: Base URL for API requests (default: http://localhost:${port})
Browser Configuration
profileId: The ID of the profile to useheadless: Whether to launch in headless mode (default: false)customArgs: Custom command-line arguments for the browserlaunchTimeout: Time to wait for browser launch in milliseconds (default: 60000)
Development
Prerequisites
- Node.js (v14 or higher)
- TypeScript (v4 or higher)
- Incogniton desktop application running locally
Setup
- Clone the repository
- Install dependencies:
npm install # or yarn install
Building
npm run build
# or
yarn buildTesting
npm test
# or
yarn testContributing
We welcome contributions! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Support
For help or technical support, please reach out to [email protected] or visit Incogniton support.
