UNPKG

anchorbrowser

Version:

The official TypeScript library for the Anchorbrowser API

20 lines 894 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Browser = void 0; const browser_1 = require("../lib/browser.js"); const resource_1 = require("../core/resource.js"); class Browser extends resource_1.APIResource { connect(sessionId) { return (0, browser_1.getPlaywrightChromiumFromCdpUrl)(this._client.baseURL, sessionId, this._client.apiKey); } async create({ sessionOptions } = {}) { const session = await this._client.sessions.create(sessionOptions); if (!session.data?.id) { throw new Error('Failed to create session: No session ID returned'); } const playwrightBrowser = await (0, browser_1.getPlaywrightChromiumFromCdpUrl)(this._client.baseURL, session.data?.id, this._client.apiKey); return playwrightBrowser; } } exports.Browser = Browser; //# sourceMappingURL=browser.js.map