import { Browser, BrowserContext, Page } from 'playwright';
export declare class GracefulPage {
    options: {
        from: Browser | BrowserContext;
        page?: Page | Promise<Page>;
        /**
         * @default 5000 ms
         */
        retryInterval?: number;
        /**
         * @default error => console.error(error)
         */
        onError?: (error: unknown) => void;
    };
    constructor(options: {
        from: Browser | BrowserContext;
        page?: Page | Promise<Page>;
        /**
         * @default 5000 ms
         */
        retryInterval?: number;
        /**
         * @default error => console.error(error)
         */
        onError?: (error: unknown) => void;
    });
    fork(): GracefulPage;
    getRetryInterval(): number;
    getOnError(): (error: unknown) => void;
    getPage(): Page | Promise<Page>;
    restart(options?: Parameters<Page['close']>[0]): Promise<Page>;
    /** @description optimized version of page.close() */
    close: Page['close'];
    /**
     * @description graceful version of page.goto()
     * @throws GotoError with response details when got 429 Too Many Requests without retry-after header
     */
    goto(url: string, 
    /**
     * @default { waitUtil: "domcontentloaded" }
     */
    options?: Parameters<Page['goto']>[1]): Promise<import("playwright").Response | null>;
    autoRetryWhenFailed<T>(f: () => T | Promise<T>): Promise<T>;
    /** @description proxy method to (await this.getPage()).evaluate */
    evaluate: Page['evaluate'];
    /** @description proxy method to (await this.getPage()).waitForSelector */
    waitForSelector: Page['waitForSelector'];
    /** @description proxy method to (await this.getPage()).fill */
    fill: Page['fill'];
    /** @description proxy method to (await this.getPage()).click */
    click: Page['click'];
    /** @description proxy method to (await this.getPage()).content */
    content: Page['content'];
    /** @description proxy method to (await this.getPage()).title */
    title: Page['title'];
    /** @description proxy method to (await this.getPage()).innerHTML */
    innerHTML: Page['innerHTML'];
    /** @description proxy method to (await this.getPage()).innerText */
    innerText: Page['innerText'];
}
export type GotoErrorDetails = {
    url: string;
    options?: Parameters<Page['goto']>[1];
    response: Awaited<ReturnType<Page['goto']>>;
};
export declare class GotoError extends Error {
    details: GotoErrorDetails;
    constructor(message: string, details: GotoErrorDetails);
}
export declare function parseRetryAfter(headerValue: string | null): number | null;
