Liking cljdoc? Tell your friends :D

com.blockether.spel.page

Page operations - navigation, content, evaluation, screenshots, events, and utility classes (Dialog, Download, ConsoleMessage, Clock, FileChooser, Worker, WebError). The Page class is the central API surface of Playwright. Wraps all Page methods with idiomatic Clojure functions.

Page operations - navigation, content, evaluation, screenshots,
events, and utility classes (Dialog, Download, ConsoleMessage,
Clock, FileChooser, Worker, WebError).
The Page class is the central API surface of Playwright. Wraps all
Page methods with idiomatic Clojure functions.
raw docstring

add-script-tagclj

(add-script-tag page opts)

Adds a script tag to the page.

Params: page - Page instance. opts - Map with :url, :path, or :content.

Returns: ElementHandle or anomaly map.

Adds a script tag to the page.

Params:
`page` - Page instance.
`opts` - Map with :url, :path, or :content.

Returns:
ElementHandle or anomaly map.
raw docstring

add-style-tagclj

(add-style-tag page opts)

Adds a style tag to the page.

Params: page - Page instance. opts - Map with :url, :path, or :content.

Returns: ElementHandle or anomaly map.

Adds a style tag to the page.

Params:
`page` - Page instance.
`opts` - Map with :url, :path, or :content.

Returns:
ElementHandle or anomaly map.
raw docstring

bring-to-frontclj

(bring-to-front page)

Brings page to front (activates tab).

Params: page - Page instance.

Brings page to front (activates tab).

Params:
`page` - Page instance.
raw docstring

clock-fast-forward!clj

(clock-fast-forward! clock ticks)

Fast-forwards the clock by the given time.

Params: clock - Clock instance. ticks - Long. Time to advance in ms.

Fast-forwards the clock by the given time.

Params:
`clock` - Clock instance.
`ticks` - Long. Time to advance in ms.
raw docstring

clock-install!clj

(clock-install! clock)

Installs fake timers on the clock.

Params: clock - Clock instance.

Installs fake timers on the clock.

Params:
`clock` - Clock instance.
raw docstring

clock-pause-at!clj

(clock-pause-at! clock time)

Pauses the clock at the given time.

Params: clock - Clock instance. time - Long. Unix timestamp in ms.

Pauses the clock at the given time.

Params:
`clock` - Clock instance.
`time`  - Long. Unix timestamp in ms.
raw docstring

clock-resume!clj

(clock-resume! clock)

Resumes the clock.

Params: clock - Clock instance.

Resumes the clock.

Params:
`clock` - Clock instance.
raw docstring

clock-set-fixed-time!clj

(clock-set-fixed-time! clock time)

Sets the clock to a fixed time.

Params: clock - Clock instance. time - Long. Unix timestamp in ms.

Sets the clock to a fixed time.

Params:
`clock` - Clock instance.
`time`  - Long. Unix timestamp in ms.
raw docstring

clock-set-system-time!clj

(clock-set-system-time! clock time)

Sets the system time.

Params: clock - Clock instance. time - Long. Unix timestamp in ms.

Sets the system time.

Params:
`clock` - Clock instance.
`time`  - Long. Unix timestamp in ms.
raw docstring

console-argsclj

(console-args msg)

Returns the console message arguments as JSHandles.

Params: msg - ConsoleMessage instance.

Returns: Vector of JSHandle.

Returns the console message arguments as JSHandles.

Params:
`msg` - ConsoleMessage instance.

Returns:
Vector of JSHandle.
raw docstring

console-locationclj

(console-location msg)

Returns the source location of the console message.

Params: msg - ConsoleMessage instance.

Returns: String. The location string.

Returns the source location of the console message.

Params:
`msg` - ConsoleMessage instance.

Returns:
String. The location string.
raw docstring

console-pageclj

(console-page msg)

Returns the page the console message belongs to.

Params: msg - ConsoleMessage instance.

Returns: Page instance.

Returns the page the console message belongs to.

Params:
`msg` - ConsoleMessage instance.

Returns:
Page instance.
raw docstring

console-textclj

(console-text msg)

Returns the console message text.

Params: msg - ConsoleMessage instance.

Returns: String.

Returns the console message text.

Params:
`msg` - ConsoleMessage instance.

Returns:
String.
raw docstring

console-typeclj

(console-type msg)

Returns the console message type (log, debug, info, error, warning, etc).

Params: msg - ConsoleMessage instance.

Returns: String.

Returns the console message type (log, debug, info, error, warning, etc).

Params:
`msg` - ConsoleMessage instance.

Returns:
String.
raw docstring

contentclj

(content page)

Returns the full HTML content of the page.

Params: page - Page instance.

Returns: String. HTML content.

Returns the full HTML content of the page.

Params:
`page` - Page instance.

Returns:
String. HTML content.
raw docstring

dialog-accept!clj

(dialog-accept! dialog)
(dialog-accept! dialog prompt-text)

Accepts the dialog.

Params: dialog - Dialog instance. prompt-text - String, optional. Text for prompt dialogs.

Accepts the dialog.

Params:
`dialog`     - Dialog instance.
`prompt-text` - String, optional. Text for prompt dialogs.
raw docstring

dialog-default-valueclj

(dialog-default-value dialog)

Returns the default value for prompt dialogs.

Params: dialog - Dialog instance.

Returns: String.

Returns the default value for prompt dialogs.

Params:
`dialog` - Dialog instance.

Returns:
String.
raw docstring

dialog-dismiss!clj

(dialog-dismiss! dialog)

Dismisses the dialog.

Params: dialog - Dialog instance.

Dismisses the dialog.

Params:
`dialog` - Dialog instance.
raw docstring

dialog-messageclj

(dialog-message dialog)

Returns the dialog message.

Params: dialog - Dialog instance.

Returns: String.

Returns the dialog message.

Params:
`dialog` - Dialog instance.

Returns:
String.
raw docstring

dialog-typeclj

(dialog-type dialog)

Returns the dialog type (alert, confirm, prompt, beforeunload).

Params: dialog - Dialog instance.

Returns: String.

Returns the dialog type (alert, confirm, prompt, beforeunload).

Params:
`dialog` - Dialog instance.

Returns:
String.
raw docstring

download-cancel!clj

(download-cancel! download)

Cancels the download.

Params: download - Download instance.

Cancels the download.

Params:
`download` - Download instance.
raw docstring

download-failureclj

(download-failure download)

Returns the download failure reason, or nil.

Params: download - Download instance.

Returns: String or nil.

Returns the download failure reason, or nil.

Params:
`download` - Download instance.

Returns:
String or nil.
raw docstring

download-pageclj

(download-page download)

Returns the page the download belongs to.

Params: download - Download instance.

Returns: Page instance.

Returns the page the download belongs to.

Params:
`download` - Download instance.

Returns:
Page instance.
raw docstring

download-pathclj

(download-path download)

Returns the local path to the downloaded file.

Params: download - Download instance.

Returns: Path or nil.

Returns the local path to the downloaded file.

Params:
`download` - Download instance.

Returns:
Path or nil.
raw docstring

download-save-as!clj

(download-save-as! download path)

Saves the download to the given path.

Params: download - Download instance. path - String. Destination path.

Saves the download to the given path.

Params:
`download` - Download instance.
`path`     - String. Destination path.
raw docstring

download-suggested-filenameclj

(download-suggested-filename download)

Returns the suggested filename.

Params: download - Download instance.

Returns: String.

Returns the suggested filename.

Params:
`download` - Download instance.

Returns:
String.
raw docstring

download-urlclj

(download-url download)

Returns the download URL.

Params: download - Download instance.

Returns: String.

Returns the download URL.

Params:
`download` - Download instance.

Returns:
String.
raw docstring

emulate-media!clj

(emulate-media! page media-opts)

Emulates media type and features.

Params: page - Page instance. opts - Map. Emulate media options.

Emulates media type and features.

Params:
`page` - Page instance.
`opts` - Map. Emulate media options.
raw docstring

evaluateclj

(evaluate page expression)
(evaluate page expression arg)

Evaluates JavaScript expression in the page context.

Params: page - Page instance. expression - String. JavaScript expression. arg - Optional. Argument to pass to the expression.

Returns: Result of JavaScript evaluation or anomaly map on failure.

Evaluates JavaScript expression in the page context.

Params:
`page`       - Page instance.
`expression` - String. JavaScript expression.
`arg`        - Optional. Argument to pass to the expression.

Returns:
Result of JavaScript evaluation or anomaly map on failure.
raw docstring

evaluate-handleclj

(evaluate-handle page expression)
(evaluate-handle page expression arg)

Like evaluate, but returns a JSHandle.

Params: page - Page instance. expression - String. JavaScript expression. arg - Optional. Argument.

Returns: JSHandle or anomaly map.

Like evaluate, but returns a JSHandle.

Params:
`page`       - Page instance.
`expression` - String. JavaScript expression.
`arg`        - Optional. Argument.

Returns:
JSHandle or anomaly map.
raw docstring

expose-binding!clj

(expose-binding! page name f)

Exposes a Clojure function as a binding.

Params: page - Page instance. name - String. Binding name. fn - Function. The binding function.

Exposes a Clojure function as a binding.

Params:
`page` - Page instance.
`name` - String. Binding name.
`fn`   - Function. The binding function.
raw docstring

expose-function!clj

(expose-function! page name f)

Exposes a Clojure function to JavaScript.

Params: page - Page instance. name - String. Function name in JavaScript. fn - Function. The Clojure function to expose.

Exposes a Clojure function to JavaScript.

Params:
`page` - Page instance.
`name` - String. Function name in JavaScript.
`fn`   - Function. The Clojure function to expose.
raw docstring

file-chooser-elementclj

(file-chooser-element fc)

Returns the element handle for the file input.

Params: fc - FileChooser instance.

Returns: ElementHandle.

Returns the element handle for the file input.

Params:
`fc` - FileChooser instance.

Returns:
ElementHandle.
raw docstring

file-chooser-is-multiple?clj

(file-chooser-is-multiple? fc)

Returns whether the file chooser accepts multiple files.

Params: fc - FileChooser instance.

Returns: Boolean.

Returns whether the file chooser accepts multiple files.

Params:
`fc` - FileChooser instance.

Returns:
Boolean.
raw docstring

file-chooser-pageclj

(file-chooser-page fc)

Returns the page the file chooser belongs to.

Params: fc - FileChooser instance.

Returns: Page instance.

Returns the page the file chooser belongs to.

Params:
`fc` - FileChooser instance.

Returns:
Page instance.
raw docstring

file-chooser-set-files!clj

(file-chooser-set-files! fc files)

Sets the files for the file chooser.

Params: fc - FileChooser instance. files - String path or vector of paths.

Sets the files for the file chooser.

Params:
`fc`    - FileChooser instance.
`files` - String path or vector of paths.
raw docstring

frame-by-nameclj

(frame-by-name page name)

Returns a frame by its name attribute.

Params: page - Page instance. name - String. Frame name.

Returns: Frame or nil.

Returns a frame by its name attribute.

Params:
`page` - Page instance.
`name` - String. Frame name.

Returns:
Frame or nil.
raw docstring

frame-by-urlclj

(frame-by-url page pattern)

Returns a frame by matching URL pattern.

Params: page - Page instance. pattern - String glob, regex Pattern, or predicate.

Returns: Frame or nil.

Returns a frame by matching URL pattern.

Params:
`page`    - Page instance.
`pattern` - String glob, regex Pattern, or predicate.

Returns:
Frame or nil.
raw docstring

framesclj

(frames page)

Returns all frames in the page.

Params: page - Page instance.

Returns: Vector of Frame instances.

Returns all frames in the page.

Params:
`page` - Page instance.

Returns:
Vector of Frame instances.
raw docstring

get-by-alt-textclj

(get-by-alt-text page text)

Locates elements by alt text.

Params: page - Page instance. text - String or Pattern.

Returns: Locator instance.

Locates elements by alt text.

Params:
`page` - Page instance.
`text` - String or Pattern.

Returns:
Locator instance.
raw docstring

get-by-labelclj

(get-by-label page text)

Locates elements by their label text.

Params: page - Page instance. text - String or Pattern.

Returns: Locator instance.

Locates elements by their label text.

Params:
`page` - Page instance.
`text` - String or Pattern.

Returns:
Locator instance.
raw docstring

get-by-placeholderclj

(get-by-placeholder page text)

Locates elements by placeholder text.

Params: page - Page instance. text - String or Pattern.

Returns: Locator instance.

Locates elements by placeholder text.

Params:
`page` - Page instance.
`text` - String or Pattern.

Returns:
Locator instance.
raw docstring

get-by-refclj

(get-by-ref page ref-id)

Locates an element by its snapshot ref ID (e.g. "@e2yrjz", "@e9mter"). The element must have been tagged with data-pw-ref during capture-snapshot.

Params: page - Page instance. ref-id - String. Ref with @ prefix, e.g. "@e2yrjz", "@e9mter".

Returns: Locator instance.

Locates an element by its snapshot ref ID (e.g. "@e2yrjz", "@e9mter").
The element must have been tagged with data-pw-ref during capture-snapshot.

Params:
`page`   - Page instance.
`ref-id` - String. Ref with @ prefix, e.g. "@e2yrjz", "@e9mter".

Returns:
Locator instance.
raw docstring

get-by-roleclj

(get-by-role page role)
(get-by-role page role opts)

Locates elements by their ARIA role.

Params: page - Page instance. role - AriaRole enum value. opts - Map, optional. GetByRoleOptions: :name - String or Pattern. Accessible name to match. :exact - Boolean. Exact match for name. :checked - Boolean. Match checked state. :disabled - Boolean. Match disabled state. :expanded - Boolean. Match expanded state. :include-hidden - Boolean. Include hidden elements. :level - Integer. Heading level. :pressed - Boolean. Match pressed state. :selected - Boolean. Match selected state.

Returns: Locator instance.

Locates elements by their ARIA role.

Params:
`page` - Page instance.
`role` - AriaRole enum value.
`opts` - Map, optional. GetByRoleOptions:
         :name           - String or Pattern. Accessible name to match.
         :exact          - Boolean. Exact match for name.
         :checked        - Boolean. Match checked state.
         :disabled       - Boolean. Match disabled state.
         :expanded       - Boolean. Match expanded state.
         :include-hidden - Boolean. Include hidden elements.
         :level          - Integer. Heading level.
         :pressed        - Boolean. Match pressed state.
         :selected       - Boolean. Match selected state.

Returns:
Locator instance.
raw docstring

get-by-test-idclj

(get-by-test-id page test-id)

Locates elements by test ID attribute.

Params: page - Page instance. test-id - String or Pattern.

Returns: Locator instance.

Locates elements by test ID attribute.

Params:
`page`    - Page instance.
`test-id` - String or Pattern.

Returns:
Locator instance.
raw docstring

get-by-textclj

(get-by-text page text)

Locates elements by their text content.

Params: page - Page instance. text - String or Pattern.

Returns: Locator instance.

Locates elements by their text content.

Params:
`page` - Page instance.
`text` - String or Pattern.

Returns:
Locator instance.
raw docstring

get-by-titleclj

(get-by-title page text)

Locates elements by title attribute.

Params: page - Page instance. text - String or Pattern.

Returns: Locator instance.

Locates elements by title attribute.

Params:
`page` - Page instance.
`text` - String or Pattern.

Returns:
Locator instance.
raw docstring

go-backclj

(go-back page)
(go-back page nav-opts)

Navigates back in history.

Params: page - Page instance. opts - Map, optional. Navigation options.

Returns: Response or nil, or anomaly map on failure.

Navigates back in history.

Params:
`page` - Page instance.
`opts` - Map, optional. Navigation options.

Returns:
Response or nil, or anomaly map on failure.
raw docstring

go-forwardclj

(go-forward page)
(go-forward page nav-opts)

Navigates forward in history.

Params: page - Page instance. opts - Map, optional. Navigation options.

Returns: Response or nil, or anomaly map on failure.

Navigates forward in history.

Params:
`page` - Page instance.
`opts` - Map, optional. Navigation options.

Returns:
Response or nil, or anomaly map on failure.
raw docstring

is-closed?clj

(is-closed? page)

Returns true if the page has been closed.

Params: page - Page instance.

Returns: Boolean.

Returns true if the page has been closed.

Params:
`page` - Page instance.

Returns:
Boolean.
raw docstring

locatorclj

(locator page selector)

Creates a Locator for finding elements on the page.

Params: page - Page instance. selector - String. CSS or text selector.

Returns: Locator instance.

Creates a Locator for finding elements on the page.

Params:
`page`     - Page instance.
`selector` - String. CSS or text selector.

Returns:
Locator instance.
raw docstring

main-frameclj

(main-frame page)

Returns the main frame of the page.

Params: page - Page instance.

Returns: Frame instance.

Returns the main frame of the page.

Params:
`page` - Page instance.

Returns:
Frame instance.
raw docstring

(navigate page url)
(navigate page url nav-opts)

Navigates the page to a URL.

Params: page - Page instance. url - String. URL to navigate to. opts - Map, optional. Navigation options.

Returns: Response or nil, or anomaly map on failure.

Navigates the page to a URL.

Params:
`page` - Page instance.
`url`  - String. URL to navigate to.
`opts` - Map, optional. Navigation options.

Returns:
Response or nil, or anomaly map on failure.
raw docstring

on-closeclj

(on-close page handler)

Registers a handler for page close.

Params: page - Page instance. handler - Function called with the page when it closes.

Registers a handler for page close.

Params:
`page`    - Page instance.
`handler` - Function called with the page when it closes.
raw docstring

on-consoleclj

(on-console page handler)

Registers a handler for console messages.

Params: page - Page instance. handler - Function that receives a ConsoleMessage.

Registers a handler for console messages.

Params:
`page`    - Page instance.
`handler` - Function that receives a ConsoleMessage.
raw docstring

on-dialogclj

(on-dialog page handler)

Registers a handler for dialogs.

Params: page - Page instance. handler - Function that receives a Dialog.

Registers a handler for dialogs.

Params:
`page`    - Page instance.
`handler` - Function that receives a Dialog.
raw docstring

on-downloadclj

(on-download page handler)

Registers a handler for downloads.

Params: page - Page instance. handler - Function that receives a Download.

Registers a handler for downloads.

Params:
`page`    - Page instance.
`handler` - Function that receives a Download.
raw docstring

on-page-errorclj

(on-page-error page handler)

Registers a handler for page errors.

Params: page - Page instance. handler - Function that receives an error string.

Registers a handler for page errors.

Params:
`page`    - Page instance.
`handler` - Function that receives an error string.
raw docstring

on-popupclj

(on-popup page handler)

Registers a handler for popup pages.

Params: page - Page instance. handler - Function that receives a Page.

Registers a handler for popup pages.

Params:
`page`    - Page instance.
`handler` - Function that receives a Page.
raw docstring

on-requestclj

(on-request page handler)

Registers a handler for requests.

Params: page - Page instance. handler - Function that receives a Request.

Registers a handler for requests.

Params:
`page`    - Page instance.
`handler` - Function that receives a Request.
raw docstring

on-responseclj

(on-response page handler)

Registers a handler for responses.

Params: page - Page instance. handler - Function that receives a Response.

Registers a handler for responses.

Params:
`page`    - Page instance.
`handler` - Function that receives a Response.
raw docstring

once-dialogclj

(once-dialog page handler)

Registers a one-time handler for the next dialog. The handler is automatically removed after the first dialog is handled.

Params: page - Page instance. handler - Function that receives a Dialog.

Registers a one-time handler for the next dialog.
The handler is automatically removed after the first dialog is handled.

Params:
`page`    - Page instance.
`handler` - Function that receives a Dialog.
raw docstring

openerclj

(opener page)

Returns the opener page, if any.

Params: page - Page instance.

Returns: Page or nil.

Returns the opener page, if any.

Params:
`page` - Page instance.

Returns:
Page or nil.
raw docstring

page-clockclj

(page-clock page)

Returns the Clock for a page.

Params: page - Page instance.

Returns: Clock instance.

Returns the Clock for a page.

Params:
`page` - Page instance.

Returns:
Clock instance.
raw docstring

page-contextclj

(page-context page)

Returns the BrowserContext that the page belongs to.

Params: page - Page instance.

Returns: BrowserContext instance.

Returns the BrowserContext that the page belongs to.

Params:
`page` - Page instance.

Returns:
BrowserContext instance.
raw docstring

page-keyboardclj

(page-keyboard page)

Returns the Keyboard for this page.

Params: page - Page instance.

Returns: Keyboard instance.

Returns the Keyboard for this page.

Params:
`page` - Page instance.

Returns:
Keyboard instance.
raw docstring

page-mouseclj

(page-mouse page)

Returns the Mouse for this page.

Params: page - Page instance.

Returns: Mouse instance.

Returns the Mouse for this page.

Params:
`page` - Page instance.

Returns:
Mouse instance.
raw docstring

page-touchscreenclj

(page-touchscreen page)

Returns the Touchscreen for this page.

Params: page - Page instance.

Returns: Touchscreen instance.

Returns the Touchscreen for this page.

Params:
`page` - Page instance.

Returns:
Touchscreen instance.
raw docstring

pdfclj

(pdf page)
(pdf page pdf-opts)

Generates a PDF of the page. Only works in Chromium headless.

Params: page - Page instance. opts - Map, optional. PDF options.

Returns: byte[] of the PDF data, or anomaly map on failure.

Generates a PDF of the page. Only works in Chromium headless.

Params:
`page` - Page instance.
`opts` - Map, optional. PDF options.

Returns:
byte[] of the PDF data, or anomaly map on failure.
raw docstring

reloadclj

(reload page)
(reload page nav-opts)

Reloads the page.

Params: page - Page instance. opts - Map, optional. Reload options.

Returns: Response or nil, or anomaly map on failure.

Reloads the page.

Params:
`page` - Page instance.
`opts` - Map, optional. Reload options.

Returns:
Response or nil, or anomaly map on failure.
raw docstring

route!clj

(route! page pattern handler)

Registers a route handler for URL pattern.

Params: page - Page instance. pattern - String glob or regex Pattern. handler - Function that receives a Route.

Registers a route handler for URL pattern.

Params:
`page`    - Page instance.
`pattern` - String glob or regex Pattern.
`handler` - Function that receives a Route.
raw docstring

route-from-har!clj

(route-from-har! page har)
(route-from-har! page har route-opts)

Routes requests from a HAR file. Replays recorded responses for matching requests.

Use with :update true to record actual responses into the HAR for later replay.

Params: page - Page instance. har - String. Path to the HAR file. opts - Map, optional. RouteFromHAR options: :url - String glob or regex Pattern. Only intercept matching URLs. :not-found - Keyword. :abort or :fallback. :update - Boolean. Whether to update HAR with actual network data. :update-content - Keyword. :embed or :attach. :update-mode - Keyword. :full or :minimal.

Routes requests from a HAR file. Replays recorded responses for matching requests.

Use with :update true to record actual responses into the HAR for later replay.

Params:
`page` - Page instance.
`har`  - String. Path to the HAR file.
`opts` - Map, optional. RouteFromHAR options:
         :url            - String glob or regex Pattern. Only intercept matching URLs.
         :not-found      - Keyword. :abort or :fallback.
         :update         - Boolean. Whether to update HAR with actual network data.
         :update-content - Keyword. :embed or :attach.
         :update-mode    - Keyword. :full or :minimal.
raw docstring

route-web-socket!clj

(route-web-socket! page pattern handler)

Registers a handler for WebSocket connections matching a URL pattern.

The handler receives a WebSocketRoute that can be used to mock the WebSocket connection (send messages, intercept client messages, etc.).

Params: page - Page instance. pattern - String glob, regex Pattern, or predicate fn. handler - Function that receives a WebSocketRoute.

Registers a handler for WebSocket connections matching a URL pattern.

The handler receives a WebSocketRoute that can be used to mock the
WebSocket connection (send messages, intercept client messages, etc.).

Params:
`page`    - Page instance.
`pattern` - String glob, regex Pattern, or predicate fn.
`handler` - Function that receives a WebSocketRoute.
raw docstring

screenshotclj

(screenshot page)
(screenshot page ss-opts)

Takes a screenshot of the page.

Params: page - Page instance. opts - Map, optional. Screenshot options.

Returns: byte[] of the image data, or anomaly map on failure.

Takes a screenshot of the page.

Params:
`page` - Page instance.
`opts` - Map, optional. Screenshot options.

Returns:
byte[] of the image data, or anomaly map on failure.
raw docstring

scrollclj

(scroll page)
(scroll page direction)
(scroll page direction opts)

Scrolls the page by the given amount in the given direction.

Params: page - Page instance. direction - Keyword or string: :up :down :left :right (default :down). opts - Optional map: :amount - Pixels to scroll (default 500). :smooth? - When true, uses smooth animated scrolling (default false).

Returns: Map with :scrolled, :amount, :smooth keys.

Scrolls the page by the given amount in the given direction.

Params:
`page`      - Page instance.
`direction` - Keyword or string: :up :down :left :right (default :down).
`opts`      - Optional map:
  :amount   - Pixels to scroll (default 500).
  :smooth?  - When true, uses smooth animated scrolling (default false).

Returns:
Map with :scrolled, :amount, :smooth keys.
raw docstring

set-content!clj

(set-content! page html)
(set-content! page html set-opts)

Sets the HTML content of the page.

Params: page - Page instance. html - String. HTML content. opts - Map, optional. Options.

Sets the HTML content of the page.

Params:
`page` - Page instance.
`html` - String. HTML content.
`opts` - Map, optional. Options.
raw docstring

set-default-navigation-timeout!clj

(set-default-navigation-timeout! page timeout)

Sets the default navigation timeout.

Params: page - Page instance. timeout - Double. Timeout in milliseconds.

Sets the default navigation timeout.

Params:
`page`    - Page instance.
`timeout` - Double. Timeout in milliseconds.
raw docstring

set-default-timeout!clj

(set-default-timeout! page timeout)

Sets the default timeout for page operations.

Params: page - Page instance. timeout - Double. Timeout in milliseconds.

Sets the default timeout for page operations.

Params:
`page`    - Page instance.
`timeout` - Double. Timeout in milliseconds.
raw docstring

set-extra-http-headers!clj

(set-extra-http-headers! page headers)

Sets extra HTTP headers for all requests on this page.

Params: page - Page instance. headers - Map of string->string.

Sets extra HTTP headers for all requests on this page.

Params:
`page`    - Page instance.
`headers` - Map of string->string.
raw docstring

set-viewport-size!clj

(set-viewport-size! page width height)

Sets the viewport size.

Params: page - Page instance. width - Long. Width in pixels. height - Long. Height in pixels.

Sets the viewport size.

Params:
`page`   - Page instance.
`width`  - Long. Width in pixels.
`height` - Long. Height in pixels.
raw docstring

titleclj

(title page)

Returns the page title.

Params: page - Page instance.

Returns: String.

Returns the page title.

Params:
`page` - Page instance.

Returns:
String.
raw docstring

unroute!clj

(unroute! page pattern)

Removes a route handler.

Params: page - Page instance. pattern - String glob or regex Pattern.

Removes a route handler.

Params:
`page`    - Page instance.
`pattern` - String glob or regex Pattern.
raw docstring

urlclj

(url page)

Returns the current page URL.

Params: page - Page instance.

Returns: String.

Returns the current page URL.

Params:
`page` - Page instance.

Returns:
String.
raw docstring

validate-urlclj

(validate-url url)
(validate-url url raw-input)

Validates a URL string for navigation.

Params: url - String. The URL to validate. raw-input - String. The original input string (for error messages).

Returns: url if valid, or throws ex-info.

Validates a URL string for navigation.

Params:
`url`       - String. The URL to validate.
`raw-input` - String. The original input string (for error messages).

Returns:
`url` if valid, or throws ex-info.
raw docstring

videoclj

(video page)

Returns the Video for this page, if recording.

Params: page - Page instance.

Returns: Video or nil.

Returns the Video for this page, if recording.

Params:
`page` - Page instance.

Returns:
Video or nil.
raw docstring

viewport-sizeclj

(viewport-size page)

Returns the viewport size of the page.

Params: page - Page instance.

Returns: Map with :width and :height, or nil.

Returns the viewport size of the page.

Params:
`page` - Page instance.

Returns:
Map with :width and :height, or nil.
raw docstring

wait-for-downloadclj

(wait-for-download page action)
(wait-for-download page action opts)

Waits for a download to start while executing action.

Params: page - Page instance. action - No-arg function that triggers the download. opts - Optional map. {:predicate fn, :timeout ms}

Returns: Download or anomaly map on timeout.

Waits for a download to start while executing `action`.

Params:
`page`   - Page instance.
`action` - No-arg function that triggers the download.
`opts`   - Optional map. {:predicate fn, :timeout ms}

Returns:
Download or anomaly map on timeout.
raw docstring

wait-for-file-chooserclj

(wait-for-file-chooser page action)
(wait-for-file-chooser page action opts)

Waits for a file chooser dialog while executing action.

Params: page - Page instance. action - No-arg function that triggers the file chooser (e.g. clicking an input). opts - Optional map. {:predicate fn, :timeout ms}

Returns: FileChooser or anomaly map on timeout.

Example: (let [fc (page/wait-for-file-chooser pg #(locator/click (page/locator pg "input[type=file]")))] (page/file-chooser-set-files! fc "/path/to/file.txt"))

Waits for a file chooser dialog while executing `action`.

Params:
`page`   - Page instance.
`action` - No-arg function that triggers the file chooser (e.g. clicking an input).
`opts`   - Optional map. {:predicate fn, :timeout ms}

Returns:
FileChooser or anomaly map on timeout.

Example:
(let [fc (page/wait-for-file-chooser pg
           #(locator/click (page/locator pg "input[type=file]")))]
   (page/file-chooser-set-files! fc "/path/to/file.txt"))
raw docstring

wait-for-functionclj

(wait-for-function page expression)
(wait-for-function page expression opts)

Waits for a JavaScript function to return a truthy value.

Params: page - Page instance. expression - String. JavaScript expression. opts - Map, optional. Options: :timeout - Double. Timeout in ms (default 30000). :polling - Double. Polling interval in ms.

Returns: JSHandle or anomaly map on timeout.

Waits for a JavaScript function to return a truthy value.

Params:
`page`       - Page instance.
`expression` - String. JavaScript expression.
`opts`       - Map, optional. Options:
               :timeout  - Double. Timeout in ms (default 30000).
               :polling  - Double. Polling interval in ms.

Returns:
JSHandle or anomaly map on timeout.
raw docstring

wait-for-load-stateclj

(wait-for-load-state page)
(wait-for-load-state page state)

Waits for the page to reach a load state.

Params: page - Page instance. state - Keyword, optional. :load :domcontentloaded :networkidle.

Returns: nil or anomaly map on timeout.

Waits for the page to reach a load state.

Params:
`page`  - Page instance.
`state` - Keyword, optional. :load :domcontentloaded :networkidle.

Returns:
nil or anomaly map on timeout.
raw docstring

wait-for-popupclj

(wait-for-popup page action)
(wait-for-popup page action opts)

Waits for a popup page to open while executing action.

Params: page - Page instance. action - No-arg function that triggers the popup. opts - Optional map. {:predicate fn, :timeout ms}

Returns: Page (the popup) or anomaly map on timeout.

Waits for a popup page to open while executing `action`.

Params:
`page`   - Page instance.
`action` - No-arg function that triggers the popup.
`opts`   - Optional map. {:predicate fn, :timeout ms}

Returns:
Page (the popup) or anomaly map on timeout.
raw docstring

wait-for-responseclj

(wait-for-response page url-or-fn callback)

Waits for a response matching the URL or predicate.

Params: page - Page instance. url-or-fn - String or predicate fn. callback - Runnable to trigger the response.

Returns: Response or anomaly map on timeout.

Waits for a response matching the URL or predicate.

Params:
`page`      - Page instance.
`url-or-fn` - String or predicate fn.
`callback`  - Runnable to trigger the response.

Returns:
Response or anomaly map on timeout.
raw docstring

wait-for-selectorclj

(wait-for-selector page selector)
(wait-for-selector page selector wait-opts)

Waits for a selector to satisfy a condition.

Params: page - Page instance. selector - String. CSS selector. opts - Map, optional. Wait options.

Returns: ElementHandle or nil, or anomaly map on timeout.

Waits for a selector to satisfy a condition.

Params:
`page`     - Page instance.
`selector` - String. CSS selector.
`opts`     - Map, optional. Wait options.

Returns:
ElementHandle or nil, or anomaly map on timeout.
raw docstring

wait-for-timeoutclj

(wait-for-timeout page timeout)

Waits for the specified time in milliseconds.

Params: page - Page instance. timeout - Double. Time to wait in ms.

Waits for the specified time in milliseconds.

Params:
`page`    - Page instance.
`timeout` - Double. Time to wait in ms.
raw docstring

wait-for-urlclj

(wait-for-url page url)

Waits for the page to navigate to a URL.

Params: page - Page instance. url - String glob, regex Pattern, or predicate.

Waits for the page to navigate to a URL.

Params:
`page` - Page instance.
`url`  - String glob, regex Pattern, or predicate.
raw docstring

web-error-errorclj

(web-error-error we)

Returns the underlying error for this web error.

Params: we - WebError instance.

Returns: String. The error message.

Returns the underlying error for this web error.

Params:
`we` - WebError instance.

Returns:
String. The error message.
raw docstring

web-error-pageclj

(web-error-page we)

Returns the page that generated this web error, if any.

Params: we - WebError instance.

Returns: Page instance or nil.

Returns the page that generated this web error, if any.

Params:
`we` - WebError instance.

Returns:
Page instance or nil.
raw docstring

worker-evaluateclj

(worker-evaluate worker expression)
(worker-evaluate worker expression arg)

Evaluates JavaScript in the worker context.

Params: worker - Worker instance. expression - String. arg - Optional argument.

Returns: Result or anomaly map.

Evaluates JavaScript in the worker context.

Params:
`worker`     - Worker instance.
`expression` - String.
`arg`        - Optional argument.

Returns:
Result or anomaly map.
raw docstring

worker-urlclj

(worker-url worker)

Returns the worker URL.

Params: worker - Worker instance.

Returns: String.

Returns the worker URL.

Params:
`worker` - Worker instance.

Returns:
String.
raw docstring

workersclj

(workers page)

Returns all workers in the page.

Params: page - Page instance.

Returns: Vector of Worker instances.

Returns all workers in the page.

Params:
`page` - Page instance.

Returns:
Vector of Worker instances.
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close