> ## Documentation Index
> Fetch the complete documentation index at: https://docs.extractbase.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Page

Represents a single tab or window in a web browser.
The Page type provides methods to interact with the web page loaded in that tab.
It implements the Node interface, giving access to element querying capabilities,
and also offers page-specific information and actions like accessing URL, title, content, cookies, etc.

## Definition

```graphql theme={null}
object Page implements Node {
  browserVersion: String
  content: String
  cookies(
    urls: [String]
  ): [Cookie]
  pdf(
    options: PDFOptions
  ): Download
  response: Response
  status: Int
  storageState: StorageState
  title: String
  url: URL
  userAgent: String
  viewport: Viewport
  performance: Performance
  element(
    selector: String
    text: String
    role: ARIARole
    label: String
    placeholder: String
    altText: String
    title: String
    testId: String
    filter: ElementFilterOptions
  ): Element
  elements(
    selector: String
    text: String
    role: ARIARole
    label: String
    placeholder: String
    altText: String
    title: String
    testId: String
    filter: ElementFilterOptions
  ): [Element]!
  ariaSnapshot: String
  attribute(
    name: String!
  ): String
  attributes: JSONObject
  boundingBox: BoundingBox
  innerHTML: String
  innerText: String
  markdown: String
  screenshot(
    options: ScreenshotOptions
  ): Download
  textContent: String
}
```

## Fields

### `browserVersion`

[String](/reference/graphql/scalars/string)

A string identifying the browser name and version. Example: `"Chrome/138.0.0.0"`

## Example

```graphql theme={null}
mutation {
  page {
    browserVersion
  }
}
```

### `content`

[String](/reference/graphql/scalars/string)

The full HTML content of the page. This is equivalent to the document's outerHTML.

## Example

```graphql theme={null}
mutation {
  page {
    content
  }
}
```

### `cookies`

[\[Cookie\]](/reference/graphql/objects/cookie)

Retrieves cookies for the current page's URL or specified URLs.
If no URLs are provided, cookies for the current page URL are returned.
If URLs are provided, only cookies for those specific URLs are returned.
Example: `cookies(urls: ["https://example.com", "https://another.com"])`

#### Arguments

* **`urls`**: [\[String\]](/reference/graphql/scalars/string) - An optional list of URLs to retrieve cookies for.
  If omitted, cookies for the current page's URL are returned.
  Example: `["https://www.example.com", "https://sub.example.com"]`

### `pdf`

[Download](/reference/graphql/objects/download)

Generates a PDF representation of the current page.
Returns a Download object which can contain a URL to the PDF or its Base64 encoded data.
Example: `pdf(options: { format: A4, landscape: true, printBackground: true })`

#### Arguments

* **`options`**: [PDFOptions](/reference/graphql/inputs/pdfoptions) - Options to customize the PDF output, such as paper size, orientation, margins, and more.
  See `PDFOptions` for details.

### `response`

[Response](/reference/graphql/objects/response)

Information about the main resource response for the page.
This includes status, headers, and other details of the HTTP response that loaded the page.
May be null if the page was loaded from content directly (e.g., via `page(content: "...")`).

### `status`

[Int](/reference/graphql/scalars/int)

The HTTP status code of the main page response.
Example: 200 for success, 404 for not found.
May be null if the page was not loaded via an HTTP request (e.g., a data URL).

### `storageState`

[StorageState](/reference/graphql/objects/storage-state)

The current storage state of the page, including cookies, local storage, and IndexedDB data.
This is a snapshot of the current state and can be used for session persistence or transfer.

### `title`

[String](/reference/graphql/scalars/string)

The title of the current page, as specified in the `<title>` HTML tag.

### `url`

[URL](/reference/graphql/scalars/url)

The current URL of the page. If the page has been redirected, this will be the final URL.

### `userAgent`

[String](/reference/graphql/scalars/string)

The browser's user agent string for this page.
This can be overridden when the page is created or via a specific mutation.
Example: `"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36"`

### `viewport`

[Viewport](/reference/graphql/objects/viewport)

Information about the page's viewport, including its dimensions and device characteristics.

### `performance`

[Performance](/reference/graphql/objects/performance)

Performance metrics collected from the page using the native Performance API.
Contains arrays of PerformanceEntry objects organized by entry type.
Only available when explicitly requested in the query.

### `element`

[Element](/reference/graphql/objects/element)

Queries the current context (Page or Element) for a single element matching the specified criteria.
If multiple elements match, the first one is returned. Returns null if no element is found.
Supports various selector strategies including CSS selectors, text content, ARIA roles, and more.
Example: `element(selector: ".my-class", text: "Submit")`

#### Arguments

* **`selector`**: [String](/reference/graphql/scalars/string) - The CSS selector for the element. Example: `"#username"` for `<input id="username" />`.
* **`text`**: [String](/reference/graphql/scalars/string) - Finds an element by its text content. Example: `"Login"` for `<button>Login</button>`.
* **`role`**: [ARIARole](/reference/graphql/enums/ariarole) - Finds an element by its ARIA role. Example: `"button"` for `<div role="button">Submit</div>`.
* **`label`**: [String](/reference/graphql/scalars/string) - Finds an element by its ARIA label. Example: `"Search button"` for `<button aria-label="Search button"><svg/></button>`.
* **`placeholder`**: [String](/reference/graphql/scalars/string) - Finds an element by its placeholder text. Example: `"Enter your email"` for `<input placeholder="Enter your email" />`.
* **`altText`**: [String](/reference/graphql/scalars/string) - Finds an element by its image alt text. Example: `"Company logo"` for `<img alt="Company logo" src="..." />`.
* **`title`**: [String](/reference/graphql/scalars/string) - Finds an element by its title attribute. Example: `"Close dialog"` for `<span title="Close dialog">X</span>`.
* **`testId`**: [String](/reference/graphql/scalars/string) - Finds an element by its data-testid attribute. Example: `"submit-button"` for `<button data-testid="submit-button">Go</button>`.
* **`filter`**: [ElementFilterOptions](/reference/graphql/inputs/element-filter-options) - Advanced filtering options for the element.

### `elements`

[\[Element\]!](/reference/graphql/objects/element)

Queries the current context (Page or Element) for all elements matching the specified selector.
Supports various selector strategies including CSS selectors, text content, ARIA roles, and more.
Returns an empty list if no elements are found.
Example: `elements(selector: "div.product-item")`

#### Arguments

* **`selector`**: [String](/reference/graphql/scalars/string) - The CSS selector for the element. Example: `"#username"` for `<input id="username" />`.
* **`text`**: [String](/reference/graphql/scalars/string) - Finds an element by its text content. Example: `"Login"` for `<button>Login</button>`.
* **`role`**: [ARIARole](/reference/graphql/enums/ariarole) - Finds an element by its ARIA role. Example: `"button"` for `<div role="button">Submit</div>`.
* **`label`**: [String](/reference/graphql/scalars/string) - Finds an element by its ARIA label. Example: `"Search button"` for `<button aria-label="Search button"><svg/></button>`.
* **`placeholder`**: [String](/reference/graphql/scalars/string) - Finds an element by its placeholder text. Example: `"Enter your email"` for `<input placeholder="Enter your email" />`.
* **`altText`**: [String](/reference/graphql/scalars/string) - Finds an element by its image alt text. Example: `"Company logo"` for `<img alt="Company logo" src="..." />`.
* **`title`**: [String](/reference/graphql/scalars/string) - Finds an element by its title attribute. Example: `"Close dialog"` for `<span title="Close dialog">X</span>`.
* **`testId`**: [String](/reference/graphql/scalars/string) - Finds an element by its data-testid attribute. Example: `"submit-button"` for `<button data-testid="submit-button">Go</button>`.
* **`filter`**: [ElementFilterOptions](/reference/graphql/inputs/element-filter-options) - Advanced filtering options for the element.

### `ariaSnapshot`

[String](/reference/graphql/scalars/string)

Provides a snapshot of the ARIA (Accessible Rich Internet Applications) properties of the element.
This can be useful for accessibility testing and understanding the element's semantics.
The snapshot includes the element's role, name, and other properties.

### `attribute`

[String](/reference/graphql/scalars/string)

Retrieves the value of a specified attribute for the element.
Returns null if the attribute does not exist.
Example: `attribute(name: "href")` on an `<a>` tag, or `attribute(name: "data-custom")` on any element.

#### Arguments

* **`name`**: [String!](/reference/graphql/scalars/string) - The name of the attribute to retrieve. Example: `"class"`, `"id"`, `"value"`, `"src"`.

### `attributes`

[JSONObject](/reference/graphql/scalars/jsonobject)

Retrieves all attributes of the element as a JSON object.
Each key in the object is an attribute name, and its value is the attribute's string value.
Example: `{ "id": "myElement", "class": "active important", "data-value": "123" }`

### `boundingBox`

[BoundingBox](/reference/graphql/objects/bounding-box)

Returns the bounding box of the element in pixels, relative to the main frame's viewport.
Returns null if the element is not visible.

### `innerHTML`

[String](/reference/graphql/scalars/string)

Retrieves the inner HTML content of the element.
This includes all HTML markup within the element.
Example: For `<p>Hello <b>world</b></p>`, innerHTML would be `"Hello <b>world</b>"`.

### `innerText`

[String](/reference/graphql/scalars/string)

Retrieves the visible text content of the element, excluding hidden text but including text from the shadow DOM.
This is similar to what a user would see on the page.
Example: For `<p>Hello <b>world</b></p>`, innerText might be `"Hello world"`.

### `markdown`

[String](/reference/graphql/scalars/string)

Attempts to convert the HTML content of the element into Markdown format.
Useful for extracting structured text content.

### `screenshot`

[Download](/reference/graphql/objects/download)

Captures a screenshot of the element.
Returns a Download object containing the URL or Base64 data of the screenshot image.
Example: `screenshot(options: { type: PNG, omitBackground: true })`

#### Arguments

* **`options`**: [ScreenshotOptions](/reference/graphql/inputs/screenshot-options) - Options to configure the screenshot, such as image type, quality, or clipping. See `ScreenshotOptions`.

### `textContent`

[String](/reference/graphql/scalars/string)

Retrieves the text content of the element and all its descendants, including `<script>` and `<style>` tags.
Example: For `<p>Hello <b>world</b></p>`, textContent would be `"Hello world"`.

## Implements

* [Node](/reference/graphql/interfaces/node)
