UNPKG

@eko-ai/eko-nodejs

Version:

Empowering language to transform human words into action.

96 lines 3.37 kB
import { AgentContext, BaseBrowserLabelsAgent } from "@eko-ai/eko"; import { Page, Browser, BrowserContext } from "playwright"; type PageInfo = { tabId: number; lastAccessed: number; }; export declare class BrowserAgent extends BaseBrowserLabelsAgent { private cdpWsEndpoint?; private userDataDir?; private options?; private cookies?; protected browser: Browser | null; private browserContext; private activePage; private headless; private pageMap; protected lastSwitchedPage: Page | null; setHeadless(headless: boolean): void; setCdpWsEndpoint(cdpWsEndpoint: string): void; initUserDataDir(userDataDir: string): string | undefined; setCookies(cookies: Array<{ name: string; value: string; url?: string; domain?: string; path?: string; expires?: number; httpOnly?: boolean; }>): void; setOptions(options?: Record<string, any>): void; protected screenshot(agentContext: AgentContext): Promise<{ imageBase64: string; imageType: "image/jpeg" | "image/png"; }>; protected navigate_to(agentContext: AgentContext, url: string): Promise<{ url: string; title?: string; tabId?: number; }>; loadTabs(): Promise<{ tabId: number; url: string; title: string; lastAccessed?: number; active: boolean; }[]>; getPageMap(): Map<Page, PageInfo>; protected get_all_tabs(agentContext?: AgentContext): Promise<Array<{ tabId: number; url: string; title: string; lastAccessed?: number; active: boolean; }>>; protected switch_tab(agentContext: AgentContext, tabId: number): Promise<{ tabId: number; url: string; title: string; }>; protected input_text(agentContext: AgentContext, index: number, text: string, enter: boolean): Promise<any>; protected click_element(agentContext: AgentContext, index: number, num_clicks: number, button: "left" | "right" | "middle"): Promise<any>; protected hover_to_element(agentContext: AgentContext, index: number): Promise<void>; protected execute_script(agentContext: AgentContext, func: (...args: any[]) => void, args: any[]): Promise<any>; private open_url; protected currentPage(): Promise<Page>; private get_element; protected go_back(agentContext: AgentContext): Promise<void>; private sleep; getBrowserContext(): Promise<BrowserContext>; private autoLoadCookies; private autoLoadLocalStorage; protected loadCookiesWithUrl(url: string): Promise<Array<{ name: string; value: string; url?: string; domain?: string; path?: string; expires?: number; httpOnly?: boolean; secure?: boolean; sameSite?: "Strict" | "Lax" | "None"; partitionKey?: string; }>>; protected loadLocalStorageWithUrl(url: string): Promise<Record<string, string>>; protected getChromiumArgs(): string[]; protected getUserAgent(): string | undefined; protected initScript(): Promise<{ path?: string; content?: string; }>; getBrowser(): Promise<Browser | null>; getActivePage(): Promise<Page | null>; close(): Promise<void>; } export default BrowserAgent; //# sourceMappingURL=browser.d.ts.map