new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Playwright · API reference · all subjects

element state & properties

37 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Frame.getAttribute() method parameters and return type

Frame.getAttribute() is an async, discouraged method that returns null or string. Parameters: selector, name (attribute name). Options: strict (boolean), timeout (float/number), signal (AbortSignal). Returns element attribute value or null if attribute doesn't exist.

Frame.innerText() method parameters and return type

Frame.innerText() is an async, discouraged method that returns string. Parameters: selector. Options: strict (boolean), timeout (float/number), signal (AbortSignal). Returns element.innerText.

Frame.isChecked() method parameters and return type

Frame.isChecked() is an async, discouraged method that returns boolean. Parameters: selector. Options: strict (boolean), timeout (float/number), signal (AbortSignal). Returns whether element is checked. Throws if element is not a checkbox or radio input.

Frame.isDisabled() method parameters and return type

Frame.isDisabled() is an async, discouraged method that returns boolean. Parameters: selector. Options: strict (boolean), timeout (float/number), signal (AbortSignal). Returns whether element is disabled, the opposite of enabled.

Frame.isEditable() method parameters and return type

Frame.isEditable() is an async, discouraged method that returns boolean. Parameters: selector. Options: strict (boolean), timeout (float/number), signal (AbortSignal). Returns whether element is editable.

Frame.isEnabled() method parameters and return type

Frame.isEnabled() is an async method that returns boolean. Parameters: selector. Options: strict (boolean), timeout (float/number), signal (AbortSignal). Returns whether element is enabled.

Frame.isHidden() method parameters and return type

Frame.isHidden() is an async, discouraged method that returns boolean. Parameters: selector. Options: strict (boolean), deprecated timeout (float, ignored). Returns whether element is hidden, the opposite of visible. Selector that doesn't match any elements is considered hidden.

Frame.isVisible() method parameters and return type

Frame.isVisible() is an async, discouraged method that returns boolean. Parameters: selector. Options: strict (boolean), deprecated timeout (float, ignored). Returns whether element is visible. Selector that doesn't match any elements is considered not visible.

Frame.textContent() method parameters and return type

Frame.textContent() is an async, discouraged method that returns null or string. Parameters: selector. Options: strict (boolean), timeout (float/number), signal (AbortSignal). Returns element.textContent.

Locator.getAttribute() method

Locator.getAttribute() is an async method that returns the matching element's attribute value as a string, or null if the attribute does not exist. Takes parameter 'name' of type string (attribute name to get). Supports timeout and signal options.

Locator.innerText() method

Locator.innerText() is an async method that returns the element.innerText value as a string. Supports timeout and signal options.

Locator.inputValue() method

Locator.inputValue() is an async method that returns the value for a matching <input>, <textarea>, or <select> element as a string. Throws if the element is not one of these types, unless inside a <label> with an associated control. Supports timeout and signal options.

Locator.isChecked() method

Locator.isChecked() is an async method that returns a boolean indicating whether the element is checked. Throws if the element is not a checkbox or radio input. Supports timeout and signal options.

Locator.isDisabled() method

Locator.isDisabled() is an async method that returns a boolean indicating whether the element is disabled (opposite of enabled). Supports timeout and signal options.

Locator.isEditable() method

Locator.isEditable() is an async method that returns a boolean indicating whether the element is editable. Throws if the target element is not an <input>, <textarea>, <select>, [contenteditable], or does not have a role allowing aria-readonly. Supports timeout and signal options.

Locator.isEnabled() method

Locator.isEnabled() is an async method that returns a boolean indicating whether the element is enabled. Supports timeout and signal options.

Locator.isHidden() method

Locator.isHidden() is an async method that returns a boolean indicating whether the element is hidden (opposite of visible). Timeout option is deprecated and ignored; method returns immediately without waiting.

Locator.isVisible() method

Locator.isVisible() is an async method that returns a boolean indicating whether the element is visible. Timeout option is deprecated and ignored; method returns immediately without waiting.

Locator.screenshot() returns Buffer with element screenshot

Locator.screenshot() returns a Buffer containing a screenshot of the element matching the locator. It waits for actionability checks, scrolls the element into view before taking the screenshot, and clips to the element's size and position. If the element is covered by other elements, they will appear in the screenshot. Returns a Buffer. Options include animations (for screenshot-options-common-list), timeout, maskColor (v1.34), style (v1.41), and signal. Available since v1.14.

Locator.scrollIntoViewIfNeeded() scrolls element into view if not fully visible

Locator.scrollIntoViewIfNeeded() waits for actionability checks, then scrolls the element into view unless it is completely visible as defined by the IntersectionObserver API's ratio. It accepts timeout and signal options. Available since v1.14.

Locator.textContent() returns element text content or null

Locator.textContent() returns the node.textContent of the element as a string, or null if the element has no text. It has options for timeout and signal. For asserting text on the page, LocatorAssertions.toHaveText() is preferred to avoid flakiness. Available since v1.14.

Locator.screenshot() example with animations disabled

Example showing Locator.screenshot() usage: ```python await page.get_by_role("link").screenshot(animations="disabled", path="link.png") ``` This disables animations and saves the screenshot to a file.

assertions-ignore-case

The ignoreCase parameter is type boolean. Whether to perform case-insensitive match. Takes precedence over regex flag if specified.

assertions-max-diff-pixels for JavaScript

The maxDiffPixels parameter is type int. Acceptable pixels different. Configurable with TestConfig.expect. Unset by default.

assertions-max-diff-pixel-ratio for JavaScript

The maxDiffPixelRatio parameter is type float. Acceptable ratio of different pixels (0-1). Configurable with TestConfig.expect. Unset by default.

assertions-threshold for JavaScript

The threshold parameter is type float. Acceptable perceived color difference in YIQ color space between pixels (0 strict to 1 lax). Configurable with TestConfig.expect. Defaults to 0.2.

Page.getAttribute - get element attribute value

Page.getAttribute() is an async method (since v1.8, discouraged in favor of Locator.getAttribute, returns null|string) that returns an element's attribute value. Accepts: selector (CSS selector), name (string - the attribute name to retrieve). Options: strict (boolean, since v1.14), timeout (number, since v1.8), signal (AbortSignal).

Page.innerHTML - get element innerHTML

Page.innerHTML() is an async method (since v1.8, discouraged in favor of Locator.innerHTML, returns string) that returns element.innerHTML for a matching element. Accepts: selector (CSS selector). Options: strict (boolean, since v1.14), timeout (number, since v1.8), signal (AbortSignal).

Page.innerText - get element innerText

Page.innerText() is an async method (since v1.8, discouraged in favor of Locator.innerText, returns string) that returns element.innerText for a matching element. Accepts: selector (CSS selector). Options: strict (boolean, since v1.14), timeout (number, since v1.8), signal (AbortSignal).

Page.inputValue - get input or select value

Page.inputValue() is an async method (since v1.13, discouraged in favor of Locator.inputValue, returns string) that returns input.value for selected input, textarea, or select elements. Throws for non-input elements, but returns control value for elements inside label with associated control. Accepts: selector (CSS selector). Options: strict (boolean, since v1.14), timeout (number, since v1.13), signal (AbortSignal).

Page.isChecked - check if element is checked

Page.isChecked() is an async method (since v1.8, discouraged in favor of Locator.isChecked, returns boolean) that returns whether an element is checked. Throws if element is not a checkbox or radio input. Accepts: selector (CSS selector). Options: strict (boolean, since v1.14), timeout (number, since v1.8), signal (AbortSignal).

Page.isClosed - check if page is closed

Page.isClosed() is a synchronous method (since v1.8, returns boolean) that indicates whether the page has been closed.

Page.isDisabled - check if element is disabled

Page.isDisabled() is an async method (since v1.8, discouraged in favor of Locator.isDisabled, returns boolean) that returns whether an element is disabled (opposite of enabled). Accepts: selector (CSS selector). Options: strict (boolean, since v1.14), timeout (number, since v1.8), signal (AbortSignal).

Page.isEditable - check if element is editable

Page.isEditable() is an async method (since v1.8, discouraged in favor of Locator.isEditable, returns boolean) that returns whether an element is editable. Accepts: selector (CSS selector). Options: strict (boolean, since v1.14), timeout (number, since v1.8), signal (AbortSignal).

Page.isEnabled - check if element is enabled

Page.isEnabled() is an async method (since v1.8, discouraged in favor of Locator.isEnabled, returns boolean) that returns whether an element is enabled. Accepts: selector (CSS selector). Options: strict (boolean, since v1.14), timeout (number, since v1.8), signal (AbortSignal).

Page.isHidden - check if element is hidden

Page.isHidden() is an async method (since v1.8, discouraged in favor of Locator.isHidden, returns boolean) that returns whether an element is hidden (opposite of visible). A selector that doesn't match any elements is considered hidden. Accepts: selector (CSS selector). Options: strict (boolean, since v1.14). The timeout option is deprecated and ignored.

Page.isVisible - check if element is visible

Page.isVisible() is an async method (since v1.8, discouraged in favor of Locator.isVisible, returns boolean) that returns whether an element is visible. A selector that doesn't match any elements is considered not visible. Returns immediately without waiting. Accepts: selector (CSS selector). Options: strict (boolean, since v1.14). The timeout option is deprecated and ignored.

Give your agent this brain