UNPKG

1.84 kBTypeScriptView Raw
1import { Client, Command, ChromelessOptions, Headers, Cookie, CookieQuery, PdfOptions, ScreenshotOptions } from '../types';
2export default class LocalRuntime {
3 private client;
4 private chromelessOptions;
5 private userAgentValue;
6 constructor(client: Client, chromelessOptions: ChromelessOptions);
7 run(command: Command): Promise<any>;
8 private goto(url, waitTimeout?);
9 private clearCache();
10 private clearStorage(origin, storageTypes);
11 private setUserAgent(useragent);
12 private waitTimeout(timeout);
13 private waitSelector(selector, waitTimeout?);
14 private click(selector);
15 private returnCode<T>(fn, ...args);
16 private scrollTo<T>(x, y);
17 private scrollToElement<T>(selector);
18 private mousedown(selector);
19 private mouseup(selector);
20 private setHtml(html);
21 private focus(selector);
22 type(text: string, selector?: string): Promise<void>;
23 cookies(nameOrQuery?: string | CookieQuery): Promise<Cookie[]>;
24 allCookies(): Promise<Cookie[]>;
25 setExtraHTTPHeaders(headers: Headers): Promise<void>;
26 setCookies(nameOrCookies: string | Cookie | Cookie[], value?: string): Promise<void>;
27 deleteCookies(name: string, url: string): Promise<void>;
28 clearCookies(): Promise<void>;
29 press(keyCode: number, count?: number, modifiers?: any): Promise<void>;
30 returnExists(selector: string): Promise<boolean>;
31 returnInputValue(selector: string): Promise<string>;
32 returnScreenshot(selector?: string, options?: ScreenshotOptions): Promise<string>;
33 returnHtml(): Promise<string>;
34 returnHtmlUrl(options?: {
35 filePath?: string;
36 }): Promise<string>;
37 returnPdf(options?: PdfOptions): Promise<string>;
38 clearInput(selector: string): Promise<void>;
39 setFileInput(selector: string, files: string[]): Promise<void>;
40 private log(msg);
41}