import { ElementHandle } from './element-handle.js'; import type { AuthenticateOptions, CheckboxOptions, ClickOptions, FulfillOptions, GotoOptions, HTMLOptions, HoverOptions, LiveURLOptions, LoadSecretOptions, MapSelectorOptions, MarkdownOptions, NavigationOptions, PDFOptions, PreferencesOptions, ProxyOptions, QuerySelectorOptions, ReconnectOptions, RejectOptions, RequestFilterOptions, ResponseFilterOptions, ScreenshotOptions, ScrollOptions, SetContentOptions, SolveImageCaptchaOptions, SolveOptions, SwitchToWindowOptions, TextOptions, TypeOptions, ViewportOptions, WaitForEventOptions, WaitForNavigationOptions, WaitForNetworkIdleOptions, WaitForSelectorOptions } from './types/options.js'; import type { CaptchaResponse, ClickResponse, DefaultResponse, EmulateMediaTypeResponse, FulfillResponse, HTMLResponse, HTTPResponse, HoverResponse, JavaScriptResponse, LiveURLResponse, LoadSecretResponse, MapSelectorResponse, MarkdownResponse, ProxyResponse, ReconnectionResponse, RejectResponse, RequestResponse, ResponseResponse, ScrollResponse, StandardCookie, StopSessionRecordingResponse, SwitchWindowResponse, TextResponse, TypeResponse, UserAgentResponse, ViewportResponse, WaitForEvent, WaitForSelectorResponse, WaitForTimeoutResponse } from './types/responses.js'; import type { MediaType } from './types/enums.js'; export declare abstract class PageGenerated { protected abstract execute(mutationName: string, args: Record | null, responseType: string, timeout?: number): Promise; /** * Provides credentials for HTTP authentication (RFC 7235). When set, any HTTP * authentication challenge (401/407) will be answered with the supplied * credentials automatically. If an `origin` is provided, only challenges whose * origin matches will use these credentials; otherwise every challenge is * answered (Puppeteer-style). * * @param username - The username to authenticate with * @param password - The password to authenticate with */ authenticate(username: string, password: string, options?: AuthenticateOptions): Promise; /** Goes back in browser history, optionally accepting waitUntil and timeout arguments. Returns null if no back is possible */ goBack(options?: NavigationOptions): Promise; /** * Sets or un-sets the value of a checkbox on the page * * @param selector - The CSS selector of the element on the page you want to check/uncheck */ check(selector: string, options?: CheckboxOptions): Promise; /** * Sets or un-sets the value of a checkbox on the page * * @param selector - The CSS selector of the element on the page you want to check/uncheck */ uncheck(selector: string, options?: CheckboxOptions): Promise; /** * Waits for the element to be visible, scrolls to it, then clicks on it with native events * * @param selector - A query-selector compatible string, JavaScript that returns an HTML Node, OR a Browserless-deep query. Examples include: */ click(selector: string, options?: ClickOptions): Promise; /** * Sets the given HTML content on the page with an optional waitUntil parameter * * @param html - When present, sets the content of page to the value passed, then returns the pages content */ setContent(html: string, options?: SetContentOptions): Promise; /** Sets and gets cookies on the page */ cookies(): Promise; /** Goes forward in browser history, optionally accepting waitUntil and timeout arguments. Returns null if no forward is possible */ goForward(options?: NavigationOptions): Promise; /** * Navigates to a URL with an optional waitUntil parameter and timeout parameter * * @param url - The fully-qualified URL of the page you'd like to navigate to */ goto(url: string, options?: GotoOptions): Promise; /** Returns the HTML content of the page or selector when specified. This API can also "clean" HTML markup returned by specifying a "clean" argument with numerous options. Features of the "clean" argument include removal of non-text nodes, removal of DOM attributes, as well as removal of excessive whitespace and newlines. Using "clean" can save nearly 1,000 times the payload size. Useful for LLM's and other scenarios */ html(options?: HTMLOptions): Promise; /** Returns the HTML content of the page or selector when specified. This API can also "clean" HTML markup returned by specifying a "clean" argument with numerous options. Features of the "clean" argument include removal of non-text nodes, removal of DOM attributes, as well as removal of excessive whitespace and newlines. Using "clean" can save nearly 1,000 times the payload size. Useful for LLM's and other scenarios */ content(): Promise; /** * Sets the User-Agent string for the browser session * * @param userAgent - The User-Agent string to set for the browser session */ setUserAgent(userAgent: string): Promise; /** * Waits for the element to be visible, scrolls to it, then hover on it with native events * * @param selector - The CSS selector of the element on the page you want to hover on */ hover(selector: string, options?: HoverOptions): Promise; /** * Sets and gets JavaScript execution on the page * * **Note: changing this value won't affect scripts that have already been run. It will take full effect on the next navigation.** * * @param enabled - Whether or not to enable JavaScript on the page */ setJavaScriptEnabled(enabled: boolean): Promise; /** * Returns a fully-qualified, user-shareable live-URL for streaming the web-browser to an end-user, optionally interactive. * * **Set 30 second timer for interaction** */ liveURL(options?: LiveURLOptions): Promise; /** * Specify a selector that returns multiple nodes in a document (similar to `document.querySelectorAll`), or JavaScript that returns a NodeList, and this API will respond with details about those DOM nodes. Similar to how "map" works in most functional programming languages and libraries. Useful for mapping over repetitive data in sites and pages like product listings or search results. This will automatically wait for the selector to be present on the page, and is configurable with the "wait" and "timeout" options. * * For getting arbitrary DOM attributes back you can specify them via the `attribute(name: "data-custom-attribute")` property. This will return an object with `name` and `value` properties. * * You may also continuously map further nested items as well, for instance this query might get all books on a page, and then a nested `mapSelector` call might list all sellers of that book, or shipping speeds. Hierarchy of data is preserved to pass through the hierarchical data modeled inside the DOM. * * This API will always return a list of results back regardless if one or more items are found, or `null` if none are found. * * Using aliases can also give the returned JSON more meaning and better model the data returned by this powerful API. * * @param selector - A `document.querySelectorAll` compatible string, or JavaScript that returns a DOM NodeList. Examples include: */ mapSelector(selector: string, options?: MapSelectorOptions): Promise; /** * Specify a selector that returns multiple nodes in a document (similar to `document.querySelectorAll`), or JavaScript that returns a NodeList, and this API will respond with details about those DOM nodes. Similar to how "map" works in most functional programming languages and libraries. Useful for mapping over repetitive data in sites and pages like product listings or search results. This will automatically wait for the selector to be present on the page, and is configurable with the "wait" and "timeout" options. * * For getting arbitrary DOM attributes back you can specify them via the `attribute(name: "data-custom-attribute")` property. This will return an object with `name` and `value` properties. * * You may also continuously map further nested items as well, for instance this query might get all books on a page, and then a nested `mapSelector` call might list all sellers of that book, or shipping speeds. Hierarchy of data is preserved to pass through the hierarchical data modeled inside the DOM. * * This API will always return a list of results back regardless if one or more items are found, or `null` if none are found. * * Using aliases can also give the returned JSON more meaning and better model the data returned by this powerful API. * * Browser Automation Protocol divergence: unlike puppeteer's `$$eval(selector, pageFunction)`, this delegates to `mapSelector` and returns structured `MapSelectorResponse[]`, not a page-function result. * * @param selector - A `document.querySelectorAll` compatible string, or JavaScript that returns a DOM NodeList. Examples include: */ $$eval(selector: string, options?: MapSelectorOptions): Promise; /** Generates a PDF of the page with the print CSS media type */ pdf(options?: PDFOptions): Promise; /** Sets configuration for the entirety of the session, replacing defaults like the 30 second timeout default */ preferences(options?: PreferencesOptions): Promise; /** * Proxies requests, by a specified set of conditions, through either the Browserless residential proxy or through an external proxy. Only requests that match these conditions are proxied and the rest are sent from the instance's own IP address. * * Use the "server" argument to specify an external proxy for Browserless to use for requests. For requests with authentication, the username and password should be included in the URL using Basic Authentication. See the examples below for more information on how to format those URLs. * * **Using the browserless proxy for all requests and proxy through Brazil** */ proxy(options?: ProxyOptions): Promise; /** * Passes through certain properties of the browsers' own `document.querySelector` API * * @param selector */ $(selector: string, options?: QuerySelectorOptions): Promise; /** * Passes through certain properties of the browsers' own `document.querySelectorAll` API * * @param selector */ $$(selector: string, options?: QuerySelectorOptions): Promise; /** Returns a payload with reconnection information in order to reconnect back to the same browser session */ reconnect(options?: ReconnectOptions): Promise; /** Stops the current session recording and processes the replay data, similar to closing the context. This mutation will stop RRWeb recording and upload the collected events. */ stopSessionRecording(): Promise; /** * Rejects requests by a specified URL pattern, method, or type and operator. You may supply a single pattern, or a list (array) of them. This mutation, by default, will reject any requests that match *any* pattern, which we call an "or" operator. To reject requests where conditions must all match, specify an "and" operator in the mutation. Note that this only has an effect when the query is executing, so scripts that return quickly will likely see assets loading in the editor as these rejections only happen when mutations are executing. * ___ * **Rejecting images or media** */ reject(options?: RejectOptions): Promise; /** Reloads the given page with an optional waitUntil parameter and timeout parameter */ reload(options?: NavigationOptions): Promise; /** * Returns request information made by the Browser with optional filters via arguments. You may filter the returned results by a glob-like URL-pattern, the method of the request or the type of request. Applying an operator to this will then change the behavior by either "and"ing the filters together or "or"ing them. This API will automatically wait for the request to be made if none is immediately found which you can turn off by disabling the "wait" option. * * **Getting all "Document" requests** */ request(options?: RequestFilterOptions): Promise; /** * Returns response information, filtered by the provided arguments, made by the browser. You may optionally filter the returned results by a glob-like URL-pattern, the Method of the response or the Type of response. Applying an operator to this will then change the behavior by either "and"ing the filters together, or "or"ing them. This API will automatically wait for the response to be made if none is immediately found which you can turn off by disabling the "wait" option. * * **Getting all "Document" responses** */ response(options?: ResponseFilterOptions): Promise; /** Screenshots the page or a specific selector */ screenshot(options?: ScreenshotOptions): Promise; /** Waits for a selector, then scrolls to it on the page or an x,y coordinate in pixels */ scroll(options?: ScrollOptions): Promise; /** * 🚨 **EXPERIMENTAL** 🚨 * Solves a captcha or other challenge. Can auto-detect the CAPTCHA type or solve a specific type. * Uses the same detection logic as BaaS to automatically identify the CAPTCHA type * and routes to the appropriate solver. Optionally accepts a specific type to solve. */ solve(options?: SolveOptions): Promise; /** Solves an image captcha using caller-provided selectors. Unlike solve, which auto-detects known captcha types, this mutation works on any site by accepting custom captchaSelector and inputSelector arguments. It detects the captcha image, solves it, and fills the result into the specified input field. */ solveImageCaptcha(options?: SolveImageCaptchaOptions): Promise; /** Returns the text content on the given page or by selector when specified */ text(options?: TextOptions): Promise; /** * Returns the text content on the given page or by selector when specified * * Browser Automation Protocol divergence: unlike puppeteer's `$eval(selector, pageFunction)`, this returns the matched element's text content and takes no page-function argument. * * @param selector - The DOM selector of the given element you want to return the text of */ $eval(selector: string): Promise; /** Returns the title of the page that the browser is currently at */ title(): Promise; /** * Types text into an element by scrolling to it, clicking it, then emitting key events for every character. Include a `\n` (or `\r`) in `text` to send an Enter/Return key press — useful for submitting search boxes or forms without a separate click. BrowserQL has no standalone key-press mutation, so non-Enter keys cannot be simulated; use `click` for non-keyboard submit interactions (for example, a submit button). * * @param selector - The CSS selector of the element on the page you want to type text into * @param text - The text content you want to type into the element. A `\n` or `\r` character is sent as an Enter key press. */ type(selector: string, text: string, options?: TypeOptions): Promise; /** * Fills a credential resolved just-in-time from a configured 1Password * integration into a target input. The resolved value never appears in your * query or in the response. The session must be started with an integration * (the `integrationId` connection parameter or session field), and the page's * origin must be in the integration's allowed-domain list. Once any secret has * been filled, capture and page-content readback are disabled for the rest of the * session — screenshots, PDFs, screencasts, Live URLs, session recording, and the * content-return mutations (evaluate, html, text, querySelector, querySelectorAll, * cookies). * * @param ref - The 1Password op:// reference (e.g. op://Vault/Item/password), or an alias */ loadSecret(ref: string, options?: Omit): Promise; /** Returns the URL of the page that the browser is currently at */ url(): Promise; /** Waits for a navigation even to fire, useful for clicking an element and waiting for a page load of some */ waitForNavigation(options?: WaitForNavigationOptions): Promise; /** Wait for the page to have no more than the configured number of in-flight network requests for a period of time. */ waitForNetworkIdle(options?: WaitForNetworkIdleOptions): Promise; /** * Waits for a given selector to be present in the DOM, with optional visibility * * @param selector - The selector to wait for until present in the DOM */ waitForSelector(selector: string, options?: WaitForSelectorOptions): Promise; /** * Waits for a named event to fire on the page's document or window. * * @param event - The name of the event to wait for, eg: "load" or a custom event name */ waitForEvent(event: string, options?: WaitForEventOptions): Promise; /** * Starts tracking a named document/window event in the current document and * before scripts execute in future documents. A later waitForEvent call returns * immediately when the tracked event has already fired. * * @param event - The name of the event to track, eg: "load" or a custom event name */ watchEvent(event: string): Promise; /** Sets the viewport dimensions for the browser session */ setViewport(options?: ViewportOptions): Promise; /** Switches context to a popup window matching specified criteria */ switchToWindow(options?: SwitchToWindowOptions): Promise; /** * Emulates the given CSS media type for the page, mirroring the behavior of * printing ("print") or on-screen rendering ("screen"). Useful before a `pdf` * or `screenshot` to control how the page renders. * * @param type - The CSS media type to emulate */ emulateMediaType(type: MediaType): Promise; /** * Fulfills matching requests with a canned response instead of letting them hit * the network, mirroring the request-interceptor mocking used by the REST APIs. * Matching follows the same glob-style URL/method/type conditions as `reject`. */ fulfill(options?: FulfillOptions): Promise; /** * Returns the page's content converted to Markdown. The HTML is fetched from * the page (optionally scoped to a selector) and converted server-side, with * script/style/noscript/iframe nodes stripped. */ markdown(options?: MarkdownOptions): Promise; } //# sourceMappingURL=page-generated.d.ts.map