# Browser 21.0.0 — keyword reference

> Every keyword of the Robot Framework Browser library 21.0.0, with its arguments, return value and documentation, followed by every argument type. Keyword names are case-insensitive in Robot Framework, and spaces and underscores in them are ignored.

Source: https://robotframework-browser.org/keywords

## Contents

- Library documentation
- Importing
- Keywords (alphabetical)
- Types

## Library documentation

Browser library is a browser automation library for Robot Framework.

This is the keyword documentation for Browser library. For installation, guides and everything else, see [robotframework-browser.org](https://robotframework-browser.org). For more information about Robot Framework itself, see [robotframework.org](https://robotframework.org).

Browser library uses [Playwright Node module](https://github.com/microsoft/playwright) to automate [Chromium](https://www.chromium.org/Home), [Firefox](https://www.mozilla.org/en-US/firefox/new/) and [WebKit](https://webkit.org/) with a single library.

### Table of contents

-   `Browser, Context and Page`
-   `Automatic page and context closing`
-   `Finding elements`
    -   `Strategies`
    -   `Explicit and implicit strategy`
    -   `Text matching`
    -   `Chaining`
    -   `iFrames`
    -   `Shadow DOM`
    -   `Element references`
-   `Assertions`
-   `Implicit waiting`
-   `Experimental: Re-using same node process`
-   `Scope Setting`
-   `Using Browser from Python`
-   `Language`
-   `ENVIRONMENT VARIABLES`

### Browser, Context and Page

Browser library works in three layers that build on each other.

| Layer | Is | Opened with |
| --- | --- | --- |
| **Browser** | A browser process: `chromium`, `firefox` or `webkit`. | `New Browser` |
| **Context** | An isolated session in that process: its own cookies, storage and permissions. Contexts share nothing with each other. | `New Context` |
| **Page** | A tab, with its own content and history. Selectors resolve here. | `New Page` |

Playwright brings its own browser binaries, so no separate driver is needed. A browser starts `headless` unless `New Browser`'s `headless` argument is set to `False`.

| Engine | Ships in |
| --- | --- |
| `chromium` | Google Chrome, Microsoft Edge, Opera |
| `firefox` | Mozilla Firefox |
| `webkit` | Safari on macOS and iOS |

The layers fill themselves in downwards: `New Page` with nothing open starts a browser and a context first, using defaults. `Open Browser` opens all three at once and is meant for experiments and debugging rather than for suites.

A context is the cheap unit of isolation — opening one is roughly a thousand times cheaper than starting a browser, so a clean session per test does not mean a new process. Context-level settings include `viewport`, `geolocation`, `locale`, `colorScheme` and `httpCredentials`; downloads are accepted unless `acceptDownloads=False` is given.

Each browser, context and page has an id. `Get Browser Catalog` returns everything currently open.

Which layer to open for which job, and the cost of each: [https://robotframework-browser.org/docs/concepts/browser-context-page](https://robotframework-browser.org/docs/concepts/browser-context-page)

### Automatic page and context closing

Controls when contexts and pages are closed during the test execution.

If automatic closing level is `TEST`, contexts and pages that are created during a single test are automatically closed when the test ends. Contexts and pages that are created during suite setup are closed when the suite teardown ends.

If automatic closing level is `SUITE`, all contexts and pages that are created during the test suite are closed when the suite teardown ends.

If automatic closing level is `MANUAL`, nothing is closed automatically while the test execution is ongoing. All browsers, context and pages are automatically closed when test execution ends.

If automatic closing level is `KEEP`, nothing is closed automatically while the test execution is ongoing. Also, nothing is closed when test execution ends, including the node process. Therefore, it is users responsibility to close all browsers, context and pages and ensure that all process that are left running after the test execution end are closed. This level is only intended for test case development and must not be used when running tests in CI or similar environments.

Automatic closing can be configured or switched off with the auto\_closing\_level library import parameter.

See: `Importing`

### Finding elements

Keywords that act on an element take a `selector` argument. A selector is one or more clauses, each naming a strategy, chained with `>>`.

Under strict mode a selector matching more than one element fails the keyword. It is on by default, changeable in the library `importing` or with `Set Strict Mode`, and each keyword's documentation states whether it applies.

### Strategies

| Strategy | Matches on | Example |
| --- | --- | --- |
| `role` | ARIA role, with optional accessible name. | `role=button[name="Login"]` |
| `data-testid` | `data-testid` attribute. | `data-testid=login` |
| `text` | Text content. See `Text matching`. | `text=Login` |
| `id` | Element ID attribute. | `id=login_btn` |
| `css` | CSS selector. | `css=.class > \#login_btn` |
| `xpath` | XPath expression. | `xpath=//input[@id="login_btn"]` |
| `data-test-id` | `data-test-id` attribute. | `data-test-id=login` |
| `data-test` | `data-test` attribute. | `data-test=login` |
| `css:light` | As `css`, but does not pierce shadow DOM. | `css:light=.class` |
| `label` | Label, as Playwright's `getByLabel`. | `label=Email` |

An attribute engine is equivalent to the matching css attribute selector: `data-test-id=foo` is `css=[data-test-id="foo"]`.

`css:light` is the only non-piercing engine still supported. All other locator, except `xpath`, pierce shadow DOM automatically.

Two filters narrow what a clause already matched. Filter order changes the result.

| Filter | Selects | Example |
| --- | --- | --- |
| `nth` | The nth match, zero based. `0` first, `-1` last. | `css=button >> nth=1` |
| `visible` | Only visible, or only hidden, matches. | `css=button >> visible=true` |

Playwright's CSS pseudo-classes (`:has()`, `:has-text()`, `:nth-match()`) and its layout selectors (`:right-of()`, `:below()`) are available inside a `css` clause. Which strategy to prefer, and the full list with examples: [https://robotframework-browser.org/docs/concepts/selectors](https://robotframework-browser.org/docs/concepts/selectors)

### Explicit and implicit strategy

A strategy is named with a `strategy=value` prefix. Spaces around the separator are ignored, so `css=foo`, `css= foo` and `css = foo` are the same.

Without a prefix the strategy is inferred:

| Selector starts with | Read as | Example |
| --- | --- | --- |
| `//` or `..` | `xpath` | `//span/button` is `xpath=//span/button` |
| `"` or `'` | `text`, exact | `"Login"` is `text="Login"` |
| anything else | `css` | `span > button` is `css=span > button` |

Because `#` starts a comment in Robot Framework data, an id selector must be escaped as `\#id`.

`css` follows the [CSS selector](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_selectors) specification and `xpath` the [XPath](https://developer.mozilla.org/en-US/docs/Web/XPath) specification; neither is re-documented here.

### Text matching

The `text` engine matches a text node, and the value of `button` and `submit` inputs. In keywords that insert text it also matches a field by its label.

| Form | Matches |
| --- | --- |
| `text=Login` | Substring, case-insensitive, leading and trailing whitespace ignored. |
| `text="Login "` | Exact: case, whitespace and all. Escape a quote as `\"`. |
| `text=/^Hi .*!$/i` | JavaScript-style [regular expression](https://regex101.com/) with flags: e.g. `i` for case-insensitive. |

### Chaining

Clauses are separated by `>>` and each searches inside the result of the previous one. The chain returns what the last clause matched; prefix a clause with `*` to return that one instead. A value containing `>>` or `>>>` must be quoted, as in `text="some >> text"`; a regular expression (`text=/a>>b/`) cannot contain them.

```robotframework
Click    css=.checkout >> text=Confirm
Get Element    *css=article >> text=Hello    # returns the article
```

### iFrames

A chain does not cross a frame boundary. `>>>`, with whitespace around it, combines a selector for the frame element with a selector inside it; the clause immediately before `>>>` must select the frame itself. Without whitespace, `a>>>b` is read as `a >> >b`, as it always was.

```robotframework
Click    id=iframe >>> id=btn
```

A selector that starts with `>>>` searches in every frame of the page, the main frame included, so the frames around the element need not be named. The rest of the selector must match inside a single frame; elements in several frames are an error, also without strict mode and in keywords that count or list elements such as `Get Element Count`. With a selector prefix set, the prefix comes first and `>>>` enters the frame it selects, as before; a prefix of only `>>>` searches every frame.

```robotframework
Click    >>> id=btn                   # a button in any frame, or the page itself
Click    >>> id=inner >>> id=btn      # a button in the frame inner, wherever that frame is
```

For several keywords inside one frame, set a prefix with `Set Selector Prefix`.

### Shadow DOM

All engines, except `css:light` and `xpath`, pierce open shadow roots automatically: every descendant combinator, including the implicit one at the start of a selector, crosses any number of them. Light DOM is searched first, then open shadow roots, in document order. Closed shadow roots are never entered, and iframes only with `>>>`.

Use `css:light` to stop at the shadow boundary. Worked examples of what each matches: [https://robotframework-browser.org/docs/concepts/selectors](https://robotframework-browser.org/docs/concepts/selectors)

### Element references

`Get Element` returns a **selector string** for what it matched, and `Get Elements` returns a list of them. They are ordinary selectors, so they go in the **first** clause of another selector, chained with `>>`:

```robotframework
${ref}=    Get Element    .some_class
           Click          ${ref} >> .some_child
           Click          ${ref} >> .other_child
```

Clauses after the reference are relative to it. Because the value is a selector rather than a captured DOM node, it is resolved from the page again on every use. A reference works like any other first clause, `>>>` included: if it points at an iframe, `${ref} >>> h1` crosses into it.

### Assertions

Keywords taking `assertion_operator` <`AssertionOperator`\> and `assertion_expected` can assert on the value they return, and still return it. An assertion retries until it passes or `retry_assertions_for` expires; see `Importing` for that setting, which defaults to 1 second.

Currently supported assertion operators are:

| Operator | Alternative Operators | Description | Validate Equivalent |
| --- | --- | --- | --- |
| `==` | `equal`, `equals`, `should be` | Checks if returned value is equal to expected value. | `value == expected` |
| `!=` | `inequal`, `should not be` | Checks if returned value is not equal to expected value. | `value != expected` |
| `>` | `greater than` | Checks if returned value is greater than expected value. | `value > expected` |
| `>=` |  | Checks if returned value is greater than or equal to expected value. | `value >= expected` |
| `<` | `less than` | Checks if returned value is less than expected value. | `value < expected` |
| `<=` |  | Checks if returned value is less than or equal to expected value. | `value <= expected` |
| `*=` | `contains` | Checks if returned value contains expected value as substring. | `expected in value` |
|  | `not contains` | Checks if returned value does not contain expected value as substring. | `expected in value` |
| `^=` | `should start with`, `starts` | Checks if returned value starts with expected value. | `re.search(f"^{expected}", value)` |
| `$=` | `should end with`, `ends` | Checks if returned value ends with expected value. | `re.search(f"{expected}$", value)` |
| `matches` |  | Checks if given RegEx matches minimum once in returned value. | `re.search(expected, value)` |
| `validate` |  | Checks if given Python expression evaluates to `True`. |  |
| `evaluate` | `then` | When using this operator, the keyword does return the evaluated Python expression. |  |

There are three different possibilities what keyword returns when matches operator is used: string, tuple or dictionary. What keyword returns depends on how the RegEx is formed. If RegEx does not contain group(s), then keyword will return the string without modifications. If RegEx contains groups, meaning (...), then keyword will return a tuple. Each tuple item contains the text which is matched by the group. If there is group and group has a name, (?P<name>...) syntax, then keyword returns a dictionary. In this case dictionary key is the group name and value contains the matched text. If there mix of groups and groups with names, then tuple is returned.

Currently supported formatters for assertions are:

| Formatter | Description |
| --- | --- |
| `normalize spaces` | Substitutes multiple spaces to single space from the value |
| `strip` | Removes spaces from the beginning and end of the value |
| `case insensitive` | Converts value to lower case before comparing |
| `apply to expected` | Applies rules also for the expected value |

Formatters are applied to the value before assertion is performed and keywords returns a value where rule is applied. Formatter is only applied to the value which keyword returns and not all rules are valid for all assertion operators. If `apply to expected` formatter is defined, then formatters are then formatter are also applied to expected value.

Expected values are generally used as given, so they must already have the type returned by the keyword. Keywords returning numbers are an exception and convert the expected value.

Examples:

-   `Get Text` returns a string even when it looks like a number
-   `Get Element Count` returns an integer.
-   `Get BoundingBox` and `Get Viewport Size` return a dictionary unfiltered and a number when a key is selected.

Comparing strings with `<` or `>` compares code points character by character and stops at the first difference; length is never considered. Example: `A < Z`, `Z < a`, `ac < dc`, `'abcde' < 'abd'`.

`validate` takes a Python expression over `value`. `then` and `evaluate` do not assert: they return the result of an expression over `value`.

```robotframework
Get Text             h1      validate    value.startswith("Welcome")
${id}=    Get Property    a#link    href    then    value.split("/")[-1]
```

A failing assertion has a default message, replaceable with `message`. It accepts the [format](https://docs.python.org/3/library/stdtypes.html#str.format) fields `{value}`, `{expected}`, `{value_type}` and `{expected_type}`.

What each operator is for, why a type mismatch is the usual failure, and the formatters that normalise a value before comparison: [https://robotframework-browser.org/docs/concepts/assertions](https://robotframework-browser.org/docs/concepts/assertions)

### Implicit waiting

Browser library and Playwright have many mechanisms to help in waiting for elements. Playwright will auto-wait before performing actions on elements. Please see [Auto-waiting on Playwright documentation](https://playwright.dev/docs/actionability/) for more information.

On top of Playwright auto-waiting Browser assertions will wait and retry for specified time before failing any `Assertions`. Time is specified in Browser library initialization with `retry_assertions_for`.

Browser library also includes explicit waiting keywords such as `Wait for Elements State` if more control for waiting is needed.

### Experimental: Re-using same node process

The Node.js side can be started as a standalone process and shared by every Browser library running on the same machine, instead of each one starting its own. This can speed up parallel runs. Start it from the directory where the Browser package is installed with \` PLAYWRIGHT\_BROWSERS\_PATH=0 node Browser/wrapper/index.js HOST PORT \` , for example `... index.js 127.0.0.1 12345`. Both arguments are required: the script reads the host first and exits with `No port defined` if only one is given. Point runs at it with the `playwright_process_port` import parameter or the `ROBOT_FRAMEWORK_BROWSER_NODE_PORT` environment variable, for example `ROBOT_FRAMEWORK_BROWSER_NODE_PORT=PORT pabot ..`.

What this costs, how to run it under Pabot, and how to pass Node flags such as `--inspect`: [https://robotframework-browser.org/docs/operations/node-process](https://robotframework-browser.org/docs/operations/node-process)

### Scope Setting

Some keywords which manipulates library settings have a scope argument. With that scope argument one can set the "live time" of that setting. Available Scopes are: `Global`, `Suite` and `Test` / `Task`. See `Scope`. Is a scope finished, this scoped setting, like timeout, will no longer be used.

Live Times:

-   A `Global` scope will live forever until it is overwritten by another `Global` scope. Or locally temporarily overridden by a more narrow scope.
-   A `Suite` scope will locally override the `Global` scope and live until the end of the Suite within it is set, or if it is overwritten by a later setting with `Global` or same scope. Children suite does inherit the setting from the parent suite but also may have its own local `Suite` setting that then will be inherited to its children suites.
-   A `Test` or `Task` scope will be inherited from its parent suite but when set, lives until the end of that particular test or task.

A new set higher order scope will always remove the lower order scope which may be in charge. So the setting of a `Suite` scope from a test, will set that scope to the robot file suite where that test is and removes the `Test` scope that may have been in place.

### Using Browser from Python

Browser keywords can be called directly from Python, from your own Robot Framework library. Arguments convert the same way Robot Framework converts them, so `browser.click("//button", "middle")` works, and a Python `None` is passed through unchanged. Robot Framework's own features do not all follow: `Automatic page and context closing` and `Scope Setting` need Browser's listener to be registered, and `run_on_failure` never applies to a keyword your library calls from Python.

Getting started, and what your own library gets in each case: [https://robotframework-browser.org/docs/extending/python-libraries](https://robotframework-browser.org/docs/extending/python-libraries)

### Language

Keyword names and their documentation can be translated. Install a Python package whose name starts with `robotframework_browser_translation` and set the `language` import parameter to the language that the package declares; Browser discovers it on the module search path through the Python plugin API.

A template for a new translation, containing every keyword in the correct format, is produced by `rfbrowser translation /path/to/translation.json`. Keywords coming from library plugins and JavaScript extensions can be included with the `--plugings` and `--jsextension` arguments.

Writing and packaging a translation: [https://robotframework-browser.org/docs/extending/translations](https://robotframework-browser.org/docs/extending/translations)

### ENVIRONMENT VARIABLES

These environment variables modify the behaviour of the library. Two of them are development features and must not be set in production; they are listed here so that nobody uses them by accident.

| Environment variable | Description |
| --- | --- |
| `ROBOT_FRAMEWORK_BROWSER_NODE_PORT` | Port number for connecting to an existing node process. This is an alternative to `playwright_process_port` import argument. |
| `ROBOT_FRAMEWORK_BROWSER_NODE_COVERAGE` | If set to `1`, will collect code coverage for the node process. This must not be used in production environments and is not supported on Windows. |
| `ROBOT_FRAMEWORK_BROWSER_NODE_DEBUG_OPTIONS` | Debug options for the node process. This is a comma-separated list of arguments, for example `--inspect`. This must not be used in production environments. |

Which of these to prefer over an import parameter, and how they behave with BrowserBatteries: [https://robotframework-browser.org/docs/operations/environment-variables](https://robotframework-browser.org/docs/operations/environment-variables)

## Importing

`Library    Browser`, with these optional arguments:

- `*_` — Positional arguments are ignored. All arguments must be passed as named arguments.
- `auto_closing_level: AutoClosingLevel = TEST` (named-only) — Configure context and page automatic closing. Default is `TEST`, for more details, see AutoClosingLevel
- `auto_delete_passed_tracing: bool = False` (named-only) — If `auto_closing_level` is set to `SUITE` or `TEST` and `tracing` of `New Context` active, traces of passed tests or suites, depending on the context scope, will not be saved. Also temp files will all be deleted after the whole execution ends.
- `enable_playwright_debug: PlaywrightLogTypes | bool = library` (named-only) — Enable low level debug information from the playwright to playwright-log.txt file. For more details, see PlaywrightLogTypes.
- `enable_presenter_mode: HighLightElement | bool = False` (named-only) — Automatic highlights the interacted components, slowMo and a small pause at the end. Can be enabled by giving True or can be customized by giving a dictionary: `{"duration": "2 seconds", "width": "2px", "style": "dotted", "color": "blue"}` Where duration is time format in Robot Framework format, defaults to 2 seconds. width is width of the marker in pixels, defaults the `2px`. `style` is the style of border, defaults to `dotted`. `color` is the color of the marker, defaults to `blue`. By default, the call banner keyword is also enabled unless explicitly disabled.
- `external_browser_executable: dict[SupportedBrowsers, str] | None = None` (named-only) — Dict mapping name of browser to path of executable of a browser. Will make opening new browsers of the given type use the set executablePath. Currently only configuring of `chromium` to a separate executable (chrome, chromium and Edge executables all work with recent versions) works.
- `highlight_on_failure: bool = False` (named-only) — If set to `True`, will highlight the element in the screenshot when a keyword fails, by highlighting the selector used in the failed keyword. If set to `False`, will not highlight the element.
- `jsextension: list[str] | str | None = None` (named-only) — Path to JavaScript modules exposed as extra keywords. The modules must be in CommonJS format; exported functions become keywords and an `fn.rfdoc` string becomes a keyword's documentation. The argument names `page`, `context`, `browser`, `logger`, `playwright`, `adoptContext` and `defaultTimeout` are filled in by the library rather than taken from the keyword call. `defaultTimeout` is the library timeout in milliseconds, as `Set Browser Timeout` sets it; only a Python library that calls the function with `call_js_keyword` may pass its own instead. `adoptContext(context, options)` makes a BrowserContext that the function created itself, such as the context of an Electron app, the active browser, so the other keywords work on it. The context gets the library timeout, and is traced and recorded like a context of `New Context`. Can be a single path, a comma-separated list of paths or a real list of strings. The options of `adoptContext` and examples are in [https://robotframework-browser.org/docs/extending/javascript-extensions](https://robotframework-browser.org/docs/extending/javascript-extensions)
- `language: str | None = None` (named-only) — Defines language which is used to translate keyword names and documentation.
- `playwright_process_host: str | None = None` (named-only) — Hostname / Host address which should be used when spawning the Playwright process. Defaults to 127.0.0.1.
- `playwright_process_port: int | None = None` (named-only) — Experimental reusing of playwright process. `playwright_process_port` is preferred over environment variable `ROBOT_FRAMEWORK_BROWSER_NODE_PORT`. See `Experimental: Re-using same node process` for more details.
- `plugins: list[str] | str | None = None` (named-only) — Allows extending the Browser library with external Python classes, which can add keywords and modify some internal behaviour without forking the library. Can be a single class/module, a comma-separated list or a real list of strings. See [https://robotframework-browser.org/docs/extending/python-plugins](https://robotframework-browser.org/docs/extending/python-plugins)
- `retry_assertions_for: timedelta = 0:00:01` (named-only) — Timeout for retrying assertions on keywords before failing the keywords. This timeout starts counting from the first failure. Global `timeout` will still be in effect. This allows stopping execution faster to assertion failure when element is found fast.
- `run_on_failure: str = Take Screenshot \ fail-screenshot-{index}` (named-only) — Sets the keyword to execute in case of a failing Browser keyword. It can be the name of any keyword. If the keyword has arguments those must be separated with two spaces for example `My keyword \ arg1 \ arg2`. If no extra action should be done after a failure, set it to `None` or any other robot falsy value. Run on failure is not applied when library methods are executed directly from Python.
- `selector_prefix: str | None = None` (named-only) — Prefix for all selectors. This is useful when you need to add an iframe selector before each selector.
- `show_keyword_call_banner: bool | None = None` (named-only) — If set to `True`, will show a banner with the keyword name and arguments before the keyword is executed at the bottom of the page. If set to `False`, will not show the banner. If set to None, which is the default, will show the banner only if the presenter mode is enabled. `Get Page Source` and `Take Screenshot` will not show the banner, because that could negatively affect your test cases/tasks. This feature may be super helpful when you are debugging your tests and using the `tracing` or `recordVideo` arguments of `New Context`.
- `strict: bool = True` (named-only) — If keyword selector points multiple elements and keywords should interact with one element, keyword will fail if `strict` mode is true. Strict mode can be changed individually in keywords or by `Set Strict Mode` keyword.
- `timeout: timedelta = 0:00:10` (named-only) — Timeout for keywords that operate on elements. The keywords will wait for this time for the element to appear into the page. Defaults to "10s" => 10 seconds.
- `tracing_group_mode: TracingGroupMode = Full` (named-only) — Defines how Robot Framework keyword calls are logged in Playwright trace log. Default is `Full`.

## Keywords

### Add Cookie

Arguments:

- `name: str` — Name of the cookie.
- `value: str` — Given value for the cookie.
- `url: str | None = None` — Given url for the cookie. Defaults to None. Either `url` or the `domain` / `path` pair must be set, but not both.
- `domain: str | None = None` — Given domain for the cookie. Defaults to None. Either `url` or the `domain` / `path` pair must be set, but not both.
- `path: str | None = None` — Given path for the cookie. Defaults to None. Either `url` or the `domain` / `path` pair must be set, but not both.
- `expires: str | datetime | None = None` — Given expiry for the cookie. Can be a date, a unix time or a datetime object. Supports the same formats as the [DateTime](http://robotframework.org/robotframework/latest/libraries/DateTime.html) library or an epoch timestamp. Example: `2027-09-28 16:21:35`
- `httpOnly: bool | None = None` — Sets the httpOnly token.
- `secure: bool | None = None` — Sets the secure token.
- `sameSite: CookieSameSite | None = None` — Sets the sameSite mode. Can be `Strict`, `Lax` or `None`.

Tags: BrowserControl, Setter

Adds a cookie to the currently active browser context.

Example:

```robotframework
Add Cookie   foo   bar   http://address.com/path/to/site                                     # Using url argument.
Add Cookie   foo   bar   domain=example.com                path=/foo/bar                     # Using domain and path arguments.
Add Cookie   foo   bar   http://address.com/path/to/site   expires=2027-09-28 16:21:35       # Expires as timestamp.
Add Cookie   foo   bar   http://address.com/path/to/site   expires=1822137695                # Expires as epoch seconds.
```

### Add Locator Handler Click

Arguments:

- `selector: str` — Is the selector to the element which indicates that the locator handler should be called.
- `click_selector: str` — Is the selector to the element to be clicked.
- `noWaitAfter: bool = True` (named-only) — Defaults to `True`, which means that the overlay may stay visible after the handler has run. If set to `False`, Playwright waits until the overlay becomes hidden, and only then the library continues with the action/assertion that triggered the handler.
- `times: int | None = None` (named-only) — Is how many times the locator handler is called. `None`, the default, means unlimited.
- `click_clickCount: int = 1` (named-only) — Is the number of times to click the element. Defaults to 1.
- `click_delay: int = 0` (named-only) — Time to wait between mousedown and mouseup in milliseconds. Defaults to 0.
- `click_force: bool = False` (named-only) — Whether to bypass checks and dispatch the event directly. Defaults to false.

Tags: PageContent, Setter

Add a handler function which will activate when `selector` is visible and click.

The handler will click the element indicated by `click_selector`.

When testing a web page, sometimes unexpected overlays, for example an "Accept Cookies" dialog, might appear and block the interaction with the page, like the `Click` keyword. These overlays can be problematic to handle, because they might appear randomly in the page. This keyword allows to create an automatic method, which will close those overlays by clicking the element indicated by `click_selector`. The handler is activated when the element indicated by `selector` is visible. For further information, see Playwright's [addLocatorHandler](https://playwright.dev/docs/api/class-page#page-add-locator-handler) method.

The arguments `click_selector`, `click_clickCount`, `click_delay` and `click_force` correspond to the arguments of the `Click With Options` keyword, but `click_delay` is given as a plain number of milliseconds. The `selector`, `noWaitAfter` and `times` are for the locator handler. The handler is tied to the active page, if there is need to add handler to another page, this keyword needs to be called separately for each page. If the `times` argument is set to a positive value, the locator handler is removed after the handler has been called the specified number of times.

Example add locator handler to click button with id="ButtonInOverlay" when id=Overlay is visible:

```robotframework
New Page    ${URL}
Add Locator Handler Click    id=Overlay    id=ButtonInOverlay     # Add locator handler to page
Type Text    id:username    user    # If element with id=Overlay appears, the handler will click the button id=ButtonInOverlay
Type Text    id:password    password    # Or if overlay is visible here, then handler is called here
Click    id:login
Remove Locator Handler    id=Overlay    # Removes the locator handler from page
```

### Add Locator Handler Custom

Arguments:

- `selector: str` — Is the selector to the element which indicates that the locator handler should be called.
- `handler_spec: list[dict]` — Is a list of dictionaries which defines the actions to be performed.
- `noWaitAfter: bool = True` — Defaults to `True`, which means that the overlay may stay visible after the handler has run. If set to `False`, Playwright waits until the overlay becomes hidden, and only then the library continues with the action/assertion that triggered the handler.
- `times: int | None = None` — Is how many times the locator handler is called. `None`, the default, means unlimited.

Tags: PageContent, Setter

Add a handler function which will activate when `selector` is visible and performs handler specification.

When the element indicated by `selector` is visible, the handler will perform the actions specified in the `handler_spec`.

The `handler_spec` is a list of dictionaries, where each dictionary defines one action. The dictionary must contain the key `action` which defines the action to be performed. The action can be one of the following: [click](https://playwright.dev/docs/api/class-locator#locator-click), [fill](https://playwright.dev/docs/api/class-locator#locator-fill), [check](https://playwright.dev/docs/api/class-locator#locator-check) and [uncheck](https://playwright.dev/docs/api/class-locator#locator-uncheck). Action is also case insensitive. The dictionary must also contain the key `selector` which defines the element to be interacted with. The `fill` action must also contain the key `value` which defines the value to be filled in the element. For the other actions the key `value` must not be defined. Additional keys are passed to the action as keyword arguments. For example for the [click](https://playwright.dev/docs/api/class-locator#locator-click) action refer to Playwright's documentation to see which options are possible.

The selectors in the `handler_spec` are not resolved in strict mode. If a selector matches more than one element, the first matching element is used. If an action in the handler fails, the error is only logged on the Browser library node side and the keyword which triggered the handler does not fail because of it.

The `selector`, `noWaitAfter` and `times` are for the locator handler [method](https://playwright.dev/docs/api/class-page#page-add-locator-handler). The handler is tied to the active page, if there is need to add handler to another page, this keyword needs to be called separately for each page. If the `times` argument is set to a positive value, the locator handler is removed after the handler has been called the specified number of times.

Running the handler will alter your page state mid-test. For example it will change the currently focused element and move the mouse. Make sure that keywords that run after the handler are self-contained and do not rely on the focus and mouse state being unchanged.

Please note that the automatic argument conversion is not done for the `handler_spec` dictionary. This is because Robot Framework does not convert values inside the dictionary that are actually arguments to a separate Playwright API call. Therefore the user is responsible for converting the values to the correct type. For example if a timeout is needed, the value must be converted to a number on the Robot Framework test data side.

Example adds locator handler to fill input id=overlayInput with value "Hello" and click element id=OverlayCloseButton when id=Overlay is visible:

```robotframework
New Page    ${URL}
VAR    &{handler_spec_fill}
...    action=Fill
...    selector=id=overlayInput
...    value=Hello
VAR    &{handler_spec_click}
...    action=click
...    selector=id=OverlayCloseButton
Add Locator Handler Custom
...    id=overlay
...    [${handler_spec_fill}, ${handler_spec_click}]
Type Text    id:username    user    # If element with id=overlay appears, the handler fills id=overlayInput and clicks id=OverlayCloseButton
Type Text    id:password    password    # Or if overlay is visible here, then handler is called here
Click    id:login
```

Example with click and different options and types:

```robotframework
VAR    &{handler_spec}
...    action=CLICK    # Action is case insensitive
...    selector=id=OverlayCloseButton
...    button=left
...    clickCount=${1}
...    delay=${0.1}
...    force=${True}
Add Locator Handler Custom    id=overlay    [${handler_spec}]
```

The keyword can only handle click, fill, check and uncheck Playwright API calls. If there is a need for more complex interactions, it is recommended to create a custom js extension to handle the interactions.

Example:

```robotframework
async function customLocatorHandler(locator, pageLocator, clickLocator, page) {
    console.log("Adding custom locator handler for: " + locator);
    const pageLocator = page.locator(locator).first();
    await page.addLocatorHandler(
        pageLocator,
        async () => {
            console.log("Handling custom locator: " + clickLocator);
            // More complex interactions can be added here
            await page.locator(clickLocator).click();
        }
    );
}
exports.__esModule = true;
exports.customLocatorHandler = customLocatorHandler;
```

### Add Style Tag

Arguments:

- `content: str` — Raw CSS content to be injected into the current page.

Tags: PageContent, Setter

Adds a <style type="text/css"> tag with the content.

The tag is added to the currently active page and it is lost when the page is navigated to a new url.

Example:

```robotframework
Add Style Tag    \#username_field:focus {background-color: aqua;}
```

### Advance Clock

Arguments:

- `time: timedelta` — The time to advance. Supports Robot Framework time format
- `advance_type: CLockAdvanceType = fast_forward` — The type of advance. Default is `fast_forward`.

Tags: Clock, Setter

Advances the clock by a specified amount of time.

`run_for` advances the clock by firing all the time-related callbacks.

`fast_forward` advances the clock by jumping forward in time. It fires due timers at most once.

### Cancel Download

Arguments:

- `download: DownloadInfo | str` — A `DownloadInfo` object or id of the download to be canceled.

Tags: BrowserControl, Setter

Cancels an active download.

### Check Checkbox

Arguments:

- `selector: str` — Selector of the checkbox. See the `Finding elements` section for details about the selectors.
- `force: bool = False` — Set to `True` to skip Playwright's [Actionability checks](https://playwright.dev/docs/actionability).

Tags: PageContent, Setter

Checks the checkbox or selects radio button found by `selector`.

Keyword uses strict mode, see `Finding elements` for more details about strict mode.

Does nothing if the element is already checked/selected.

### Clear Permissions

Arguments: none

Tags: BrowserControl, Setter

Clears all permissions from the current context.

### Clear Text

Arguments:

- `selector: str` — Selector of the text field. See the `Finding elements` section for details about the selectors.

Tags: PageContent, Setter

Clears the text field found by `selector`.

Keyword uses strict mode, see `Finding elements` for more details about strict mode.

### Click

Arguments:

- `selector: str` — Selector element to click. See the `Finding elements` section for details about the selectors.
- `button: MouseButton = left` — Mouse button to click with. One of `left`, `middle` or `right`. Defaults to `left`.

Tags: PageContent, Setter

Simulates mouse click on the element found by `selector`.

This keyword clicks an element matching `selector` by performing the following steps:

-   Find an element matching the selector. If there is none, wait until a matching element is attached to the DOM.
-   Wait for actionability checks on the matched element. If the element is detached during the checks, the whole action is retried.
-   Scroll the element into view if needed.
-   Use `Mouse Button` to click in the center of the element.
-   Wait for initiated navigation to either succeed or fail.

Keyword uses strict mode, see `Finding elements` for more details about strict mode.

See `Click With Options` if you need modifiers, a click count, a click position or want to skip the actionability checks.

Example:

```robotframework
Click    id=button_location
Click    id=button_location    left
Click    id=button_location    right
```

### Click With Options

Arguments:

- `selector: str` — Selector element to click. See the `Finding elements` section for details about the selectors.
- `button: MouseButton = left` — Mouse button to click with. One of `left`, `middle` or `right`. Defaults to `left`.
- `*modifiers: KeyboardModifier` — Modifier keys to press. Ensures that only these modifiers are pressed during the click, and then restores current modifiers back. If not specified, currently pressed modifiers are used. Modifiers can be specified in any order, and multiple modifiers can be specified. Valid modifier keys are `Alt`, `Control`, `ControlOrMeta`, `Meta` and `Shift`. Due to the fact that the argument `*modifiers` is a positional only argument, all preceding keyword arguments have to be specified as positional arguments before `*modifiers`.
- `clickCount: int = 1` (named-only) — How many times the button is clicked. Defaults to 1.
- `delay: timedelta | None = None` (named-only) — Time to wait between mouse-down and mouse-up. Defaults to no delay.
- `force: bool = False` (named-only) — Set to `True` to skip Playwright's Actionability checks ([https://playwright.dev/docs/actionability](https://playwright.dev/docs/actionability)). Defaults to `False`.
- `noWaitAfter: bool = False` (named-only) — Deprecated. This option will default to true in the future. Actions that initiate navigation, are waiting for these navigation to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `False`.
- `position_x: float | None = None` (named-only) — A point to click relative to the top-left corner of element bounding-box. Only positive values within the bounding-box are allowed. Both values must be given, otherwise the position is ignored. If not specified, clicks to some visible point of the element.
- `position_y: float | None = None` (named-only) — A point to click relative to the top-left corner of element bounding-box. Only positive values within the bounding-box are allowed. Both values must be given, otherwise the position is ignored. If not specified, clicks to some visible point of the element.
- `trial: bool = False` (named-only) — When set, this method only performs the actionability checks and skips the action. Defaults to `False`. Useful to wait until the element is ready for the action without performing it.

Tags: PageContent, Setter

Simulates mouse click on the element found by `selector`.

This keyword clicks an element matching `selector` by performing the following steps:

-   Find an element matching the selector. If there is none, wait until a matching element is attached to the DOM.
-   Wait for actionability checks on the matched element, unless the `force` option is set. If the element is detached during the checks, the whole action is retried.
-   Scroll the element into view if needed.
-   Use `Mouse Button` to click in the center of the element, or the specified position.
-   Wait for initiated navigation to either succeed or fail, unless the `noWaitAfter` option is set.

Arguments `clickCount`, `delay`, `position_x`, `position_y`, `force`, `noWaitAfter` and `trial` are named-only arguments and must be specified using their names.

Keyword uses strict mode, see `Finding elements` for more details about strict mode.

Example:

```robotframework
Click With Options    id=button_location
Click With Options    id=button_location    trial=True
Click With Options    \#clickWithOptions    delay=100ms    clickCount=2
Click With Options    id=clickWithModifiers    left     Alt    Meta    Shift    clickCount=1    force=True
Click With Options    id=clickWithOptions    right    clickCount=2    force=True
```

### Close Browser

Arguments:

- `browser: SelectionType | str = CURRENT` — Browser to close. `CURRENT` selects the active browser. `ALL` closes all browsers. When a browser id is provided, that browser is closed.

Tags: BrowserControl, Setter

Closes the current browser.

Active browser is set to the browser that was active before this one. Closes all context and pages belonging to this browser. See `Browser, Context and Page` for more information about Browser and related concepts.

Example:

```robotframework
Close Browser    ALL        # Closes all browsers
Close Browser    CURRENT    # Close current browser
Close Browser               # Close current browser
Close Browser    ${id}      # Close browser matching id
```

Closing is given at least 20 seconds to finish, and twice the current `Set Browser Timeout` value when that is longer. A browser that has stopped responding therefore fails this keyword instead of hanging the run, and a short Browser timeout does not cut the closing short.

### Close Browser Server

Arguments:

- `wsEndpoint: str` — Address of the browser server. Example: `ws://127.0.0.1:63784/ca69bf0e9471391e8183d9ac1e90e1ba`

Returns: `None`

Tags: BrowserControl, Setter

Close a playwright Browser Server identified by its websocket endpoint (wsEndpoint).

The wsEndpoint string is returned by `Launch Browser Server` and is also used by `Connect To Browser`.

### Close Context

Arguments:

- `context: SelectionType | str = CURRENT` — Context to close. `CURRENT` selects the active context. `ALL` selects all contexts. When a context id is provided, that context is closed.
- `browser: SelectionType | str = CURRENT` — Browser in which contexts are closed. `CURRENT` selects the active browser. `ALL` selects all browsers. When a browser id is provided, contexts of that browser are closed. The browsers themselves are not closed.
- `save_trace: bool = True` (named-only) — If set to `False`, the trace of this context is not saved, even if it was enabled by `New Context`. Defaults to `True`.

Tags: BrowserControl, Setter

Closes a Context.

Active context is set to the context that was active before this one. Closes pages belonging to this context. See `Browser, Context and Page` for more information about Context and related concepts.

Example:

```robotframework
Close Context                          #  Closes the current context of the current browser
Close Context    CURRENT    CURRENT    #  Closes the current context of the current browser
Close Context    ALL        CURRENT    #  Closes all contexts of the current browser
Close Context    ALL        ALL        #  Closes all contexts of all browsers
```

Closing is given at least 20 seconds to finish, and twice the current `Set Browser Timeout` value when that is longer. A browser that has stopped responding therefore fails this keyword instead of hanging the run, and a short Browser timeout does not cut the closing short.

### Close Page

Arguments:

- `page: SelectionType | NewPageDetails | str = CURRENT` — Page to close. `CURRENT` selects the active page. `ALL` selects all pages. When a page id is provided, that page is closed.
- `context: SelectionType | str = CURRENT` — Context in which pages are closed. `CURRENT` selects the active context. `ALL` selects all contexts. When a context id is provided, pages of that context are closed. The contexts themselves are not closed.
- `browser: SelectionType | str = CURRENT` — Browser in which pages are closed. `CURRENT` selects the active browser. `ALL` selects all browsers. When a browser id is provided, pages of that browser are closed. The browsers themselves are not closed.
- `runBeforeUnload: bool = False` — defines whether to run the [before unload](https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event) page handlers. Defaults to false.

Returns: `list[dict]`

Tags: BrowserControl, Setter

Closes the `page` in `context` in `browser`.

Defaults to current for all three. Active page is set to the page that was active before this one. See `Browser, Context and Page` for more information about Page and related concepts.

If a page id is given, the `context` and `browser` arguments are ignored and the page is searched from all open browsers. Likewise, if a context id is given, the `browser` argument is ignored.

Returns a list of dictionaries containing id, errors and console messages from the page.

Example:

```robotframework
Close Page                                       # Closes current page, within the current context and browser
Close Page    CURRENT     CURRENT     CURRENT    # Closes current page, within the current context and browser
Close Page    ALL         ALL         ALL        # Closes all pages, within all contexts and browsers
```

### Connect To Browser

Arguments:

- `wsEndpoint: str` — Address to connect to. Either `ws://` or `http://` if cdp is used.
- `browser: SupportedBrowsers = chromium` — Opens the specified browser. Defaults to `chromium`.
- `use_cdp: bool = False` — Connect to browser via Chrome DevTools Protocol. Defaults to False. Works only with Chromium based browsers.
- `timeout: timedelta = 0:00:30` (named-only) — Maximum time in Robot Framework time format to wait for the connection to be established. Defaults to 30 seconds. The timeout can not be disabled; `0` also means 30 seconds.

Tags: BrowserControl, Setter

Connect to a Playwright browser server via playwright websocket or Chrome DevTools Protocol.

See `Launch Browser Server` for more information about how to launch a playwright browser server.

See `Browser, Context and Page` for more information about Browser and related concepts.

Returns a stable identifier for the connected browser.

To connect to a browser via Chrome DevTools Protocol, the browser must be started with this protocol enabled. This is typically done by starting a Chrome browser with the argument `--remote-debugging-port=9222` or similar. When the browser is running with activated CDP, it is possible to connect to it either with websockets (`ws://`) or via HTTP (`http://`). The HTTP connection can be used when `use_cdp` is set to True. A typical address for a CDP connection is `http://127.0.0.1:9222`.

### Crawl Site

Arguments:

- `url: str | None = None` — is the page to start crawling from. If it is given, a `New Page` is opened with that url. If it is not given, crawling starts from the url of the current page.
- `page_crawl_keyword=take_screenshot` — is the keyword that will be executed on every page. It is run without arguments. By default it will take a screenshot on every page.
- `max_number_of_page_to_crawl: int = 1000` — is the upper limit of pages to crawl. Crawling will stop when this number of pages has been crawled.
- `max_depth_to_crawl: int = 50` — is the upper limit of consecutive links followed from the start page. The start page has depth `0` and links deeper than this limit are not followed.

Tags: Crawling

Web crawler is a tool to go through all the pages on a specific URL domain. This happens by finding all links going to the same site and opening those. Links pointing to another scheme or host are ignored, as are download links.

Returns the list of crawled urls. The order of the returned urls is not guaranteed to be the order in which the pages were crawled.

### Create Credential

Arguments:

- `rpId: str` — Relying party id (typically the site's effective domain).
- `id_: str | None = None` — Base64url-encoded credential id. Auto-generated if omitted.
- `privateKey: Secret | str | None = None` — Base64url-encoded PKCS#8 (DER) private key. Auto-generated if omitted.
- `publicKey: Secret | str | None = None` — Base64url-encoded SPKI (DER) public key. Auto-generated if omitted.
- `userHandle: str | None = None` — Base64url-encoded user handle. Auto-generated if omitted.

Tags: Credential, Setter

Creates a credential with the given parameters.

Will always [create](https://playwright.dev/docs/api/class-credentials#credentials-create) and [install](https://playwright.dev/docs/api/class-credentials#credentials-install) the credential, even if the optional parameters are not provided. In this case Playwright will autogenerate the missing values.

The credential is created in the currently active context and it is used by all pages that are created from that context. There must be an open context, otherwise the keyword fails.

Because `privateKey` and `publicKey` are sensitive information, it is recommended to wrap their values in the Secret type. The Secret type requires Robot Framework 7.4 or newer. If you are using Robot Framework 7.3 or older, the keyword supports resolving `privateKey` and `publicKey` from Robot Framework variables and environment variables in the following ways. The keyword resolves the value from a Robot Framework variable internally, when the variable is prefixed with `$`, without the curly braces. Example: `$publicKey` will resolve to the `${publicKey}` Robot Framework variable.

If the `privateKey` or `publicKey` value is prefixed with `%`, the library will resolve the corresponding environment variable. Example: `%PUBLICKEY` will resolve to the `%{PUBLICKEY}` environment variable.

Plain values are not accepted. If the given `privateKey` or `publicKey` is not a Secret and does not resolve to another value, the keyword fails with an error stating that direct assignment of values or variables is not allowed.

Example:

```robotframework
New Context
${credentials} =    Get Credentials   # This is a helper keyword that returns a dictionary with the required credential parameters.
Create Credential
...    rpId=${DOMAIN_NAME}
...    id_=${credentials["id"]}
...    privateKey=${credentials["privateKey"]}    # This should be a Secret type or a string starting with $ which resolves to a Robot Framework variable.
...    publicKey=${credentials["publicKey"]}    # This should be a Secret type or a string starting with $ which resolves to a Robot Framework variable.
...    userHandle=${credentials["userHandle"]}
New Page    ${SUT_URL}
Click    id=login
Get Text    id=status    ==    Success
```

### Delete All Cookies

Arguments: none

Tags: BrowserControl, Setter

Deletes all cookies from the currently active browser context.

### Delete Credential

Arguments:

- `id_: str` — Base64url-encoded credential id.

Tags: Credential, Setter

Deletes the credential with the given id.

Deleting a credential which does not exist does not fail. There must be an open context, otherwise the keyword fails.

Example:

```robotframework
Delete Credential    id_=${CREDENTIAL_ID}
```

### Deselect Options

Arguments:

- `selector: str` — Selector of the select tag. See the `Finding elements` section for details about the selectors.

Tags: PageContent, Setter

Deselects all options from select element found by `selector`.

If you just want to select one or more specific options and currently more options are selected, use `Select Options By` keyword with the options to be selected in the end.

Keyword uses strict mode, see `Finding elements` for more details about strict mode.

### Download

Arguments:

- `url: str` — URL to the file that shall be downloaded.
- `saveAs: str = ` — Path where the file shall be saved persistently. If empty, generated unique path (GUID) is used and file is deleted when the context is closed.
- `wait_for_finished: bool = True` — If set to `False` keyword returns immediately after the download has started. Defaults to `True`.
- `download_timeout: timedelta | None = None` — Maximum total time for the file to be fetched and saved. If the file is not fetched within this time, the keyword fails. If it is fetched but not saved, the download is cancelled and the keyword fails. If `wait_for_finished` is `False`, only the fetching is limited. If not set, the file must be fetched within the browser timeout, see `Set Browser Timeout`, and there is no limit for saving it.

Returns: `DownloadInfo`

Tags: Page Content

Download given url content.

Keyword returns dictionary of type `DownloadInfo`.

Example:

```robotframework
{
  "saveAs": "/tmp/robotframework-browser/downloads/2f1b3b7c-1b1b-4b1b-9b1b-1b1b1b1b1b1b",
  "suggestedFilename": "downloaded_file.txt",
  "state": "finished",
  "downloadID": None,
}
```

When `wait_for_finished` is `False`, the returned dictionary has an empty `saveAs`, the `state` is `in_progress` and `downloadID` contains the id of the download. The download can then be followed with the `Get Download State` keyword, which also saves the file to `saveAs` when the download is finished.

If the download should be started by an interaction with an element on the page, `Promise To Wait For Download` keyword may be a better choice.

The keyword `New Browser` has a `downloadsPath` setting which can be used to set the default download directory. If `saveAs` is set to a relative path, the file will be saved relative to the browser's `downloadsPath` setting or if that is not set, relative to the Playwright's working directory. If `saveAs` is set to an absolute path, the file will be saved to that absolute path independent of `downloadsPath`.

To enable downloads context's `acceptDownloads` needs to be true, otherwise the keyword fails. This keyword requires that there is currently an open page and that the page has been navigated to an url, downloading from `about:blank` fails. The download is done by a `fetch` call inside the page and therefore it uses the current page's local state (cookies, sessionstorage, localstorage) to avoid authentication problems. Because of that, a relative `url` is resolved against the current page url and the page's cross-origin restrictions apply.

The whole file is fetched before the browser reports the download as started. Set `download_timeout` when fetching the file can take longer than the browser timeout, for example with large files or slow servers.

Example:

```robotframework
${file_object}=    Download    ${url}    download_timeout=2 minutes
${actual_size}=    Get File Size    ${file_object.saveAs}
```

Example 2:

```robotframework
${href}=          Get Property    text="Download File"    href
Download    ${href}    saveAs=${OUTPUT DIR}/downloads/downloaded_file.txt
File Should Exist    ${OUTPUT DIR}/downloads/downloaded_file.txt
```

### Drag And Drop

Arguments:

- `selector_from: str` — Identifies the element whose center is the start-point.
- `selector_to: str` — Identifies the element whose center is the end-point.
- `steps: int = 1` — Defines how many intermediate mouse move events are sent. Often it is necessary to send more than one intermediate event to get the desired result. Defaults to 1.

Tags: PageContent, Setter

Executes a Drag&Drop operation from the element selected by `selector_from` to the element selected by `selector_to`.

See the `Finding elements` section for details about the selectors.

First it moves the mouse to the start-point, then presses the left mouse button, then moves to the end-point in specified number of steps, then releases the mouse button.

Start- and end-point are defined by the center of the elements' bounding box.

Keyword uses strict mode, see `Finding elements` for more details about strict mode.

Example

```robotframework
Drag And Drop    "Circle"    "Goal"
```

### Drag And Drop By Coordinates

Arguments:

- `from_x: float` — Identify the start-point on page.
- `from_y: float` — Identify the start-point on page.
- `to_x: float` — Identify the end-point.
- `to_y: float` — Identify the end-point.
- `steps: int = 1` — Defines how many intermediate mouse move events are sent. Often it is necessary to send more than one intermediate event to get the desired result. Defaults to 1.

Tags: PageContent, Setter

Executes a Drag&Drop operation from a coordinate to another coordinate.

First it moves the mouse to the start-point, then presses the left mouse button, then moves to the end-point in specified number of steps, then releases the mouse button.

Start- and end-point are defined by `x` and `y` coordinates relative to the top left corner of the pages viewport.

Example:

```robotframework
Drag And Drop By Coordinates
...    from_x=30    from_y=30
...    to_x=10    to_y=10    steps=20
```

### Drag And Drop Relative To

Arguments:

- `selector_from: str` — Identifies the element whose center is the start-point.
- `x: float = 0.0` — Identify the end-point, which is relative to the start-point.
- `y: float = 0.0` — Identify the end-point, which is relative to the start-point.
- `steps: int = 1` — Defines how many intermediate mouse move events are sent. Often it is necessary to send more than one intermediate event to get the desired result. Defaults to 1.

Tags: PageContent, Setter

Executes a Drag&Drop operation from the element selected by `selector_from` to coordinates relative to the center of that element.

This keyword can be handy to simulate swipe actions.

See the `Finding elements` section for details about the selectors.

First it moves the mouse to the start-point (center of the bounding box), then presses the left mouse button, then moves to the relative position with the given intermediate steps, then releases the mouse button.

Keyword uses strict mode, see `Finding elements` for more details about strict mode.

Example

```robotframework
Drag And Drop Relative To    "Circle"    -20    0     # Slides the element 20 pixels to the left
```

### Eat All Cookies

Arguments: none

Eat all cookies for all easter.

### Emulate Media

Arguments:

- `colorScheme: ColorScheme | None = None` — Emulates the `prefers-color-scheme` media feature, supported values are `light` and `dark`. Passing `null` disables color scheme emulation. `no-preference` is deprecated.
- `forcedColors: ForcedColors | NotSet = not_set` — Emulates the `forced-colors` media feature, supported values are `active` and `none`. Passing `null` disables forced colors emulation.
- `media: Media | None = None` — Changes the CSS media type of the page. The only allowed values are `screen`, `print` and `null`. Passing `null` disables CSS media emulation.
- `reducedMotion: ReducedMotion | None = None` — Emulates the `prefers-reduced-motion` media feature, supported values are `reduce` and `no-preference`. Passing `null` disables reduced motion emulation.

Returns: `dict`

Tags: PageContent, Setter

Changes the CSS media type.

It changes the CSS media type through the `media` argument, and/or the `prefers-color-scheme` media feature, using the `colorScheme` argument. This is useful to render the page in the correct format before using the `Save Page As Pdf` keyword.

Arguments which are left to their default value are not sent to Playwright at all and therefore the corresponding emulation is left unchanged.

### Evaluate JavaScript

Arguments:

- `selector: str | None = None` — Selector to resolve and pass to the JavaScript function. This will be the first argument the function receives if not `${None}`. `selector` is optional and can be omitted. If given a selector, a function is necessary, with an argument to capture the element. For example `(element) => document.activeElement === element`. See the `Finding elements` section for details about the selectors.
- `*function: str` — A valid javascript function or a javascript function body. These arguments can be used to write readable multiline JavaScript.
- `arg: Any = None` (named-only) — an additional argument that can be handed over to the JavaScript function. It is the second argument of the function when a `selector` is given, otherwise the first one. This argument must be JSON serializable. ElementHandles are not supported.
- `all_elements: bool = False` (named-only) — defines if only the single element found by `selector` is handed over to the function or if set to `True` all found elements are handed over as array.

Returns: `Any`

Tags: Getter, PageContent, Setter

Executes the given JavaScript in the browser page.

The JavaScript is evaluated in the context of the page, not in the Node process of the library. Therefore browser globals like `window` and `document` are available, but Robot Framework variables and Python objects are not. Only `arg` and the resolved element(s) are passed into the page.

The value returned by the JavaScript is transferred as JSON and must therefore be JSON serializable. DOM nodes and other non serializable objects can not be returned. If the JavaScript does not return anything, the keyword returns an empty string.

Example with `all_elements=True`:

```robotframework
 ${texts}=    Evaluate JavaScript    button
 ...    (elements, arg) => {
 ...        let text = []
 ...            for (e of elements) {
 ...                console.log(e.innerText)
 ...                text.push(e.innerText)
 ...            }
 ...        text.push(arg)
 ...        return text
 ...    }
 ...    all_elements=True
 ...    arg=Just another Text
```

Keyword uses strict mode only if `all_elements` is `False`. See `Finding elements` for more details about strict mode.

[Usage examples.](https://github.com/MarketSquare/robotframework-browser/tree/main/atest/test/06_Examples/js_evaluation.robot)

### Fill Secret

Arguments:

- `selector: str` — Selector of the text field. See the `Finding elements` section for details about the selectors.
- `secret: str | Secret` — The secret string that should be filled into the text field. Supports Robot Framework 7.4 Secret type as normal variable (with curly braces). Also environment variable name with % prefix or a local variable with $ prefix that has the secret text value (without curly braces).
- `force: bool = False` — Set to `True` to skip Playwright's [Actionability checks](https://playwright.dev/docs/actionability).

Tags: PageContent, Setter

Fills the given `secret` into the text field found by `selector`.

This keyword does not log the secret in Robot Framework logs, but if Playwright debug logs are enabled, the secret will be visible as plain text in the Playwright debug logs, regardless of the Robot Framework log level or how `secret` is resolved.

This keyword supports Robot Framework 7.4 [Secret](https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#secret-variables) variable type, which is the recommended way if you are using Robot Framework 7.4 or newer.

For older Robot Framework versions the keyword supports resolving secrets from environment variables and Robot Framework variables in the following ways. The keyword resolves the `secret` from a Robot Framework variable internally, when the `secret` variable is prefixed with `$`, without the curly braces. Example: `$Password` will resolve to the `${Password}` Robot Framework variable.

If the `secret` variable is prefixed with `%`, the library will resolve the corresponding environment variable. Example: `%ENV_PWD` will resolve to the `%{ENV_PWD}` environment variable.

**Using normal Robot Framework variables like `${password}`, which are not Secret type variables, will not work!**

**Normal plain text will not work.** If you want to use plain text, use the `Fill Text` keyword instead.

This keyword also works with a cryptographic cipher text that has been encrypted by CryptoLibrary. See [CryptoLibrary](https://github.com/Snooz82/robotframework-crypto) for more details.

Keyword uses strict mode, see `Finding elements` for more details about strict mode.

See `Fill Text` for other details.

Example:

```robotframework
Fill Secret    input#username_field    ${username}    # Keyword resolves variable value from Robot Framework Secret type variables
Fill Secret    input#username_field    $username      # Keyword resolves variable value from Robot Framework variables
Fill Secret    input#username_field    %username      # Keyword resolves variable value from environment variables
```

### Fill Text

Arguments:

- `selector: str` — Selector of the text field. See the `Finding elements` section for details about the selectors.
- `txt: str` — Text for the text field.
- `force: bool = False` — Set to `True` to skip Playwright's [Actionability checks](https://playwright.dev/docs/actionability).

Tags: PageContent, Setter

Clears and fills the given `txt` into the text field found by `selector`.

This keyword waits for an element matching the `selector` to appear, waits for actionability checks, focuses the element, fills it and triggers an input event after filling.

If the element matching the selector is not an <input>, <textarea> or \[contenteditable\] element, this keyword fails. Note that you can pass an empty string as `txt` to clear the input field.

Keyword uses strict mode, see `Finding elements` for more details about strict mode.

See `Type Text` for emulating typing text character by character.

Example:

```robotframework
Fill Text    css=input#username_field    username
```

### Focus

Arguments:

- `selector: str` — Selector of the element. See the `Finding elements` section for details about the selectors.

Tags: PageContent, Setter

Moves focus on to the element found by `selector`.

Keyword uses strict mode, see `Finding elements` for more details about strict mode.

If there is no element matching the selector, the keyword waits until a matching element appears in the DOM. It fails if the element does not appear within the library timeout, which is 10 seconds by default and can be changed with `Set Browser Timeout`.

### Get Aria Snapshot

Arguments:

- `selector: str` — Selector from which the info is to be retrieved. See the `Finding elements` section for details about the selectors.
- `return_type: AriaSnapshotReturnType = yaml` — Defines the return type. Possible values are `yaml` (default), `dict` and `parsed`. If `yaml` is selected, the returned value is a string in YAML format. If `dict` is selected, the returned value is a dictionary. If `parsed` is selected, the returned value is a tree of node dictionaries.
- `assertion_operator: AssertionOperator | None = None` — See `Assertions` for further details. Defaults to None.
- `assertion_expected: Any | None = None` — Expected value for the state
- `message: str | None = None` — overrides the default error message for assertion.
- `mode: AriaSnapshotMode = default` (named-only) — Defines the snapshot mode. Possible values are `default` (default) and `ai`. See `AriaSnapshotMode` for more details.
- `depth: int | None = None` (named-only) — Limits the snapshot to the given number of tree levels. Must be a positive integer. Defaults to `None`, which does not limit the depth.
- `boxes: bool = False` (named-only) — If `True`, the bounding box of each element is appended to its line as `[box=x,y,width,height]`. Coordinates are relative to the viewport, in CSS pixels. Defaults to `False`.

Returns: `str | dict | list | tuple`

Tags: Assertion, Getter, PageContent

Returns the aria snapshot of the element found by `selector`. See `AriaSnapshotReturnType` for more details and examples.

Keyword uses strict mode, see `Finding elements` for more details about strict mode.

With `mode=ai` the snapshot is optimized for AI consumption: it contains element references like `[ref=e2]` and the content of iframes inside the element. It also does not wait for a matching element, but fails immediately when no element matches, instead of failing with a timeout like the `default` mode does.

With `return_type=dict` the YAML returned by Playwright is loaded as is. The `[ref=...]` and `[box=...]` annotations are therefore part of the dictionary keys, not separate entries. Use `return_type=parsed` to get them as separate values of each node.

Optionally asserts that the snapshot matches the specified assertion. See `Assertions` for further details for the assertion arguments. By default assertion is not done.

Example:

```robotframework
${aria} =    Get Aria Snapshot    id=main   # returns YAML string
Log Many    ${aria}
${aria_dict} =    Get Aria Snapshot    id=main    dict   # returns dictionary
Log Many    ${aria_dict}
```

### Get Attribute

Arguments:

- `selector: str` — Selector from which the info is to be retrieved. See the `Finding elements` section for details about the selectors.
- `attribute: str` — Requested attribute name.
- `assertion_operator: AssertionOperator | None = None` — See `Assertions` for further details. Defaults to None.
- `assertion_expected: Any | None = None` — Expected value for the state
- `message: str | None = None` — overrides the default error message for assertion.

Returns: `str | tuple | dict | None`

Tags: Assertion, Getter, PageContent

Returns the HTML `attribute` of the element found by `selector`.

Keyword uses strict mode, see `Finding elements` for more details about strict mode.

Optionally asserts that the attribute value matches the expected value. See `Assertions` for further details for the assertion arguments. By default assertion is not done.

When an attribute is selected that is not present and no assertion operator is set, the keyword fails. If an assertion operator is set and the attribute is not present, the returned value is `None`. This can be used to check the presence or the absence of an attribute.

Example Element:

```robotframework
<button class="login button active" id="enabled_button" something>Login</button>
```

Example Code:

```robotframework
Get Attribute   id=enabled_button    disabled                   # FAIL => "Attribute 'disabled' not found!"
Get Attribute   id=enabled_button    disabled     ==    ${None}     # PASS => returns: None
Get Attribute   id=enabled_button    something    evaluate    value is not None    # PASS =>  returns: True
Get Attribute   id=enabled_button    disabled     evaluate    value is None        # PASS =>  returns: True
```

### Get Attribute Names

Arguments:

- `selector: str` — Selector from which the info is to be retrieved. See the `Finding elements` section for details about the selectors.
- `assertion_operator: AssertionOperator | None = None` — See `Assertions` for further details. Defaults to None.
- `*assertion_expected` — Expected value for the state
- `message: str | None = None` (named-only) — overrides the default error message for assertion.

Returns: `list[str]`

Tags: Assertion, Getter, PageContent

Returns all HTML attribute names of an element as a list.

Keyword uses strict mode, see `Finding elements` for more details about strict mode.

Optionally asserts that the attribute names match the expected values. See `Assertions` for further details for the assertion arguments. By default assertion is not done.

Available assertions:

-   `==` , `!=` and `contains` / `*=` can work with multiple values
-   `validate` and `evaluate` only accept one single expected value

Other operators are not allowed.

Example:

```robotframework
Get Attribute Names    [name="readonly_input"]    ==    type    name    value    readonly    # Has exactly these attribute names.
Get Attribute Names    [name="readonly_input"]    contains    disabled    # Contains at least this attribute name.
```

### Get BoundingBox

Arguments:

- `selector: str` — Selector from which the bounding box shall be retrieved. See the `Finding elements` section for details about the selectors.
- `key: BoundingBoxFields = ALL` — Optionally filters the returned values. If keys is set to `ALL` (default) it will return the BoundingBox as Dictionary, otherwise it will just return the single value selected by the key. Note: If a single value is retrieved, an assertion does **not** need a `validate` combined with a cast of `value`.
- `assertion_operator: AssertionOperator | None = None` — See `Assertions` for further details. Defaults to None.
- `assertion_expected: Any | None = None` — Expected value for the assertion
- `message: str | None = None` — overrides the default error message for assertion.
- `allow_hidden: bool = False` (named-only) — (named only) If True, hidden elements are not causing a failure and will return `None`. Otherwise a hidden element will fail. Defaults to False.

Returns: `BoundingBox | float | int | None`

Tags: Assertion, Getter, PageContent

Gets elements size and location as an object `{x: float, y: float, width: float, height: float}`.

Alternatively you can select a single attribute of the bounding box by setting the `key` argument.

If an element is hidden and has no bounding box, the keyword will fail. Depending on the method used to make an element invisible, an element might still have a bounding box which can be retrieved. To allow also hidden elements without a bounding box, set `allow_hidden` to `True`, which results in a return value of `None` in case of no bounding box.

Keyword uses strict mode, see `Finding elements` for more details about strict mode.

Optionally asserts that the value matches the specified assertion. See `Assertions` for further details for the assertion arguments. By default assertion is not done.

Example use:

```robotframework
${bounding_box}=    Get BoundingBox    id=element                 # unfiltered
Log                 ${bounding_box}                                 # {'x': 559.09375, 'y': 75.5, 'width': 188.796875, 'height': 18}
${x}=               Get BoundingBox    id=element    x            # filtered
Log                 X: ${x}                                         # X: 559.09375
# Assertions:
Get BoundingBox     id=element         width         >    180
Get BoundingBox     id=element         ALL           validate    value['x'] > value['y']*2
```

### Get Browser Catalog

Arguments:

- `assertion_operator: AssertionOperator | None = None` — Optional assertion operator. See `Assertions` for more information.
- `assertion_expected: Any | None = None` — Optional expected value. See `Assertions` for more information.
- `message: str | None = None` — Optional custom message to use on failure. See `Assertions` for more information.

Returns: `list[BrowserInfo]`

Tags: Assertion, BrowserControl, Getter

Returns all browsers, open contexts in them and open pages in these contexts.

See `Browser, Context and Page` for more information about these concepts.

The data is parsed into a python list containing data representing the open Objects.

On the root level the data contains a list of open browsers. The `type` of a browser is `chromium`, `firefox` or `webkit`. For a context that a JavaScript extension adopted, it is the name the extension passed, `adopted` by default; see `jsextension` in `Importing`.

Data can be manipulated also with `assertion_operator` for example to find a specific id based on index or page title with `then` operator.

Return value can also be asserted against expected value.

Sample:

```robotframework
[
  {
    "type": "chromium",
    "id": "browser=96207191-8147-44e7-b9ac-5e04f2709c1d",
    "contexts": [
      {
        "type": "context",
        "id": "context=525d8e5b-3c4e-4baa-bfd4-dfdbc6e86089",
        "activePage": "page=f90c97b8-eaaf-47f2-98b2-ccefd3450f12",
        "pages": [
          {
            "type": "page",
            "title": "Robocorp",
            "url": "https://robocorp.com/",
            "id": "page=7ac15782-22d2-48b4-8591-ff17663fa737",
            "timestamp": 1598607713.858
          },
          {
            "type": "page",
            "title": "Home - Reaktor",
            "url": "https://www.reaktor.com/",
            "id": "page=f90c97b8-eaaf-47f2-98b2-ccefd3450f12",
            "timestamp": 1598607714.702
          }
        ]
      }
    ],
    "activeContext": "context=525d8e5b-3c4e-4baa-bfd4-dfdbc6e86089",
    "activeBrowser": false
  },
  {
    "type": "firefox",
    "id": "browser=ad99abac-17a9-472b-ac7f-d6352630834e",
    "contexts": [
      {
        "type": "context",
        "id": "context=bc64f1ba-5e76-46dd-9735-4bd344afb9c0",
        "activePage": "page=8baf2991-5eaf-444d-a318-8045f914e96a",
        "pages": [
          {
            "type": "page",
            "title": "Software-Qualitätssicherung und Softwaretest",
            "url": "https://www.imbus.de/",
            "id": "page=8baf2991-5eaf-444d-a318-8045f914e96a",
            "timestamp": 1598607716.828
          }
        ]
      }
    ],
    "activeContext": "context=bc64f1ba-5e76-46dd-9735-4bd344afb9c0",
    "activeBrowser": true
  }
]
```

### Get Browser Ids

Arguments:

- `browser: SelectionType = ALL` — The browser to get the ids from. `ALL` for all open browsers or `ACTIVE` for the currently active browser.
- `assertion_operator: AssertionOperator | None = None`
- `*assertion_expected: Any | None`
- `message: str | None = None` (named-only)

Returns: `list[str]`

Tags: Assertion, BrowserControl, Getter

Returns a list of ids from open browsers. See `Browser, Context and Page` for more information about Browser and related concepts.

`browser` Defaults to `ALL`

-   `ALL` / `ANY` Returns all ids as a list.
-   `ACTIVE` / `CURRENT` Returns the id of the currently active browser as list.

The ACTIVE browser is a synonym for the CURRENT Browser.

### Get Checkbox State

Arguments:

- `selector: str` — Selector which shall be examined. See the `Finding elements` section for details about the selectors.
- `assertion_operator: AssertionOperator | None = None` — `==` and `!=` and equivalent are allowed on boolean values. Other operators are not accepted.
- `assertion_expected: bool | str = Unchecked` — Boolean value of expected state. Strings are interpreted as booleans. All strings are `${True}` except the following: `FALSE`, `NO`, `OFF`, `0`, `UNCHECKED`, `NONE`, `${EMPTY}` (case-insensitive). Defaults to `UNCHECKED`.
- `message: str | None = None` — overrides the default error message for assertion.

Returns: `bool`

Tags: Assertion, Getter, PageContent

Returns the state of the checkbox found by `selector`.

Optionally asserts that the state matches the specified assertion. See `Assertions` for further details for the assertion arguments. By default assertion is not done.

-   `CHECKED` => `True`
-   `UNCHECKED` => `False`

Keyword uses strict mode, see `Finding elements` for more details about strict mode.

Example:

```robotframework
Get Checkbox State    [name=can_send_email]    ==    checked
```

### Get Classes

Arguments:

- `selector: str` — Selector from which the info is to be retrieved. See the `Finding elements` section for details about the selectors.
- `assertion_operator: AssertionOperator | None = None` — See `Assertions` for further details. Defaults to None.
- `*assertion_expected` — Expected values for the state
- `message: str | None = None` (named-only) — overrides the default error message for assertion.

Returns: `list[str]`

Tags: Assertion, Getter, PageContent

Returns all classes of an element as a list.

Keyword uses strict mode, see `Finding elements` for more details about strict mode.

Optionally asserts that the value matches the specified assertion. See `Assertions` for further details for the assertion arguments. By default assertion is not done.

Available assertions:

-   `==` , `!=` and `contains` / `*=` can work with multiple values
-   `validate` and `evaluate` only accept one single expected value

Other operators are not allowed.

Example:

```robotframework
Get Classes    id=draggable    ==    react-draggable    box    # Element has exactly these class names.
Get Classes    id=draggable    validate    "react-draggable-dragged" not in value    # Element does not contain react-draggable-dragged class.
```

### Get Client Size

Arguments:

- `selector: str | None = None` — Optional selector from which the client size shall be retrieved. If no selector is given the client size of the page itself is used (`document.scrollingElement`). See the `Finding elements` section for details about the selectors.
- `key: SizeFields = ALL` — Optionally filters the returned values. If keys is set to `ALL` (default) it will return the client size as dictionary, otherwise it will just return the single value selected by the key.
- `assertion_operator: AssertionOperator | None = None` — See `Assertions` for further details. Defaults to None.
- `assertion_expected: Any | None = None` — Expected value for the assertion
- `message: str | None = None` — overrides the default error message for assertion.

Returns: `Dimensions | float`

Tags: Assertion, Getter, PageContent

Gets elements or pages client size (`clientHeight`, `clientWidth`) as object {width: float, height: float}.

Keyword uses strict mode, see `Finding elements` for more details about strict mode.

Optionally asserts that the value matches the specified assertion. See `Assertions` for further details for the assertion arguments. By default assertion is not done.

See `Get BoundingBox` or `Get Scroll Size` for examples.

### Get Console Log

Arguments:

- `assertion_operator: AssertionOperator | None = None` — Optional assertion operator. See `Assertions` for more information.
- `assertion_expected: Any | None = None` — Optional expected value. See `Assertions` for more information.
- `message: str | None = None` — Optional custom message to use on failure. See `Assertions` for more information.
- `full: bool = False` (named-only) — If true, returns the full console log. If false, returns only new entries that were added since last time.
- `last: int | timedelta | None = None` (named-only) — If set, returns only the last n entries. Can be an integer for the number of entries or a time period in Robot Framework time format.

Returns: `list[dict]`

Tags: Assertion, BrowserControl, Getter

Returns the console log of the active page.

If assertions are used and fail, this keyword will fail immediately without retrying.

The returned data is a list of log messages.

A log message is a dictionary with the following structure:

```robotframework
[{
  "type": str,
  "text": str,
  "location": {
    "url": str,
    "lineNumber": int,
    "columnNumber": int
  },
  "time": str
}]
```

Example:

```robotframework
[{
  'type': 'log',
  'text': 'Stuff loaded...',
  'location': {
    'url': 'https://example.com/js/chunk-769742de.6a462276.js',
    'lineNumber': 60,
    'columnNumber': 63771
  },
  'time': '2023-02-05T17:42:52.064Z'
}]
```

Keys:

| Key | Description |
| --- | --- |
| `type` | One of the following values: `log`, `debug`, `info`, `error`, `warning`, `dir`, `dirxml`, `table`, `trace`, `clear`, `startGroup`, `startGroupCollapsed`, `endGroup`, `assert`, `profile`, `profileEnd`, `count`, `timeEnd` |
| `text` | The text of the console message. |
| `location.url` | The URL of the resource that generated this message. |
| `location.lineNumber` | The line number in the resource that generated this message (0-based). |
| `location.columnNumber` | The column number in the resource that generated this message (0-based). |
| `time` | The timestamp of the log message as ISO 8601 string. |

### Get Context Ids

Arguments:

- `context: SelectionType = ALL` — The context to get the ids from. `ALL` will return all ids from selected browser(s), `ACTIVE` for the one active context of each selected browser.
- `browser: SelectionType | str = ALL` — The browser id or selection to get the context ids from. `ALL` Context ids from all open browsers shall be fetched. `ACTIVE` Only context ids from the active browser shall be fetched. If a browser id is given and no browser with that id is open, the keyword fails.
- `assertion_operator: AssertionOperator | None = None`
- `*assertion_expected: Any | None`
- `message: str | None = None` (named-only)

Returns: `list`

Tags: Assertion, BrowserControl, Getter

Returns a list of context ids based on the browser selection. See `Browser, Context and Page` for more information about Context and related concepts.

`ALL` and `ANY` are synonyms. `ACTIVE` and `CURRENT` are also synonyms.

The ACTIVE context of the ACTIVE Browser is the `Current` Context.

### Get Cookie

Arguments:

- `cookie: str` — Name of the cookie to be retrieved.
- `return_type: CookieType = dictionary` — Type of the return value. Can be either `dictionary` or `string`. Defaults to `dictionary`.

Returns: `DotDict | str`

Tags: BrowserControl, Getter

Returns information about the cookie named `cookie` as a Robot Framework dot dictionary or a string.

If `return_type` is `dictionary` or `dict`, then the keyword returns a Robot Framework [dot dictionary](https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#accessing-list-and-dictionary-items). The dictionary contains all key value pairs of the cookie. If `return_type` is `string` or `str`, then the keyword returns the cookie as a string in format: `name1=value1`. The return value contains only the `name` and `value` keys of the cookie.

If no cookie is found with the given name, the keyword fails. The cookie dictionary contains details about the cookie. Keys available in the dictionary are documented in the table below.

| **Value** | **Explanation** |
| --- | --- |
| name | The name of the cookie. |
| value | Value of the cookie. |
| domain | Specifies which hosts are allowed to receive the cookie. |
| path | Indicates a URL path that must exist in the requested URL, for example `/`. |
| expires | Lifetime of a cookie. Returned as a datetime object or None if no valid time is received. |
| httpOnly | When true, the cookie is not accessible via JavaScript. |
| secure | When true, the cookie is only used with HTTPS connections. |
| sameSite | Attribute that lets servers require that a cookie shouldn't be sent with cross-origin requests. |

See [playwright documentation](https://playwright.dev/docs/api/class-browsercontext#browsercontextaddcookiescookies) for details about each attribute.

Example:

```robotframework
${cookie}=        Get Cookie              Foobar
Should Be Equal   ${cookie.value}           Tidii
Should Be Equal   ${cookie.expires.year}     ${2020}
```

### Get Cookies

Arguments:

- `return_type: CookieType = dictionary`

Returns: `list[DotDict] | str`

Tags: Getter, PageContent

Returns cookies from the currently active browser context.

If `return_type` is `dictionary` or `dict`, then the keyword returns a list of Robot Framework [dot dictionaries](https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#accessing-list-and-dictionary-items). Each dictionary contains all key value pairs of the cookie. See the `Get Cookie` keyword documentation for details about the dictionary keys and values.

If `return_type` is `string` or `str`, then the keyword returns the cookies as a string in format: `name1=value1; name2=value2; name3=value3`. The return value contains only `name` and `value` keys of the cookies. If no cookies are found, an empty list is returned.

### Get Credential

Arguments:

- `id_: str | None = None` — Base64url-encoded credential id.
- `rpId: str | None = None` — Relying party id (typically the site's effective domain).

Returns: `ClientCredential`

Tags: Credential, Getter

Returns the credential matching the given id and/or rpId.

At least one of `id_` and `rpId` must be given, otherwise the keyword fails. If both are given, the credential must match both of them. When more than one credential matches, the first match is returned. When no credential matches, the keyword fails.

The returned credential is a dictionary with the following keys:

| Key | Description |
| --- | --- |
| id | Base64url-encoded credential id. |
| rpId | Relying party id (typically the site's effective domain). |
| userHandle | Base64url-encoded user handle. |
| privateKey | Base64url-encoded PKCS#8 (DER) private key as a Secret. |
| publicKey | Base64url-encoded SPKI (DER) public key as a Secret. |

The privateKey and publicKey are wrapped in the [Secret](https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#secret-variables) type, so that their values are not shown in the Robot Framework log. The values themselves are available in the `value` attribute. Note that the node side of the library might write the whole credential, including the private key, as plain text to the playwright-log.txt file. See PlaywrightLogTypes for how to control that file.

See `Install Credential` for more information about how to use this keyword.

Example:

```robotframework
${credential} =    Get Credential    id_=${CREDENTIAL_ID}
Should Be Equal    ${credential["id"]}    ${CREDENTIAL_ID}
Should Be Equal    ${credential["rpId"]}    ${DOMAIN_NAME}
Should Be Equal    ${credential["userHandle"]}    userhandleCreatedByTheApp
Should Be Equal    ${credential["privateKey"].value}    privateKeyCreatedByTheApp
Should Be Equal    ${credential["publicKey"].value}    publicKeyCreatedByTheApp
```

### Get Device

Arguments:

- `name: str` — Name of the requested device. See Playwright's [deviceDescriptorsSource.json](https://github.com/microsoft/playwright/blob/master/packages/playwright-core/src/server/deviceDescriptorsSource.json) for a formatted list.

Returns: `dict`

Tags: BrowserControl, Getter

Returns a single device descriptor whose name matches `name` exactly.

The keyword fails if there is no device with that name. The matching is case sensitive.

Allows a concise syntax to set website testing values to exact matches of specific mobile devices.

Use the returned descriptor by passing it to `New Context`. After creating a context with a device descriptor, make sure that your active page is in that context before using it. Usage:

```robotframework
${device}=          Get Device       iPhone X
New Context         &{device}
New Page
Get Viewport Size   # returns { "width": 375, "height": 812 }
```

### Get Devices

Arguments: none

Returns: `dict`

Tags: BrowserControl, Getter

Returns a dictionary of all Playwright device descriptors.

The keys are the device names and the values are the device descriptors themselves.

See Playwright's [deviceDescriptorsSource.json](https://github.com/microsoft/playwright/blob/master/packages/playwright-core/src/server/deviceDescriptorsSource.json) for a formatted list.

### Get Download State

Arguments:

- `download: DownloadInfo | str` — `DownloadInfo` dictionary returned from `Promise To Wait For Download` or download id as string.
- `assertion_operator: AssertionOperator | None = None` — See `Assertions` for further details. Defaults to None.
- `assertion_expected: Any | None = None` — Expected state of the download. Be aware that the returned value is a dictionary
- `message: str | None = None` — overrides the default error message for assertion.

Returns: `DownloadInfo`

Tags: Assertion, Getter, PageContent

Gets the state of a download.

Returns a dictionary of type `DownloadInfo` with the following keys:

```robotframework
{
  saveAs: str
  suggestedFilename: str
  state: str
  downloadID: Optional[str]
}
```

### Get Element

Arguments:

- `selector: str` — Selector from which the element shall be retrieved. See the `Finding elements` section for details about the selectors.

Returns: `str`

Tags: Getter, PageContent

Returns a selector string that points to the element found by `selector`.

The returned string is the selector Playwright resolved for the element. It is an ordinary selector, so it can be used as the **first** clause of another selector, chained with `>>`. Because it is a selector and not a captured DOM node, it is resolved again from the page on every use.

Keyword uses strict mode, see `Finding elements` for more details about strict mode.

Example:

```robotframework
${element} =    Get Element    \#username_field
${option_value} =    Get Property    ${element} >> optionOne    value    # Locator is resolved from the page.
${option_value} =    Get Property    ${element} >> optionTwo    value    # Locator is resolved again from the page.
```

### Get Element By

Arguments:

- `selection_strategy: SelectionStrategy` — SelectionStrategy to be used. Refers to Playwrights `page.getBy***` functions. See [https://playwright.dev/docs/locators](https://playwright.dev/docs/locators)
- `text: str | RegExp` — Text to locate the element for.
- `exact: bool = False` — Whether to find an exact match: case-sensitive and whole-string. Defaults to false. Ignored when locating by a regular expression. Note that exact match still trims whitespace. This has no effect if RegExp is used or if TestID is used as strategy.
- `all_elements: bool = False` — If True, returns all matched elements as a list.

Returns: `str`

Tags: Getter, PageContent

Allows locating elements by their features.

Selection strategies can be several Playwright strategies like AltText or Label. See [Playwright Locators](https://playwright.dev/docs/locators) for more information.

This keywords implements the following Playwright functions:

-   [page.getByAltText](https://playwright.dev/docs/api/class-page#page-get-by-alt-text)
-   [page.getByLabel](https://playwright.dev/docs/api/class-page#page-get-by-label)
-   [page.getByPlaceholder](https://playwright.dev/docs/api/class-page#page-get-by-placeholder)
-   [page.getByTestId](https://playwright.dev/docs/api/class-page#page-get-by-test-id)
-   [page.getByText](https://playwright.dev/docs/api/class-page#page-get-by-text)
-   [page.getByTitle](https://playwright.dev/docs/api/class-page#page-get-by-title)

`page.getByRole` is supported by `Get Element By Role` keyword.

If an element shall be fetched from an iframe, a selector prefix must be set using `Set Selector Prefix` keyword including `>>>` as ending.

### Get Element By Role

Arguments:

- `role: ElementRole` — Role from which shall be retrieved.
- `all_elements: bool = False` (named-only) — If True, returns all matched elements as a list.
- `checked: bool | None = None` (named-only) — An attribute that is usually set by aria-checked or native <input type=checkbox> controls.
- `disabled: bool | None = None` (named-only) — An attribute that is usually set by aria-disabled or disabled.
- `exact: bool | None = None` (named-only) — Whether name is matched exactly: case-sensitive and whole-string. Defaults to false. Ignored when name is a regular expression. Note that exact match still trims whitespace.
- `expanded: bool | None = None` (named-only) — An attribute that is usually set by aria-expanded.
- `include_hidden: bool | None = None` (named-only) — Option that controls whether hidden elements are matched. By default, only non-hidden elements, as defined by ARIA, are matched by role selector.
- `level: int | None = None` (named-only) — A number attribute that is usually present for roles heading, list item, row, treeitem, with default values for <h1>-<h6> elements.
- `name: str | RegExp | None = None` (named-only) — Option to match the accessible name. By default, matching is case-insensitive and searches for a substring, use exact to control this behavior.
- `pressed: bool | None = None` (named-only) — An attribute that is usually set by aria-pressed.
- `selected: bool | None = None` (named-only) — An attribute that is usually set by aria-selected.

Returns: `str`

Tags: Getter, PageContent

Returns a selector string for the element matched by `role`, or a list of selector strings if `all_elements` is set to `True`.

The returned value is used like the one from `Get Element`: as the first clause of another selector, chained with `>>`.

Allows locating elements by their [ARIA role](https://www.w3.org/TR/wai-aria-1.2/#roles), [ARIA attributes](https://www.w3.org/TR/wai-aria-1.2/#aria-attributes) and [accessible name](https://w3c.github.io/accname/#dfn-accessible-name).

Consider the following DOM structure.

```robotframework
<h3>Sign up</h3>
<label>
  <input type="checkbox" /> Subscribe
</label>
<br/>
<button>Submit</button>
```

You can locate each element by its implicit role:

```robotframework
${heading}    Get Element By Role    heading    name=Sign up
${checkbox}   Get Element By Role    checkbox    name=Subscribe
${button}     Get Element By Role    button    name=/submit/i
```

If an element shall be fetched from an iframe, a selector prefix must be set using `Set Selector Prefix` keyword including `>>>` as ending.

### Get Element Count

Arguments:

- `selector: str` — Selector which shall be counted. See the `Finding elements` section for details about the selectors.
- `assertion_operator: AssertionOperator | None = None` — See `Assertions` for further details. Defaults to None.
- `assertion_expected: int | str = 0` — Expected value for the assertion
- `message: str | None = None` — overrides the default error message for assertion.

Returns: `int`

Tags: Assertion, Getter, PageContent

Returns the count of elements found with `selector`.

Optionally asserts that the count matches the specified assertion. See `Assertions` for further details for the assertion arguments. By default assertion is not done.

Example:

```robotframework
Get Element Count    label    >    1
```

### Get Element States

Arguments:

- `selector: str` — Selector of the corresponding object. See the `Finding elements` section for details about the selectors.
- `assertion_operator: AssertionOperator | None = None` — See `Assertions` for further details. Defaults to None.
- `*assertion_expected: ElementState | str` — Expected states
- `message: str | None = None` (named-only) — overrides the default error message for assertion.
- `return_names=True` (named-only) — If set to `False` the keyword does return an IntFlag object (`ElementState`) instead of a list. `ElementState` may contain multiple states at the same time. Defaults to `True`.

Returns: `list[str] | ElementState`

Tags: Assertion, Getter, PageContent

Get the active states from the element found by `selector`.

This Keyword returns a list of states that are valid for the selected element.

Optionally asserts that the state matches the specified assertion. See `Assertions` for further details for the assertion arguments. By default, assertion is not done.

This keyword internally works with Python IntFlag. Flags can be processed using bitwise operators like & (bitwise AND) and | (bitwise OR). When using the assertion operators `then`, `evaluate` or `validate` the `value` contains the states as `ElementState`.

Example:

```robotframework
Get Element States    h1    validate    value & visible   # Fails in case of an invisible element
Get Element States    h1    then    value & (visible | hidden)  # Returns either ['visible'] or ['hidden']
Get Element States    h1    then    bool(value & visible)  # Returns ${True} if element is visible
```

The most typical use case would be to verify if an element contains a specific state or multiple states.

Example:

```robotframework
Get Element States    id=checked_elem      *=    checked
Get Element States    id=checked_elem      not contains    checked
Get Element States    id=invisible_elem    contains    hidden    attached
Get Element States    id=disabled_elem     contains    visible    disabled    readonly
```

Elements do return the positive and negative values if applicable. As example, a checkbox does return either `checked` or `unchecked` while a text input element has none of those two states. Options of select elements have also either `selected` or `deselected`.

If an element is not attached to the DOM, so that it can not be found within 250ms, it is marked as `detached` as the only state.

`stable` state is not returned, because it would cause too high delay in that keyword.

Keyword uses strict mode, see `Finding elements` for more details about strict mode.

### Get Elements

Arguments:

- `selector: str` — Selector from which the elements shall be retrieved. See the `Finding elements` section for details about the selectors.

Returns: `list[str]`

Tags: Getter, PageContent

Returns a list of selector strings, one for each element matched by `selector`.

Each string can be used as the **first** clause of another selector, chained with `>>`, exactly like the value returned by `Get Element`.

Keyword does not use strict mode and returns an empty list if the `selector` does not match any element.

Example:

```robotframework
${elements} =    Get Elements    //select
${elem} =    Get From List    ${elements}    0
${option_value} =    Get Property    ${elem} >> option    value
```

### Get Page Errors

Arguments:

- `assertion_operator: AssertionOperator | None = None` — Optional assertion operator. See `Assertions` for more information.
- `assertion_expected: Any | None = None` — Optional expected value. See `Assertions` for more information.
- `message: str | None = None` — Optional custom message to use on failure. See `Assertions` for more information.
- `full: bool = False` (named-only) — If true, returns all page errors. If false, returns only new errors that were added since last time.
- `last: int | timedelta | None = None` (named-only) — If set, returns only the last n entries. Can be an integer for the number of entries or a time period in Robot Framework time format.

Returns: `list[dict]`

Tags: Assertion, BrowserControl, Getter

Returns the page errors of the active page.

If assertions are used and fail, this keyword will fail immediately without retrying.

The returned data is a list of error messages.

An error message is a dictionary with the following structure:

```robotframework
{
  "name": str,
  "message": str,
  "stack": str,
  "time": str
}
```

Example:

```robotframework
[{
  'name': 'ReferenceError',
  'message': 'YT is not defined',
  'stack': 'ReferenceError: YT is not defined\n    at HTMLIFrameElement.onload (https://example.com/:20:2245)',
  'time': '2023-02-05T20:08:48.912Z'
}]
```

Keys:

| Key | Description |
| --- | --- |
| `name` | The name/type of the error. |
| `message` | The human readable error message. |
| `stack` | The stack trace of the error, if given. |
| `time` | The timestamp of the error as ISO 8601 string. |

### Get Page Ids

Arguments:

- `page: SelectionType = ALL` — The page to get the ids from. `ALL` Returns all page ids as a list. `ACTIVE` Returns the id of the active page as a list.
- `context: SelectionType | str = ALL` — The context id or selection to get the page ids from. `ALL` Page ids from all contexts shall be fetched. `ACTIVE` Only page ids from the active context shall be fetched.
- `browser: SelectionType | str = ALL` — The browser id or selection to get the page ids from. `ALL` Page ids from all open browsers shall be fetched. `ACTIVE` Only page ids from the active browser shall be fetched.
- `assertion_operator: AssertionOperator | None = None`
- `*assertion_expected: Any | None`
- `message: str | None = None` (named-only)

Returns: `list`

Tags: Assertion, BrowserControl, Getter

Returns a list of page ids based on the context and browser selection. See `Browser, Context and Page` for more information about Page and related concepts.

`ALL` and `ANY` are synonyms. `ACTIVE` and `CURRENT` are also synonyms.

Example:

```robotframework
Test Case
    New Page    https://www.imbus.de
    New Page    https://www.reaktor.com
    ${current_page}=   Get Page IDs    ACTIVE    ACTIVE    ACTIVE
    Log                Current page ID is: ${current_page}[0]
    ${all_pages}=      Get Page IDs    CURRENT   CURRENT   ALL
    Log Many           These are all Page IDs    @{all_pages}
```

Example to count open pages of a specific context:

```robotframework
Test Case
   New Browser    firefox
   ${context}=    New Context
   New Page    https://www.imbus.de
   New Page    https://www.op.fi
   New Context
   New Page    https://www.robocon.io
   ${page_count}=    Get Page IDs    ALL    ${context}    ALL    then    len(value)
   Should Be Equal As Integers    ${page_count}    2
```

The ACTIVE page of the ACTIVE context of the ACTIVE Browser is the `Current` Page.

### Get Page Source

Arguments:

- `assertion_operator: AssertionOperator | None = None` — See `Assertions` for further details. Defaults to None.
- `assertion_expected: Any | None = None` — Expected value for the state
- `message: str | None = None` — overrides the default error message for assertion.

Returns: `str | dict | tuple`

Tags: Assertion, Getter, PageContent

Gets the page's HTML source as a string.

Optionally does a string assertion. See `Assertions` for further details for the assertion arguments. By default assertion is not done.

If the HTML of a single element is needed, use `Get Property` instead. Example:

```robotframework
${html1} =    Get Property    ${selector}    innerHTML
${html2} =    Get Property    ${selector}    outerHTML
```

### Get Property

Arguments:

- `selector: str` — Selector from which the info is to be retrieved. See the `Finding elements` section for details about the selectors.
- `property: str` — Requested property name.
- `assertion_operator: AssertionOperator | None = None` — See `Assertions` for further details. Defaults to None.
- `assertion_expected: Any | None = None` — Expected value for the state
- `message: str | None = None` — overrides the default error message for assertion.

Returns: `Any`

Tags: Assertion, Getter, PageContent

Returns the `property` of the element found by `selector`.

Keyword uses strict mode, see `Finding elements` for more details about strict mode.

Optionally asserts that the property value matches the expected value. See `Assertions` for further details for the assertion arguments. By default assertion is not done.

If `assertion_operator` is set and the property is not found, `value` is `None` and the keyword does not fail. If no `assertion_operator` is set and the property is not found, the keyword fails. See `Get Attribute` for examples.

Example:

```robotframework
Get Property    h1    innerText    ==    Login Page
${property} =    Get Property    h1    innerText
```

### Get Scroll Position

Arguments:

- `selector: str | None = None` — Optional selector from which the scroll position shall be retrieved. If no selector is given the scroll position of the page itself is used (`document.scrollingElement`). See the `Finding elements` section for details about the selectors.
- `key: AreaFields = ALL` — Optionally filters the returned values. If keys is set to `ALL` (default) it will return the scroll position as dictionary, otherwise it will just return the single value selected by the key.
- `assertion_operator: AssertionOperator | None = None` — See `Assertions` for further details. Defaults to None.
- `assertion_expected: Any | None = None` — Expected value for the assertion
- `message: str | None = None` — overrides the default error message for assertion.

Returns: `ScrollPosition | float`

Tags: Assertion, Getter, PageContent

Gets elements or pages current scroll position as object `{top: float, left: float, bottom: float, right: float}`.

It describes the rectangle which is visible of the scrollable content of that element. All values are measured from position {top: 0, left: 0}.

Keyword uses strict mode, see `Finding elements` for more details about strict mode.

Optionally asserts that the value matches the specified assertion. See `Assertions` for further details for the assertion arguments. By default assertion is not done.

See `Get BoundingBox` or `Get Scroll Size` for examples.

### Get Scroll Size

Arguments:

- `selector: str | None = None` — Optional selector from which the scroll size shall be retrieved. If no selector is given the scroll size of the page itself is used. See the `Finding elements` section for details about the selectors.
- `key: SizeFields = ALL` — Optionally filters the returned values. If keys is set to `ALL` (default) it will return the scroll size as dictionary, otherwise it will just return the single value selected by the key.
- `assertion_operator: AssertionOperator | None = None` — See `Assertions` for further details. Defaults to None.
- `assertion_expected: Any | None = None` — Expected value for the assertion
- `message: str | None = None` — overrides the default error message for assertion.

Returns: `Dimensions | float | int`

Tags: Assertion, Getter, PageContent

Gets elements or pages scrollable size as object `{width: float, height: float}`.

Keyword uses strict mode, see `Finding elements` for more details about strict mode.

Optionally asserts that the state matches the specified assertion. See `Assertions` for further details for the assertion arguments. By default assertion is not done.

See `Get BoundingBox` for more similar examples.

Example use:

```robotframework
${height}=         Get Scroll Size    height                          # filtered page by height
Log                Height: ${height}                                  # Height: 58425
${scroll_size}=    Get Scroll Size    id=keyword-shortcuts-container  # unfiltered element
Log                ${scroll_size}                                     # {'width': 253, 'height': 3036}
```

### Get Select Options

Arguments:

- `selector: str` — Selector from which the info is to be retrieved. See the `Finding elements` section for details about the selectors.
- `assertion_operator: AssertionOperator | None = None` — See `Assertions` for further details. Defaults to None.
- `assertion_expected: Any | None = None` — Expected value for the state
- `message: str | None = None` — overrides the default error message for assertion.

Returns: `list[SelectOptions]`

Tags: Assertion, Getter, PageContent

Returns attributes of options of a `select` element as a list of dictionaries.

Each returned dictionary has the keys "index", "value", "label" and "selected".

Keyword uses strict mode, see `Finding elements` for more details about strict mode.

Optionally asserts that these match the specified assertion. See `Assertions` for further details for the assertion arguments. By default assertion is not done.

Example:

```robotframework
Get Select Options     //select[2]    validate  [v["label"] for v in value] == ["Email", "Mobile"]
Get Select Options   select#names     validate  any(v["label"] == "Mikko" for v in value)
```

### Get Selected Options

Arguments:

- `selector: str` — Selector from which the info is to be retrieved. See the `Finding elements` section for details about the selectors.
- `option_attribute: SelectAttribute = label` — Which attribute shall be returned/verified. Defaults to label.
- `assertion_operator: AssertionOperator | None = None` — See `Assertions` for further details. Defaults to None.
- `*assertion_expected` — Expected value for the state
- `message: str | None = None` (named-only) — overrides the default error message for assertion.

Returns: `list[str | int]`

Tags: Assertion, Getter, PageContent

Returns the specified attribute of selected options of the `select` element.

Keyword uses strict mode, see `Finding elements` for more details about strict mode.

Optionally asserts that these match the specified assertion. See `Assertions` for further details for the assertion arguments. By default assertion is not done.

-   `==` , `!=` and `contains` / `*=` can work with multiple values
-   `validate` and `evaluate` only accept one single expected value

Other operators are not allowed.

Example:

```robotframework
Select Options By      label                    //select[2]    Email      Mobile
${selected_list} =       Get Selected Options   //select[2]                                         # getter
Get Selected Options   //select[2]              label          ==         Mobile             Mail   #assertion content
Select Options By      label                    select#names   2          4
Get Selected Options   select#names             index          ==         2                  4      #assertion index
Get Selected Options   select#names             label          *=         Mikko                     #assertion contain
Get Selected Options   select#names             label          validate   len(value) == 3           #assertion length
```

### Get Style

Arguments:

- `selector: str` — Selector from which the style shall be retrieved. See the `Finding elements` section for details about the selectors.
- `key: str | None = ALL` — Key of the requested CSS property. Retrieves "ALL" styles as dictionary by default. All css settings can be used as keys even if they are not all returned in the dictionary.
- `assertion_operator: AssertionOperator | None = None` — See `Assertions` for further details. Defaults to None.
- `assertion_expected: Any | None = None` — Expected value for the assertion
- `message: str | None = None` — overrides the default error message for assertion.
- `pseudo_element: str | None = None` — Pseudo element to match. Defaults to None.

Returns: `dict[str, str] | str | tuple | dict`

Tags: Assertion, Getter, PageContent

Gets the computed style properties of the element selected by `selector`.

A [pseudo element](https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-elements) is a CSS functionality to add styles, for example `::before` or `::after`.

Keyword uses strict mode, see `Finding elements` for more details about strict mode.

Optionally asserts that the style matches the specified assertion. See `Assertions` for further details for the assertion arguments. By default assertion is not done.

When `key` is `ALL`, a dictionary is returned and only the sequence assertion operators `==`, `!=`, `contains` / `*=`, `validate` and `evaluate` / `then` are allowed. Assertion formatters are not applied in that case.

### Get Table Cell Element

Arguments:

- `table: str` — selector must select the `<table>` element that contains both selected elements
- `column: str` — selector can select any `<th>` or `<td>` element or one of their descendants.
- `row: str` — selector can select any `<tr>` element or one of their descendants like `<td>` elements.

Returns: `str`

Tags: Getter, PageContent

Returns a selector string for the cell at the same column and row index as the selected elements.

The returned value is used like the one from `Get Element`.

`column` and `row` can also consume index numbers instead of selectors. Indexes are starting from `0` and `-1` is specific for the last element.

Selectors for `column` and `row` are directly appended to the `table` selector like this: `f"{table} >> {column}"` and `f"{table} >> {row}"`.

| GitHub | Slack | Real Name |
| --- | --- | --- |
| mkorpela | @mkorpela | Mikko Korpela |
| aaltat | @aaltat | Tatu Aalto |
| xylix | @Kerkko Pelttari | Kerkko Pelttari |
| Snooz82 | @René | René Rohner |

Example:

```robotframework
${table}=    Set Variable    [id="Get Table Cell Element"] >> div.kw-docs table >> nth=1
${e}=    Get Table Cell Element    ${table}    "Real Name"    "aaltat"   # Returns element with text Tatu Aalto
Get Text    ${e}    ==    Tatu Aalto
${e}=    Get Table Cell Element    ${table}    "Slack"    "Mikko Korpela"   # Returns element with text @mkorpela
Get Text    ${e}    ==    @mkorpela
${e}=    Get Table Cell Element    ${table}    "mkorpela"    "Kerkko Pelttari"   # column does not need to be in row 0
Get Text    ${e}    ==    @mkorpela
${e}=    Get Table Cell Element    ${table}    2    -1   # Index is also directly possible
Get Text    ${e}    ==    René Rohner
```

### Get Table Cell Index

Arguments:

- `selector: str` — can select any `<th>` or `<td>` element or one of their descendants. See the `Finding elements` section for details about the selectors.
- `assertion_operator: AssertionOperator | None = None` — See `Assertions` for further details. Defaults to None.
- `assertion_expected: int | str = 0` — Expected value for the assertion
- `message: str | None = None` — overrides the default error message for assertion.

Returns: `int`

Tags: Assertion, Getter, PageContent

Returns the index (0 based) of a table cell within its row.

Example:

```robotframework
${table}=    Set Variable    id=Get Table Cell Element >> div.kw-docs table   #Table of keyword Get Table Cell Element
${idx}=    Get Table Cell Index    ${table} >> "Real Name"
Should Be Equal    ${idx}    ${2}
Get Table Cell Index    ${table} >> "@aaltat"    ==    1
```

Optionally asserts that the index matches the specified assertion. See `Assertions` for further details for the assertion arguments. By default assertion is not done.

### Get Table Row Index

Arguments:

- `selector: str` — can select any `<tr>`, `<th>` or `<td>` element or one of their descendants. See the `Finding elements` section for details about the selectors.
- `assertion_operator: AssertionOperator | None = None` — See `Assertions` for further details. Defaults to None.
- `assertion_expected: int | str = 0` — Expected value for the assertion
- `message: str | None = None` — overrides the default error message for assertion.

Returns: `int`

Tags: Assertion, Getter, PageContent

Returns the index (0 based) of a table row.

Example:

```robotframework
${table}=    Set Variable    id=Get Table Cell Element >> div.kw-docs table   #Table of keyword Get Table Cell Element
${idx}=    Get Table Row Index    ${table} >> "@René"
Should Be Equal    ${idx}    ${4}
Get Table Row Index    ${table} >> "@aaltat"    ==    2
```

Optionally asserts that the index matches the specified assertion. See `Assertions` for further details for the assertion arguments. By default assertion is not done.

### Get Text

Arguments:

- `selector: str` — Selector from which the text is to be retrieved. See the `Finding elements` section for details about the selectors.
- `assertion_operator: AssertionOperator | None = None` — See `Assertions` for further details. Defaults to None.
- `assertion_expected: Any | None = None` — Expected value for the state
- `message: str | None = None` — overrides the default error message for assertion.
- `text_type: TextType | None = None` (named-only) — How text is returned. Possible values are `allInnerTexts`, `allTextContents`, `innerText`, `inputValue`, and `innerHTML`. Defaults to `None`, which returns the value of `input` and `textarea` elements and the inner text of all other elements.

Returns: `str | list[str] | dict | tuple`

Tags: Assertion, Getter, PageContent

Returns text attribute of the element found by `selector`.

Keyword can also return the value property text of `input` or `textarea` elements. See the `Finding elements` section for details about the selectors.

Keyword uses strict mode, see `Finding elements` for more details about strict mode. The `text_type` argument determines how text is returned. The `allInnerTexts` and `allTextContents` will return a list of strings, while other types return a single string.

Optionally asserts that the text matches the specified assertion. See `Assertions` for further details for the assertion arguments. By default, assertion is not done.

Example:

```robotframework
${text} =    Get Text    id=important                                # Returns element text without assertion.
${text} =    Get Text    id=important    ==    Important text        # Returns element text with assertion.
${text} =    Get Text    //input         ==    root                  # Returns input element text with assertion.
${text} =    Get Text    id=important    text_type=innerHTML         # Returns element inner HTML.
${text} =    Get Text    id=important    text_type=allInnerTexts     # Returns element inner text as list of strings.
```

### Get Title

Arguments:

- `assertion_operator: AssertionOperator | None = None` — See `Assertions` for further details. Defaults to None.
- `assertion_expected: Any | None = None` — Expected value for the state
- `message: str | None = None` — overrides the default error message for assertion.

Returns: `str | dict | tuple`

Tags: Assertion, Getter, PageContent

Returns the title of the current page.

Optionally asserts that title matches the specified assertion. See `Assertions` for further details for the assertion arguments. By default assertion is not done.

### Get Url

Arguments:

- `assertion_operator: AssertionOperator | None = None` — See `Assertions` for further details. Defaults to None.
- `assertion_expected: Any | None = None` — Expected value for the state
- `message: str | None = None` — overrides the default error message for assertion.

Returns: `str | dict | tuple`

Tags: Assertion, Getter, PageContent

Returns the current URL.

Optionally asserts that it matches the specified assertion. See `Assertions` for further details for the assertion arguments. By default assertion is not done.

### Get Viewport Size

Arguments:

- `key: SizeFields = ALL` — Optionally filters the returned values. If keys is set to `ALL` (default) it will return the viewport size as dictionary, otherwise it will just return the single value selected by the key. Note: If a single value is retrieved, an assertion does **not** need a `validate` combined with a cast of `value`.
- `assertion_operator: AssertionOperator | None = None` — See `Assertions` for further details. Defaults to None.
- `assertion_expected: Any | None = None` — Expected value for the assertion
- `message: str | tuple | dict | None = None` — overrides the default error message for assertion.

Returns: `ViewportDimensions | None`

Tags: Assertion, BrowserControl, Getter

Returns the current viewport dimensions.

Optionally asserts that the state matches the specified assertion. See `Assertions` for further details for the assertion arguments. By default assertion is not done.

If the page does not have a viewport size, for example because the context was created without one, `None` is returned and no assertion is done.

Example:

```robotframework
Get Viewport Size    ALL    ==    {'width':1280, 'height':720}
Get Viewport Size    width    >=    1200
```

### Go Back

Arguments: none

Tags: BrowserControl, Setter

Navigates to the previous page in history.

If the wait times out, the page's load report is logged: whether its navigation committed, how far the document got and which requests were still open.

### Go Forward

Arguments: none

Tags: BrowserControl, Setter

Navigates to the next page in history.

If the wait times out, the page's load report is logged: whether its navigation committed, how far the document got and which requests were still open.

### Go To

Arguments:

- `url: str` — URL to be navigated to.
- `timeout: timedelta | None = None` — Time to wait for the page to load. If not defined, the library default timeout is used.
- `wait_until: PageLoadStates = load` — When to consider the operation succeeded, defaults to `load`. The event can be either: `domcontentloaded` - consider the operation to be finished when the DOMContentLoaded event is fired. `load` - consider the operation to be finished when the load event is fired. `networkidle` - consider the operation to be finished when there are no network connections for at least 500 ms. `commit` - consider the operation to be finished when the network response is received and the document started loading.

Tags: BrowserControl, Setter

Navigates to the given `url`.

Returns the HTTP status code of the navigation request as an integer, or 0 if no response was received.

If the wait times out, the page's load report is logged: whether its navigation committed, how far the document got and which requests were still open.

### Grant Permissions

Arguments:

- `*permissions: Permission` — Permissions to grant, given as separate arguments. See `Permission` for the available values, for example `geolocation`, `notifications`, `camera` or `microphone`.
- `origin: str | None = None` (named-only) — The origin to grant the permissions to, e.g. "[https://example.com](https://example.com)". If not given, the permissions are granted for all origins.

Tags: BrowserControl, Setter

Grants permissions to the current context.

Example:

```robotframework
New Context
Grant Permissions    geolocation
```

### Handle Future Dialogs

Arguments:

- `action: DialogAction` — How to handle the alert. Can be `accept` or `dismiss`.
- `prompt_input: str = ` — The value to enter into the prompt. Only valid if the `action` argument equals `accept`. Defaults to an empty string.

Tags: PageContent

Handle next dialog on page with `action`.

The dialog can be an alert, beforeunload, confirm or prompt dialog. This keyword must be called before the action, for example a click, which triggers the dialog.

The handler is registered on the current page and stays in effect for all following dialogs on that page. Calling this keyword again on the same page replaces the handler, so the latest call decides how dialogs are handled.

If a handler is not set, dialogs are dismissed by default.

The handler runs when the dialog appears, not while this keyword executes, so a failure to accept or dismiss the dialog can not be raised as a keyword failure. Such a failure is reported in the playwright-log.txt file only, which is linked into the Robot Framework log when a keyword fails.

Example:

```robotframework
Handle Future Dialogs    action=accept
Click                    \#alerts
```

### Highlight Elements

Arguments:

- `selector: str` — Selectors which shall be highlighted. See the `Finding elements` section for details about the selectors.
- `duration: timedelta = 0:00:05` — Sets for how long the selector shall be highlighted. Defaults to `5s` => 5 seconds. If set to 0 seconds, the highlighting is not deleted.
- `width: str = 2px` — Sets the width of the highlight border. Defaults to 2px.
- `style: str = dotted` — Sets the style of the border. Defaults to dotted.
- `color: str = blue` — Sets the color of the border. Valid colors i.e. are: `red`, `blue`, `yellow`, `pink`, `black`
- `mode: HighlightMode = border` (named-only) — Sets the mode of the highlight. Valid modes are: `border` (classic mode), `playwright` (Playwright's native one) and `both`. Defaults to `border`. If `playwright` is used, `width`, `style` and `color` are ignored and only one highlighting can happen at the same time.

Tags: PageContent, Setter

Adds a highlight to elements matched by the `selector`. Provides a style adjustment.

Returns the number of highlighted elements. Keyword does not fail, if the `selector` matched zero elements in the page. Keyword does not scroll elements to viewport and highlighted element might be outside the viewport. Use `Scroll To Element` keyword to scroll element in viewport.

Keyword does not fail if selector resolves to multiple elements.

Highlights which are created with `duration=0` stay in the page until they are removed. Calling this keyword with an empty `selector`, for example `Highlight Elements ${EMPTY}`, removes all such highlights that were made with Playwright's native highlighting, in other words with `mode=playwright` or `mode=both`. Highlights drawn in `border` mode can not be removed that way.

Example:

```robotframework
Highlight Elements    input#login_button    duration=200ms
${count} =    Highlight Elements    input#login_button    duration=200ms    width=4px    style=solid    color=\#FF00FF
Should Be Equal    ${count}    ${5}
```

### Hover

Arguments:

- `selector: str` — Selector element to hover. See the `Finding elements` section for details about the selectors.
- `position_x: float | None = None` — A point to hover relative to the top-left corner of element bounding box. If not specified, hovers over some visible point of the element. Only positive values within the bounding-box are allowed. Both values must be given, otherwise the position is ignored.
- `position_y: float | None = None` — A point to hover relative to the top-left corner of element bounding box. If not specified, hovers over some visible point of the element. Only positive values within the bounding-box are allowed. Both values must be given, otherwise the position is ignored.
- `force: bool = False` — Set to `True` to skip Playwright's [Actionability checks](https://playwright.dev/docs/actionability). Defaults to `False`.
- `*modifiers: KeyboardModifier` — Modifier keys to press. Ensures that only these modifiers are pressed during the hover, and then restores current modifiers back. If not specified, currently pressed modifiers are used. Valid modifier keys are `Alt`, `Control`, `ControlOrMeta`, `Meta` and `Shift`.

Tags: PageContent, Setter

Moves the virtual mouse and scrolls to the element found by `selector`.

This method hovers over an element matching `selector` by performing the following steps:

-   Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.
-   Wait for actionability checks on the matched element, unless the `force` option is set. If the element is detached during the checks, the whole action is retried.
-   Scroll the element into view if needed.
-   Use `Mouse Move` to hover over the center of the element, or the specified `position`.

Keyword uses strict mode, see `Finding elements` for more details about strict mode.

Example:

```robotframework
Hover    h1
Hover    h1    10   20    Alt
```

### Http

Arguments:

- `url: str` — The request url, e.g. `/api/foo`.
- `method: RequestMethod = GET` — The HTTP method for the request. Defaults to GET.
- `body: str | None = None` — The request body. It is ignored for GET requests, because GET requests cannot have a body. If the body can be parsed as JSON, the `Content-Type` header for the request is automatically set to `application/json`, unless `headers` already contains that header. Defaults to None.
- `headers: dict | None = None` — A dictionary of additional request headers. Defaults to None.

Returns: `Any`

Tags: HTTP

Performs an HTTP request in the current browser context

The request is sent with the browser's `fetch` from the currently active page, so a relative `url` is resolved against the URL of that page.

The response is a Robot Framework dictionary with the following attributes:

-   `status` <int> The status code of the response.
-   `statusText` <str> Status text corresponding to `status`, e.g. OK or INTERNAL SERVER ERROR. This may not be available for all browsers.
-   `body` <dict> | <str> The response body. If the body can be parsed as a JSON object, it will be returned as Python dictionary, otherwise it is returned as a string.
-   `headers` <dict> A dictionary containing all response headers.
-   `ok` <bool> Whether the request was successful, i.e. the `status` is in the range 200-299.
-   `url` <str> The final URL of the response, after possible redirects.
-   `redirected` <bool> Whether the response is the result of a redirect.
-   `type` <str> The type of the response, e.g. `basic` or `cors`.

Here's an example of using Robot Framework dictionary variables and extended variable syntax to do assertions on the response object:

```robotframework
&{res}=             HTTP                       /api/endpoint
Should Be Equal     ${res.status}              200
Should Be Equal     ${res.body.some_field}     some value
```

### Install Credential

Arguments: none

Tags: Credential, Setter

Installs the virtual WebAuthn authenticator into the context.

Overrides `navigator.credentials.create()` and `navigator.credentials.get()` in all current and future pages of the context. Call this before the page first touches `navigator.credentials`.

Until the authenticator is installed, no interception is in place and the page sees the platform's native (or absent) WebAuthn behavior. `Create Credential` installs the authenticator as well, so this keyword is mainly needed when the credentials are created by the application itself. There must be an open context, otherwise the keyword fails.

Example:

```robotframework
New Context
Install Credential
New Page    ${SUT_URL}
# Do something on the page that causes the page to call navigator.credentials.create()
${credential_id} =    Get Credential Id   # This is a user keyword that returns the credential id from somewhere. Talk to your application team to find out how to get the credential id.
${credential} =    Get Credential    id_=${credential_id}    # This will return the credential that was created by the application and installed into the context.
New Context
Create Credential
...    rpId=${DOMAIN_NAME}
...    id_=${credential["id"]}
...    privateKey=${credential["privateKey"]}
...    publicKey=${credential["publicKey"]}
...    userHandle=${credential["userHandle"]}
New Page    ${SUT_URL}
# User should be able to interact with the page using the installed credential.
```

### Keyboard Input

Arguments:

- `action: KeyboardInputAction` — `insertText`: Dispatches only input event, does not emit the keydown, keyup or keypress events. `type`: Sends a keydown, keypress/input, and keyup event for each character in the text.
- `input: str` — The input string to be typed. *No special keys possible.*
- `delay: int | timedelta = 0:00:00` — Time to wait between key presses in Robot Framework's time format. Defaults to `0 ms`.

Tags: PageContent, Setter

Input text into page with virtual keyboard.

**Attention:** Argument type `int` for 'delay' in milliseconds has been changed to `timedelta` in Browser 14.0.0. Use Robot Framework time format with units instead.

Note: To press a special key, like Control or ArrowDown, use `Keyboard Key`. Modifier keys DO NOT affect these actions. For testing modifier effects use single key presses with `Keyboard Key press`

Example:

```robotframework
Keyboard Input    insertText    0123456789
```

### Keyboard Key

Arguments:

- `action: KeyAction` — Determines whether the key should be released (`up`), held down (`down`) or pressed once (`press`). `down` and `up` are useful for combinations, i.e. with Shift.
- `key: str` — The key to be pressed. Examples of valid keys are: `F1` - `F12`, `Digit0` - `Digit9`, `KeyA` - `KeyZ`, `Backquote`, `Minus`, `Equal`, `Backslash`, `Backspace`, `Tab`, `Delete`, `Escape`, `ArrowDown`, `End`, `Enter`, `Home`, `Insert`, `PageDown`, `PageUp`, `ArrowRight`, `ArrowUp` , etc.
- `delay: timedelta = 0:00:00` (named-only) — Time the key is held down between keydown and keyup, in Robot Framework's time format. Only valid with action `press`, other actions raise an error. Defaults to `0 s`. Example: `50 ms`

Tags: PageContent, Setter

Press a keyboard key on the virtual keyboard or set a key up or down.

Useful keys for `down` and `up` for example are: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`

Example execution:

```robotframework
Keyboard Key    press    S
Keyboard Key    press    S        delay=500 ms
Keyboard Key    down     Shift
Keyboard Key    press    ArrowLeft
Keyboard Key    press    Delete
Keyboard Key    up       Shift
```

Note: Capital letters don't need to be written by the help of Shift. You can type them in directly.

### Launch Browser Server

Arguments:

- `browser: SupportedBrowsers = chromium`
- `headless: bool = True`
- `args: list[str] | None = None` (named-only)
- `channel: str | None = None` (named-only)
- `chromiumSandbox: bool = False` (named-only)
- `devtools: bool = False` (named-only)
- `downloadsPath: str | None = None` (named-only)
- `env: dict | None = None` (named-only)
- `executablePath: str | None = None` (named-only)
- `firefoxUserPrefs: dict[str, str | int | float | bool] | None = None` (named-only)
- `handleSIGHUP: bool = True` (named-only)
- `handleSIGINT: bool = True` (named-only)
- `handleSIGTERM: bool = True` (named-only)
- `ignoreDefaultArgs: list[str] | bool | None = None` (named-only)
- `port: int | None = None` (named-only) — Port to use for the browser server. Defaults to 0, which results in a random free port being assigned.
- `proxy: Proxy | None = None` (named-only)
- `reuse_existing: bool = True` (named-only)
- `slowMo: timedelta = 0:00:00` (named-only)
- `timeout: timedelta = 0:00:30` (named-only)
- `wsPath: str | None = None` (named-only) — Path at which to serve the browser server. For security, this defaults to an unguessable string.

Returns: `str`

Tags: BrowserControl, Setter

Launches a new playwright Browser server with specified options.

Returns a websocket endpoint (wsEndpoint) string that can be used to connect to the server.

Check `New Browser` for the other argument docs.

The launched browser server can be used to connect to it with `Connect To Browser` keyword. This keyword can also be used from command line with `rfbrowser launch-browser-server` command.

See [Playwright documentation](https://playwright.dev/docs/api/class-browserserver#browser-server) for more information.

### LocalStorage Clear

Arguments:

- `frame_selector: str | None = None` — If this selector points to an element inside an iframe, the LocalStorage of that frame is used. Example: `iframe[name="test"] >>> body`

Tags: PageContent, Setter

Remove all saved data from the local storage.

Example:

```robotframework
LocalStorage Set Item    Foo    bar
LocalStorage Clear
${item} =    LocalStorage Get Item    Foo
Should Be Equal    ${item}    ${None}
```

### LocalStorage Get Item

Arguments:

- `key: str` — Named key of the item in the storage.
- `assertion_operator: AssertionOperator | None = None` — Assertion operator to use. See `Assertions` for more information.
- `assertion_expected: Any | None = None` — Expected value to compare with.
- `message: str | None = None` — Custom error message to use.
- `frame_selector: str | None = None` — If this selector points to an element inside an iframe, the LocalStorage of that frame is used. Example: `iframe[name="test"] >>> body`

Returns: `Any`

Tags: Assertion, Getter, PageContent

Get saved data from the local storage.

See `Assertions` for further details about the assertion arguments. They default to `None`.

If the key does not exist in the storage, `${None}` is returned.

Example:

```robotframework
LocalStorage Get Item    Key    ==    Value    My error
${value} =    LocalStorage Get Item    Key
```

### LocalStorage Remove Item

Arguments:

- `key: str` — The name of the item which shall be deleted.
- `frame_selector: str | None = None` — If this selector points to an element inside an iframe, the LocalStorage of that frame is used. Example: `iframe[name="test"] >>> body`

Tags: PageContent, Setter

Remove saved data with key from the local storage.

Example:

```robotframework
LocalStorage Set Item       Foo    bar
LocalStorage Remove Item    Foo
${item} =    LocalStorage Get Item    Foo
Should Be Equal    ${item}    ${None}
```

### LocalStorage Set Item

Arguments:

- `key: str` — The name of the key under which it should be saved.
- `value: str` — The value which shall be saved as a string.
- `frame_selector: str | None = None` — If this selector points to an element inside an iframe, the LocalStorage of that frame is used. Example: `iframe[name="test"] >>> body`

Tags: PageContent, Setter

Save data to the local storage.

Example:

```robotframework
LocalStorage Set Item    Key    Value
```

### Merge Coverage Reports

Arguments:

- `input_folder: Path` — Path to the base folder where the raw coverage reports are located.
- `output_folder: Path` — Path to the folder where the combined report is stored.
- `config_file: Path | None = None` — Optional path to [options file](https://www.npmjs.com/package/monocart-coverage-reports#options)
- `name: str | None = None` — Optional name for the combined report.
- `reports: list[str] | None = None` — Optional list of reporters to create. Default is `v8`.

Returns: `Path`

Tags: Coverage, Setter

Combines multiple raw coverage reports into a single report.

Returns the path to the `output_folder`.

The `input_folder` argument is the base folder where the coverage reports are located. The keyword will look into each subfolder and if the subfolder contains a "raw" folder, it will use the data from the "raw" folder for the combined report.

The `output_folder` argument is the folder where the combined report is saved. If the folder does not exist, it is created. If the folder exists, its content is deleted before the report is created.

The `output_folder` and `input_folder` must be full paths to the folders.

The `config_file` argument is optional and can be used to provide a path to a monocart-coverage-reports options file. If the file is defined but does not exist, the keyword fails. For more details see: [https://www.npmjs.com/package/monocart-coverage-reports#config-file](https://www.npmjs.com/package/monocart-coverage-reports#config-file)

The `name` argument is optional and can be used to provide a name for the combined report. If it is not defined, the report is named "Browser library Merged Coverage Report".

The `reports` argument is optional and can be used to provide a list of reporters to create. Default is `v8`.

The keyword combines only the raw reports. To get raw reports, the `Start Coverage` keyword must be called with the `raw=True` argument. If no raw reports are found from the `input_folder`, the keyword fails. The keyword should be used when there is a need to combine multiple reports into a single report. For example, when tests are run in multiple pages. The example below demonstrates how to use the keyword.

Example:

```robotframework
New Page
Start Coverage
Go To    ${LOGIN_URL}
Test Feature X In The Page
Stop Coverage
New Page
Start Coverage
Go To    ${LOGIN_URL}
Test Feature Y In The Page
Stop Coverage
Merge Coverage Reports    ${OUTPUT_DIR}/browser/coverage    ${OUTPUT_DIR}/browser/combined-coverage
```

### Mouse Button

Arguments:

- `action: MouseButtonAction` — Defines if it is a mouseclick (`click`), holding down a button (`down`) or releasing it (`up`).
- `x: float | None = None` — Coordinates to move to before the action is executed. Both must be given, otherwise the action happens at the current mouse position.
- `y: float | None = None` — Coordinates to move to before the action is executed. Both must be given, otherwise the action happens at the current mouse position.
- `button: MouseButton = left` — One of `left`, `middle` or `right`. Defaults to `left`.
- `clickCount: int = 1` — Determines how often the button shall be clicked if action is equal to `click`. Defaults to 1.
- `delay: int | timedelta = 0:00:00` — Delay in Robot Framework time format between the mousedown and mouseup event. Can only be set if the action is `click`. Defaults to `0 s`.

Tags: PageContent, Setter

Clicks, presses or releases a mouse button.

**Attention:** Argument type `int` for 'delay' in milliseconds has been changed to `timedelta` in Browser 14.0.0. Use Robot Framework time format instead. For refactoring just add 'ms' after the delay number.

Delay Example:

```robotframework
Mouse Button    click    delay=100 ms
Mouse Button    click    delay=${dyn_delay} ms
```

Moving the mouse between holding down and releasing it is possible with `Mouse Move`.

Example:

```robotframework
Hover                     "Obstacle"           # Move mouse over the element
Mouse Button              down                 # Press mouse button down
Mouse Move Relative To    "Obstacle"    500    # Drag mouse
Mouse Button              up                   # Release mouse button
```

### Mouse Move

Arguments:

- `x: float` — Absolute coordinate starting at the left border of the page.
- `y: float` — Absolute coordinate down starting at the top border of the page.
- `steps: int = 1` — Number of intermediate steps for the mouse event. Often it is necessary to send more than one intermediate event to get the desired result. Defaults to 1.

Tags: PageContent, Setter

Moves the virtual mouse to the given coordinates, instead of to an element found by a selector.

The virtual mouse is left on the specified coordinates.

Example:

```robotframework
Mouse Move    400    400
```

### Mouse Move Relative To

Arguments:

- `selector: str` — Identifies the element whose center is the start-point.
- `x: float = 0.0` — Coordinates relative to the center of the element's bounding box.
- `y: float = 0.0` — Coordinates relative to the center of the element's bounding box.
- `steps: int = 1` — Number of intermediate steps for the mouse event. Often it is necessary to send more than one intermediate event to get the desired result. Defaults to 1.

Tags: PageContent, Setter

Moves the mouse cursor relative to the selected element.

Keyword uses strict mode, see `Finding elements` for more details about strict mode.

Example:

```robotframework
Mouse Move Relative To    id=indicator    -100
```

### Mouse Wheel

Arguments:

- `deltaX: int` — Pixels that are scrolled horizontally.
- `deltaY: int` — Pixels that are scrolled vertically.

Tags: PageContent, Setter

Simulates the user rotation of a mouse wheel.

Example:

```robotframework
# Before doing a mouse wheel interaction. A mouse needs to be positioned on the browser window.
Hover    body
Mouse Wheel    0    250
```

### New Browser

Arguments:

- `browser: SupportedBrowsers = chromium` — Opens the specified `browser`. Defaults to chromium.
- `headless: bool = True` — Set to False if you want a GUI. Defaults to True.
- `args: list[str] | None = None` (named-only) — Additional arguments to pass to the browser instance. The list of Chromium flags can be found [here](http://peter.sh/experiments/chromium-command-line-switches/). Defaults to None.
- `channel: str | None = None` (named-only) — Allows operating against the stock Google Chrome and Microsoft Edge browsers. Can only be used together with the `chromium` browser, otherwise the keyword fails. For more details see: [Playwright documentation](https://playwright.dev/docs/browsers#google-chrome--microsoft-edge).
- `chromiumSandbox: bool = False` (named-only) — Enable Chromium sandboxing. Defaults to False.
- `devtools: bool = False` (named-only) — Chromium-only. Whether to auto-open a Developer Tools panel for each tab. Defaults to False.
- `downloadsPath: str | None = None` (named-only) — If specified, accepted downloads are downloaded into this folder. Otherwise, temporary folder is created and is deleted when browser is closed. Regarding file deletion, see the docs of `Download` and `Promise To Wait For Download`.
- `env: dict | None = None` (named-only) — Specifies environment variables that will be visible to the browser. Dictionary keys are variable names, values are the content. Defaults to None.
- `executablePath: str | None = None` (named-only) — Path to a browser executable to run instead of the bundled one. If executablePath is a relative path, then it is resolved relative to current working directory. Note that Playwright only works with the bundled Chromium, Firefox or WebKit, use at your own risk. Defaults to None.
- `firefoxUserPrefs: dict[str, str | int | float | bool] | None = None` (named-only) — Firefox user preferences. Learn more about the Firefox user preferences at [about:config](https://support.mozilla.org/en-US/kb/about-config-editor-firefox).
- `handleSIGHUP: bool = True` (named-only) — Close the browser process on SIGHUP. Defaults to True.
- `handleSIGINT: bool = True` (named-only) — Close the browser process on Ctrl-C. Defaults to True.
- `handleSIGTERM: bool = True` (named-only) — Close the browser process on SIGTERM. Defaults to True.
- `ignoreDefaultArgs: list[str] | bool | None = None` (named-only) — If True, Playwright does not pass its own configuration args and only uses the ones from `args`. If a list is given, then the given default arguments are filtered out. Dangerous option; use with care. Defaults to None, which means Playwright's own default arguments are used.
- `proxy: Proxy | None = None` (named-only) — Network `Proxy` settings. Structure: `{'server': <str>, 'bypass': <Optional[str]>, 'username': <Optional[str]>, 'password': <Optional[str]>}`. Robot Framework 7.4 Secret type is supported.
- `reuse_existing: bool = True` (named-only) — If set to True, an existing browser instance that was created with the same arguments is reused. If no such browser exists, a new one is started. Defaults to True.
- `slowMo: timedelta = 0:00:00` (named-only) — Slows down Playwright operations by the given time, in Robot Framework time format. Useful so that you can see what is going on. Defaults to no delay.
- `timeout: timedelta = 0:00:30` (named-only) — Maximum time in Robot Framework time format to wait for the browser instance to start. Defaults to 30 seconds. Pass 0 to disable timeout.

Returns: `str`

Tags: BrowserControl, Setter

Create a new playwright Browser with specified options.

See `Browser, Context and Page` for more information about Browser and related concepts.

Returns a stable identifier for the created browser.

### New Context

Arguments:

- `acceptDownloads: bool = True` (named-only) — Whether to automatically download all the attachments. Defaults to True where all the downloads are accepted.
- `baseURL: str | None = None` (named-only) — When using `Go To`, `Wait For Request`, `Wait For Response` or `Wait For Navigation` it takes the base URL in consideration by using the URL() constructor for building the corresponding URL. Unset by default. Examples: `baseURL=http://localhost:3000` and navigating to `/bar.html` results in `http://localhost:3000/bar.html`. `baseURL=http://localhost:3000/foo/` and navigating to `./bar.html` results in `http://localhost:3000/foo/bar.html`. `baseURL=http://localhost:3000/foo` (without trailing slash) and navigating to `./bar.html` results in `http://localhost:3000/bar.html`.
- `bypassCSP: bool = False` (named-only) — Toggles bypassing page's Content-Security-Policy. Defaults to False.
- `clientCertificates: list[ClientCertificate] | None = None` (named-only) — Specifies a client certificate for mTLS authentication, for example `clientCertificates=[{'origin': '[https://playwright.dev](https://playwright.dev)', 'pfxPath': 'certificate.p12', 'passphrase': 'password'}]`. **NOTE:** The origin needs to be exact without any path.
- `colorScheme: ColorScheme | None = None` (named-only) — Emulates the `prefers-color-scheme` media feature, supported values are `light`, `dark`, `no-preference` and `null`. `null` disables the emulation.
- `defaultBrowserType: SupportedBrowsers | None = None` (named-only) — If no browser is open and `New Context` opens a new browser with defaults, this setting defines which browser is opened. Very useful together with the `Get Device` keyword.
- `deviceScaleFactor: float | None = None` (named-only) — Specify device scale factor (can be thought of as dpr). Defaults to `1`.
- `extraHTTPHeaders: dict[str, str] | None = None` (named-only) — A dictionary containing additional HTTP headers to be sent with every request. All header values must be strings.
- `forcedColors: ForcedColors = none` (named-only) — Emulates the `forced-colors` media feature, supported values are `active`, `none` and `null`. Defaults to `none`.
- `geolocation: GeoLocation | None = None` (named-only) — A dictionary containing `latitude` and `longitude` and optionally `accuracy` to emulate. If `latitude` or `longitude` is not specified, the device geolocation won't be overridden.
- `hasTouch: bool | None = None` (named-only) — Specifies if viewport supports touch events. Defaults to False.
- `httpCredentials: HttpCredentials | None = None` (named-only) — Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication).
- `ignoreHTTPSErrors: bool = False` (named-only) — Whether to ignore HTTPS errors during navigation. Defaults to False.
- `isMobile: bool | None = None` (named-only) — Whether the meta viewport tag is taken into account and touch events are enabled. Defaults to False.
- `javaScriptEnabled: bool = True` (named-only) — Whether or not to enable JavaScript in the context. Defaults to True.
- `locale: str | None = None` (named-only) — Specify user locale, for example `en-GB`, `de-DE`, etc.
- `offline: bool = False` (named-only) — Toggles browser's offline mode. Defaults to False.
- `permissions: list[Permission] | None = None` (named-only) — A list containing permissions to grant to all pages in this context. All permissions that are not listed here will be automatically denied.
- `proxy: Proxy | None = None` (named-only) — Network proxy settings to use with this context. Defaults to None. **NOTE:** For Chromium on Windows the browser needs to be launched with the global proxy for this option to work. If all contexts override the proxy, global proxy will be never used and can be any string, for example `proxy={ server: '[http://per-context](http://per-context)' }`.
- `recordHar: RecordHar | None = None` (named-only) — Enables [HAR](http://www.softwareishard.com/blog/har-12-spec/) recording for all pages into a file. The `path` key must be a path to a file, for example `recordHar={'path': '${OUTPUT_DIR}/har.file'}`. A relative path is relative to the output directory. If not specified, the HAR is not recorded. Make sure to close the context for the HAR to be saved.
- `recordVideo: RecordVideo | None = None` (named-only) — Enables video recording for all pages into a folder. If not specified videos are not recorded. Make sure to close the context for videos to be saved. Video is not supported in remote browsers. See `RecordVideo` for the folder, size, frame rate and action annotations.
- `reducedMotion: ReduceMotion = no_preference` (named-only) — Emulates the `prefers-reduced-motion` media feature, supported values are `reduce` and `no-preference`. Defaults to `no-preference`.
- `screen: dict[str, int] | None = None` (named-only) — Emulates consistent window screen size available inside web page via window.screen. Is only used when the viewport is set. Example {'width': 414, 'height': 896}
- `serviceWorkers: ServiceWorkersPermissions | None = allow` (named-only) — Whether to allow sites to register Service workers. Defaults to `allow`.
- `storageState: Path | None = None` (named-only) — Restores the storage state created by the `Save Storage State` keyword. Must be a path to an existing file, otherwise the keyword fails. Relative paths are resolved against the current working directory.
- `timezoneId: str | None = None` (named-only) — Changes the timezone of the context. See [ICU metaZones.txt](https://source.chromium.org/chromium/chromium/src/+/master:third_party/icu/source/data/misc/metaZones.txt) for a list of supported timezone IDs.
- `tracing: bool | Path | None = None` (named-only) — Boolean `True` (recommendation) or file path or directory where the [tracing](https://playwright.dev/docs/api/class-tracing/) file is saved. The string `{contextid}` will be replaced with the context id. Path to \*.zip files can be absolute or relative to ${OUTPUT\_DIR}. Path to folders can be absolute or relative to ${OUTPUT\_DIR}/browser/traces. If boolean `True` or a directory is given, the trace file will automatically be named `trace_{contextid}.zip`. Temporary trace files will be saved to ${OUTPUT\_DIR}/browser/traces/temp. Tracing is automatically closed when context is closed. Temporary trace files will be automatically deleted at start of each test execution. Trace file can be opened after the test execution by running command from shell: `rfbrowser show-trace /path/to/trace.zip`. Tracing can also be enabled by setting a Robot Framework variable or environment variable `ROBOT_FRAMEWORK_BROWSER_TRACING` to `True`.
- `userAgent: str | None = None` (named-only) — Specific user agent to use in this context.
- `viewport: ViewportDimensions | None = {'width': 1280, 'height': 720}` (named-only) — A dictionary containing `width` and `height`. Emulates consistent viewport for each page. Defaults to 1280x720. `None` disables the default viewport. If `width` and `height` are `0`, the viewport will scale with the window.

Returns: `str`

Tags: BrowserControl, Setter

Create a new BrowserContext with specified options.

See `Browser, Context and Page` for more information about BrowserContext.

Returns a stable identifier for the created context that can be used in `Switch Context`.

Example:

```robotframework
Test an iPhone
    ${device}=    Get Device    iPhone X
    New Context    &{device}        # unpacking here with &
    New Page    http://example.com
```

A BrowserContext is the Playwright object that controls a single browser profile. Within a context caches and cookies are shared. See [Playwright browser.newContext](https://playwright.dev/docs/api/class-browser#browsernewcontextoptions) for a list of supported options.

If there's no open Browser this keyword will open one. Does not create pages. It is not possible to create a new context in a browser that was opened with `New Persistent Context`.

The httpCredentials and proxy arguments do support Robot Framework 7.4 Secret type. If Secret is used, the dictionary structure must be created before hand, example with Robot Framework's VAR syntax:

```robotframework
${user}   ${password} =    Get Secrets    # Returns username and password as Robot Framework Secret type
VAR    &{httpCredentials} =    username=${user}    password=${password}
New Context    httpCredentials=${httpCredentials}
```

Using dictionary literals with Robot Framework 7.4 Secret type is not supported, for example this will fail on variable conversion on Robot Framework side:

```robotframework
${user}   ${password} =    Get Secrets    # Returns username and password as Robot Framework Secret type
New Context    httpCredentials={'username': ${secret}, 'password': ${secret}}    # This will fail
```

### New Page

Arguments:

- `url: str | None = None` — Optional URL to navigate the page to. The url should include the protocol, for example `https://`.
- `wait_until: PageLoadStates = load` — When to consider operation succeeded, defaults to load. Events can be either: `domcontentloaded` - consider operation to be finished when the DOMContentLoaded event is fired. `load` - consider operation to be finished when the load event is fired. `networkidle` - consider operation to be finished when there are no network connections for at least 500 ms. `commit` - consider operation to be finished when network response is received and the document started loading.

Returns: `NewPageDetails`

Tags: BrowserControl, Setter

Open a new Page.

A Page is the Playwright equivalent to a tab. See `Browser, Context and Page` for more information about Page concept.

Returns `NewPageDetails` as dictionary for created page. `NewPageDetails` (dict) contains the keys `page_id` and `video_path`. `page_id` is a stable identifier for the created page. `video_path` is path to the created video or empty if video is not created.

When a `New Page` is called without an open browser, `New Browser` and `New Context` are executed with default values first.

If navigating to `url` fails, the keyword fails and the newly created page is closed again. The page is closed only after the keyword set with `Register Keyword To Run On Failure` has run, so the failure screenshot shows the page that failed to load.

If the wait times out, the page's load report is logged: whether its navigation committed, how far the document got and which requests were still open.

### New Persistent Context

Arguments:

- `userDataDir: str = ` — Path to a User Data Directory, which stores browser session data like cookies and local storage. Note that Chromium's user data directory is the parent directory of the "Profile Path" seen at [chrome://version](chrome://version). Pass an empty string to use a temporary directory instead.
- `browser: SupportedBrowsers = chromium` — Browser type to use. Default is Chromium.
- `headless: bool = True` — Whether to run browser in headless mode. Defaults to `True`.
- `acceptDownloads: bool = True` (named-only)
- `args: list[str] | None = None` (named-only)
- `baseURL: str | None = None` (named-only)
- `bypassCSP: bool = False` (named-only)
- `channel: str | None = None` (named-only)
- `chromiumSandbox: bool = False` (named-only)
- `colorScheme: ColorScheme | None = None` (named-only)
- `defaultBrowserType: SupportedBrowsers | None = None` (named-only)
- `deviceScaleFactor: float | None = None` (named-only)
- `devtools: bool = False` (named-only)
- `downloadsPath: str | None = None` (named-only)
- `env: dict | None = None` (named-only)
- `executablePath: str | None = None` (named-only)
- `extraHTTPHeaders: dict[str, str] | None = None` (named-only)
- `forcedColors: ForcedColors = none` (named-only)
- `geolocation: GeoLocation | None = None` (named-only)
- `handleSIGHUP: bool = True` (named-only)
- `handleSIGINT: bool = True` (named-only)
- `handleSIGTERM: bool = True` (named-only)
- `hasTouch: bool | None = None` (named-only)
- `httpCredentials: HttpCredentials | None = None` (named-only)
- `ignoreDefaultArgs: list[str] | bool | None = None` (named-only)
- `ignoreHTTPSErrors: bool = False` (named-only)
- `isMobile: bool | None = None` (named-only)
- `javaScriptEnabled: bool = True` (named-only)
- `locale: str | None = None` (named-only)
- `offline: bool = False` (named-only)
- `permissions: list[Permission] | None = None` (named-only)
- `proxy: Proxy | None = None` (named-only)
- `recordHar: RecordHar | None = None` (named-only)
- `recordVideo: RecordVideo | None = None` (named-only)
- `reducedMotion: ReduceMotion = no_preference` (named-only)
- `screen: dict[str, int] | None = None` (named-only)
- `serviceWorkers: ServiceWorkersPermissions | None = allow` (named-only)
- `slowMo: timedelta = 0:00:00` (named-only)
- `timeout: timedelta = 0:00:30` (named-only)
- `timezoneId: str | None = None` (named-only)
- `tracing: bool | Path | None = None` (named-only)
- `url: str | None = None` (named-only)
- `userAgent: str | None = None` (named-only)
- `viewport: ViewportDimensions | None = {'width': 1280, 'height': 720}` (named-only)

Opens a new persistent context.

`New Persistent Context` basically executes `New Browser`, `New Context` and `New Page` in one step and sets a profile at the same time. See [persistent context](https://playwright.dev/docs/api/class-browsertype#browser-type-launch-persistent-context) in Playwright docs.

This keyword returns a tuple of browser id, context id and page details. (New in Browser 15.0.0)

`other Arguments`: Please see `New Browser`, `New Context` and `New Page` for more information about the other arguments.

If you want to use extensions you need to download the extension as a .zip, enable loading the extension, and load the extensions using chromium arguments like below. Extensions only work with chromium and with a headful browser.

```robotframework
${launch_args}=  Set Variable  ["--disable-extensions-except=./ublock/uBlock0.chromium", "--load-extension=./ublock/uBlock0.chromium"]
${browserId}  ${contextId}  ${pageDetails}=  New Persistent Context  browser=chromium  headless=False  url=https://robocon.io  args=${launch_args}
```

Check `New Browser`, `New Context` and `New Page` for the specific argument docs.

### Open Browser

Arguments:

- `url: str | None = None` — Navigates to URL if provided. Defaults to None.
- `browser: SupportedBrowsers = chromium` — Specifies which browser to use. The supported browsers are listed in the table below.
- `headless: bool = False` — If set to False, a GUI is provided otherwise it is hidden. Defaults to False.
- `pause_on_failure: bool = True` — Stop execution when failure detected and leave browser open. Defaults to True.
- `bypassCSP=True` — Defaults to bypassing CSP and enabling custom script attach to the page.

Tags: BrowserControl, Setter

**DEPRECATED** Opens a new browser instance. Use this keyword for quick experiments or debugging sessions.

Use `New Page` directly instead of `Open Browser` for production and automated execution. See `Browser, Context and Page` for more information about Browser and related concepts.

Creates a new browser, context and page with specified settings.

Browsers:

| Value | Name(s) |
| --- | --- |
| `firefox` | [Firefox](https://www.mozilla.org/en-US/firefox/new) |
| `chromium` | [Chromium](https://www.chromium.org/Home) |
| `webkit` | [webkit](https://webkit.org/) |

### Pause At

Arguments:

- `time: datetime` — The time to pause the clock at.

Tags: Clock, Setter

Advances the clock by jumping forward in time and pauses it.

Fires due timers at most once. This is equivalent to a user closing the laptop lid for a while and reopening it at the specified time and then pausing. Pause can not move the clock backwards.

Example:

```robotframework
Set Time         2024-10-31 17:34:00    # Set the clock to a specific time
Do Something                            # Implement this in your keyword
Pause At         2024-10-31 18:34:00    # Pause the clock at a specific time
Check Something                         # Also this is implemented in your keyword
Resume Clock                            # Resume the clock
Do Something Else                       # Do something after clock runs normally
```

### Press Keys

Arguments:

- `selector: str` — Selector of the text field. See the `Finding elements` section for details about the selectors.
- `*keys: str` — Keys to be pressed one after the other. Combining modifiers with a single key press by chaining them with `+`, like `Control+Shift+T`, is supported.
- `press_duration: timedelta = 0:00:00` (named-only) — Delay between keydown and keyup of each key. Can be given as seconds (float) or as Robot Framework time string. Defaults to `0 ms`. Example: `50 ms`
- `key_delay: timedelta = 0:00:00` (named-only) — Delay between key presses. Can be given as seconds (float) or as Robot Framework time string. Defaults to `0 ms`. Example: `50 ms`

Tags: PageContent, Setter

Types the given key combination into element found by `selector`.

Supports values like `a` or `b` which will be automatically typed.

Also supports identifiers for keys like `ArrowLeft` or `Backspace`.

Keyword uses strict mode, see `Finding elements` for more details about strict mode.

See Playwright's documentation for a more comprehensive list of supported input keys. [Playwright docs for press.](https://playwright.dev/docs/api/class-page#page-press)

Example:

```robotframework
# Keyword         Selector                    *Keys
Press Keys      //*[@id="username_field"]    h    e   l   o   ArrowLeft   l
```

### Promise To

Arguments:

- `kw: str` — Keyword that will run asynchronously in the background.
- `*args` — Keyword arguments as normally used.

Returns: `Future`

Tags: Wait

Wrap a Browser library keyword and make it a promise.

The promised keyword is started in the background. Test execution continues without waiting for `kw` to finish.

Returns a reference to the promised keyword. Use `Wait For` or `Wait For All Promises` to wait for its result. Promises that are never waited for are waited for automatically at the end of the test, and a warning is logged.

Only Browser library keywords can be promised, any other keyword name fails the keyword.

Example:

```robotframework
${promise}=     Promise To            Wait For Response     matcher=     timeout=3
Click           \#delayed_request
${body}=        Wait For              ${promise}
```

### Promise To Upload File

Arguments:

- `path: PathLike` — Path to file to be uploaded.

Returns: `Future`

Tags: PageContent, Setter

Returns a promise that resolves when the file from `path` has been uploaded.

The file from `path` is uploaded into the next file chooser dialog on the page.

The keyword fails immediately if `path` does not point to an existing file. The promise fails if no file chooser dialog is opened within the timeout.

Example use:

```robotframework
${promise}=    Promise To Upload File    ${CURDIR}/test_upload_file.txt
Click          id=open_file_chooser_button
${upload_result}=    Wait For    ${promise}
```

Alternatively, you can use the `Upload File By Selector` keyword.

### Promise To Wait For Download

Arguments:

- `saveAs: str = ` — Defines path where the file is saved persistently. File will also temporarily be saved in playwright context's default download location. If empty, generated unique path (GUID) is used and file is deleted when the context is closed.
- `wait_for_finished: bool = True` — If true, promise will wait for download to finish. If false, promise will resolve immediately after download has started.
- `download_timeout: timedelta | None = None` — Maximum total time for the download to start and finish, counted from the moment the promise is created. If the download does not start within this time, the keyword fails. If it starts but does not finish, it is cancelled and the keyword fails. If `wait_for_finished` is `False`, only the start is limited. If not set, the download must start within the browser timeout, see `Set Browser Timeout`, and there is no limit for it to finish.

Returns: `Future`

Tags: BrowserControl, Wait

Returns a promise that waits for the next download event on the page.

To enable downloads the context's `acceptDownloads` needs to be true.

With the default file path downloaded files are deleted when the context the download happened in is closed.

If browser is connected remotely with `Connect To Browser` then `saveAs` must be set to store it locally where the browser runs!

Keyword returns dictionary of type `DownloadInfo` which contains downloaded file path and suggested filename as well as state and downloadID. Example:

```robotframework
{
  "saveAs": "/tmp/robotframework-browser/downloads/2f1b3b7c-1b1b-4b1b-9b1b-1b1b1b1b1b1b",
  "suggestedFilename": "downloaded_file.txt",
  "state": "finished",
  "downloadID": None
}
```

If `wait_for_finished` is `False`, `saveAs` is an empty string, `state` is `in_progress` and `downloadID` contains an id which can be used with `Get Download State` to check the download later.

The keyword `New Browser` has a `downloadsPath` setting which can be used to set the default download directory. If `saveAs` is set to a relative path, the file will be saved relative to the browser's `downloadsPath` setting or if that is not set, relative to the Playwright's working directory. If `saveAs` is set to an absolute path, the file will be saved to that absolute path independent of `downloadsPath`.

Set `download_timeout` when the download can take longer than the browser timeout, for example when the server generates the file before sending it.

If the URL for the file to download shall be used, `Download` keyword may be a simpler alternative way to download the file.

The waited promise returns a dictionary which contains saveAs and suggestedFilename as keys. The saveAs contains the location where the file is downloaded and suggestedFilename contains the suggested name for the download. The suggestedFilename is typically computed by the browser from the Content-Disposition response header or the download attribute. See the spec on [whatwg](https://html.spec.whatwg.org/#downloading-resources). Different browsers can use different logic for computing it.

Example usage:

```robotframework
New Context            acceptDownloads=True
New Page               ${LOGIN_URL}
${dl_promise}          Promise To Wait For Download    /path/to/download/file.name    download_timeout=30s
Click                  id=file_download
${file_obj}=           Wait For    ${dl_promise}
File Should Exist      ${file_obj}[saveAs]
Should Be True         ${file_obj.suggestedFilename}
```

### Record Keyword

Arguments:

- `name: str`
- `file: str | None = \${SUITE_SOURCE}`
- `idle_timeout: timedelta | None = 0:05:00`

Returns: `str`

Tags: Recorder

Record browser interactions as one User Keyword named `name`.

Shows the Robot Framework recorder toolbar on the pages of the **current** browser context and blocks until the recording ends. Every Action becomes a Keyword Call to a Browser keyword, is listed in the toolbar and is written to `file` immediately.

Toolbar buttons (each has a tooltip):

-   **✕** in the header: ends the session.
-   **Minimize** in the header (a dash): minimizes the toolbar.
-   **Discard**: drops the Keyword Calls recorded so far and starts the keyword again, empty.
-   **Undo**: removes the Keyword Calls of the last Action.
-   **Pause** (two bars): stops recording until **Resume**; Actions in between are not recorded.
-   **Pick** in the header: picks an element on the page, as `Record Selector` does, and adds its selector to the keyword as a comment row `# Picked Selector <selector>`. Playwright's own Pick locator button opens the same picker. While picking, nothing is recorded; **Cancel** returns to recording without a row.

The toolbar is in the recording state from the start. Click a value or a selector in the toolbar to turn the whole of it, or a marked part, into a Keyword Argument, named like `email` or `${email}`. The same dialog asks whether the marked value becomes the argument's default. The toolbar also offers to use the new argument for the same value elsewhere in the keyword (replacing repeated values).

The keyword is always created new: an existing keyword is never extended.

The recording ends with **Save** or **✕** in the toolbar, with Playwright's Record button, when `idle_timeout` passes without any Action or toolbar command, when all pages are closed, or on an error. The keyword being recorded is saved unless it has no Keyword Calls.

| Arguments | Description |
| --- | --- |
| `name` | Name of the User Keyword to create. It must not exist in `file` and must not shadow any keyword the running suite can call. |
| `file` | Target `.robot` or `.resource` file. Defaults to `${SUITE_SOURCE}`, the file of the running suite; in a suite initialisation file that is its `__init__.robot`, and a keyword recorded there can only be used in that file. A relative path is resolved against the current working directory, not against the suite; use `${CURDIR}` for a file next to the suite. The folder must exist and an existing file must be writable; both are checked before recording starts. With `${None}` nothing is written; the keyword is logged to the console and to the log at INFO level instead. |
| `idle_timeout` | Ends the recording after this long without an Action or toolbar command. Must be greater than zero. Default: 5 minutes, so a forgotten recording does not block the run for good. `${None}` waits without limit. |

Returns the text of the recorded keyword, including the `*** Keywords ***` header. If a recorded keyword cannot be written - the file became read-only, the disk is full - the keyword fails, and the recorded text is logged as a warning so nothing is lost.

What is generated: every keyword gets `[Tags] recorded`. A popup or new tab becomes `Switch Page NEW`. An Action on another open page gets a `Switch Page` to it first, using the id the Switch Page that left that page returned (`${page}= Switch Page NEW`); a page closed by hand becomes `Close Page`, or `Close Page ${page}` when it is not the active one. A page the keyword has no id of, for example one open before the recording, cannot be switched to, and the toolbar says so. A dialog gets `Handle Future Dialogs action=accept` before the Action (Playwright does not report whether the dialog was accepted); a download is wrapped in `Promise To Wait For Download` and `Wait For`. A file chosen in a file chooser wraps the click that opened it in `Promise To Upload File` and `Wait For`; the page never reveals the file's folder, so the path reads `<define_path_to_file>/<file name>` and must be completed (or made an argument). Playwright's Assert snapshot becomes `Get Aria Snapshot` with an exact YAML comparison, and Assert visibility becomes `Get Element States ... *= visible`. Playwright folds a navigation that happens within 5 seconds after a click, fill or key press into that Action, so it is not recorded as a `Go To` of its own. Hovers are not recorded, because Playwright does not report them. Other Actions without a Browser keyword are only reported in the toolbar.

Needs a visible browser: fails if the active browser was opened headless, since nobody could use the toolbar there. A browser attached with `Connect To Browser` is assumed to be visible.

Limitations: only the **current** browser context is recorded; other contexts are ignored. Playwright's own recorder toolbar is shown at the top centre of the page during the recording and cannot be hidden, so it covers the page there. The toolbar does not appear on a page whose Content-Security-Policy allows only Trusted Types policies it names, nor in a document without a body, such as an SVG file. A modal `<dialog>` of the page covers the toolbar until it is closed, and a click there is recorded on the dialog.

**Review a recorded keyword before you commit it.** Its values come from the page under test, including anything typed into password fields. During the session the toolbar state, including the recorded values and typed text, is readable by scripts of every page in the context, and those scripts can send toolbar commands. Keystrokes typed into the toolbar do not reach the page, except to a `window` capture listener the page registered before the toolbar was injected.

Requires a Playwright version that offers the programmatic recorder. The context stays prepared for recording after the session ends.

Example:

```robotframework
${text} =    Record Keyword    Login As Admin
Record Keyword    Search Product    ${CURDIR}/shop.resource    idle_timeout=15 min
Record Keyword    Try Something    file=${None}
```

See `Record Keywords` to record several keywords in one session.

### Record Keywords

Arguments:

- `file: str | None = \${SUITE_SOURCE}`
- `idle_timeout: timedelta | None = 0:05:00`

Returns: `str`

Tags: Recorder

Record several User Keywords in one session.

Use **Record keyword** in the toolbar to name and start a keyword, record it, and **Save** it; then start the next one. Actions while no keyword is being recorded are not captured, so you can navigate freely between keywords. A name must not exist in `file`, must not have been recorded earlier in the session, and must not shadow any keyword the running suite can call - such names are rejected in the toolbar.

Shows the Robot Framework recorder toolbar on the pages of the **current** browser context and blocks until the recording ends. Every Action becomes a Keyword Call to a Browser keyword, is listed in the toolbar and is written to `file` immediately.

Toolbar buttons (each has a tooltip):

-   **✕** in the header: ends the session.
-   **Minimize** in the header (a dash): minimizes the toolbar.
-   **Record keyword**: names and starts a keyword.
-   **Discard**: drops the keyword being recorded, also from `file`, and returns to idle.
-   **Undo**: removes the Keyword Calls of the last Action.
-   **Pause** (two bars): stops recording until **Resume**; Actions in between are not recorded.
-   **Pick** in the header: picks an element on the page, as `Record Selector` does, and adds its selector to the keyword as a comment row `# Picked Selector <selector>`. Playwright's own Pick locator button opens the same picker. While picking, nothing is recorded; **Cancel** returns to recording without a row.
-   **Save**: saves the keyword being recorded and returns to idle.

While the toolbar is minimized, its header offers **Start** (idle) or **Save** (recording).

The toolbar is idle until a keyword is started; Actions while idle are not recorded. While recording, click a value or a selector in the toolbar to turn the whole of it, or a marked part, into a Keyword Argument, named like `email` or `${email}`. The same dialog asks whether the marked value becomes the argument's default. The toolbar also offers to use the new argument for the same value elsewhere in the keyword (replacing repeated values).

Existing keywords are never extended.

The recording ends with **✕** in the toolbar header, with Playwright's Record button, when `idle_timeout` passes without any Action or toolbar command, when all pages are closed, or on an error. The keyword being recorded is saved unless it has no Keyword Calls.

| Arguments | Description |
| --- | --- |
| `file` | Target `.robot` or `.resource` file. Defaults to `${SUITE_SOURCE}`, the file of the running suite; in a suite initialisation file that is its `__init__.robot`, and a keyword recorded there can only be used in that file. A relative path is resolved against the current working directory, not against the suite; use `${CURDIR}` for a file next to the suite. The folder must exist and an existing file must be writable; both are checked before recording starts. With `${None}` nothing is written; the keywords are logged to the console and to the log at INFO level instead. |
| `idle_timeout` | Ends the recording after this long without an Action or toolbar command. Must be greater than zero. Default: 5 minutes, so a forgotten recording does not block the run for good. `${None}` waits without limit. |

Returns the text of all keywords recorded in the session, under one `*** Keywords ***` header. If a recorded keyword cannot be written - the file became read-only, the disk is full - the keyword fails, and the recorded text is logged as a warning so nothing is lost.

What is generated: every keyword gets `[Tags] recorded`. A popup or new tab becomes `Switch Page NEW`. An Action on another open page gets a `Switch Page` to it first, using the id the Switch Page that left that page returned (`${page}= Switch Page NEW`); a page closed by hand becomes `Close Page`, or `Close Page ${page}` when it is not the active one. A page the keyword has no id of, for example one open before the recording, cannot be switched to, and the toolbar says so. A dialog gets `Handle Future Dialogs action=accept` before the Action (Playwright does not report whether the dialog was accepted); a download is wrapped in `Promise To Wait For Download` and `Wait For`. A file chosen in a file chooser wraps the click that opened it in `Promise To Upload File` and `Wait For`; the page never reveals the file's folder, so the path reads `<define_path_to_file>/<file name>` and must be completed (or made an argument). Playwright's Assert snapshot becomes `Get Aria Snapshot` with an exact YAML comparison, and Assert visibility becomes `Get Element States ... *= visible`. Playwright folds a navigation that happens within 5 seconds after a click, fill or key press into that Action, so it is not recorded as a `Go To` of its own. Hovers are not recorded, because Playwright does not report them. Other Actions without a Browser keyword are only reported in the toolbar.

Needs a visible browser: fails if the active browser was opened headless, since nobody could use the toolbar there. A browser attached with `Connect To Browser` is assumed to be visible.

Limitations: only the **current** browser context is recorded; other contexts are ignored. Playwright's own recorder toolbar is shown at the top centre of the page during the recording and cannot be hidden, so it covers the page there. The toolbar does not appear on a page whose Content-Security-Policy allows only Trusted Types policies it names, nor in a document without a body, such as an SVG file. A modal `<dialog>` of the page covers the toolbar until it is closed, and a click there is recorded on the dialog.

**Review recorded keywords before you commit them.** Their values come from the page under test, including anything typed into password fields. During the session the toolbar state, including the recorded values and typed text, is readable by scripts of every page in the context, and those scripts can send toolbar commands. Keystrokes typed into the toolbar do not reach the page, except to a `window` capture listener the page registered before the toolbar was injected.

Requires a Playwright version that offers the programmatic recorder. The context stays prepared for recording after the session ends.

Example:

```robotframework
${text} =    Record Keywords
Record Keywords    ${CURDIR}/resources/shop.resource    idle_timeout=${None}
```

See `Record Keyword` to record exactly one keyword.

### Record Selector

Arguments:

- `label: str | None = None`
- `generator: SelectorGenerator = playwright`
- `idle_timeout: timedelta | None = 0:05:00`

Returns: `str`

Tags: PageContent, Recorder

Pick an element on the active page and return a selector for it.

Shows the Robot Framework toolbar on the active page and blocks until a selector is chosen. Move the pointer over the page: Playwright highlights the element under it and names it in a tooltip. Click to pick it; the click does not reach the page. Elements inside frames and open shadow roots can be picked too.

The toolbar then shows the selector for the picked element:

-   **Playwright** / **CSS**: switches between the selector generators for the same element, see `SelectorGenerator`.
-   The selector itself can be edited. The elements it finds stay highlighted on the page, and the toolbar counts them; after an edit both follow once typing pauses for a second. One match is what most keywords need, several are shown as a warning, none as an error. The highlight ends with the keyword.
-   **Highlight** (a dashed square): switches the highlight off and on; it is on by default.
-   **Reselect**: picks another element.
-   **Use**: returns the selector, also when it does not find exactly one element.
-   **✕** in the header, or Escape in the toolbar: cancels, and the keyword fails.
-   Minimized, the header offers **Reselect** and **Use** once an element is picked.

| Arguments | Description |
| --- | --- |
| `label` | Shown in the toolbar header, to say which element to pick. |
| `generator` | The generator the toolbar starts with; the toolbar can switch it. `playwright` (default) or `css`. |
| `idle_timeout` | Fails the keyword after this long without a pick or toolbar command. Must be greater than zero. Default: 5 minutes. `${None}` waits without limit. |

Fails in a headless browser, while a `Record Keyword` or `Record Keywords` session runs in the browser context, when the page is closed, on cancel and when the `idle_timeout` passes.

The toolbar has the limits of the `Record Keyword` toolbar: it does not appear on a page whose Content-Security-Policy allows only Trusted Types policies it names, nor in a document without a body.

Like the recorder toolbar, the toolbar's commands are reachable by scripts of the page under test: use it on applications you trust, and check the selector you get.

Example:

```robotframework
${selector} =    Record Selector    Login button
Click    ${selector}
${heading} =    Record Selector    Page header    generator=css
Get Text    ${heading}    ==    Expected text
```

### Register Keyword To Run On Failure

Arguments:

- `keyword: str | None` — The name of a keyword that will be executed if a Browser keyword fails. It is possible to use any available keyword, including user keywords or keywords from other libraries.
- `*args: str` — The arguments to the keyword if any.
- `scope: Scope = Global` (named-only) — Scope defines the lifetime of this setting. Available values are `Global`, `Suite` or `Test` / `Task`. See `Scope Setting` for more details.

Returns: `DelayedKeyword`

Tags: Config

Sets the keyword to execute, when a Browser keyword fails.

The initial keyword to use is set when `importing` the library, and the keyword that is used by default is `Take Screenshot fail-screenshot-{index}`. Taking a screenshot when something failed is a very useful feature, but notice that it can slow down the execution.

It is possible to use string `NONE` or any other robot falsy name, case-insensitively, as well as Python `None` to disable this feature altogether.

This keyword returns an object which contains the previously registered failure keyword. The return value can always be used to restore the original value later. The returned object contains the keyword name and the possible arguments used for the keyword.

If the `Take Screenshot` keyword is registered as run on failure keyword without positional arguments and without the `filename` argument, then the default value of the `filename` argument is not used as screenshot file name. Instead, `${TEST NAME}_FAILURE_SCREENSHOT_{index}` in the output directory is used as file name. If there is a need to use the default value of the `filename` argument, use `robotframework-browser-screenshot-{index}` as the `filename` argument value.

Example:

```robotframework
Register Keyword To Run On Failure    Take Screenshot    # Uses ${TEST NAME}_FAILURE_SCREENSHOT_{index} as filename
Register Keyword To Run On Failure    Take Screenshot    robotframework-browser-screenshot-{index}    # Uses robotframework-browser-screenshot-{index} as filename
${previous kw}=    Register Keyword To Run On Failure    NONE    # Disables run on failure functionality.
Register Keyword To Run On Failure    ${previous kw}
Register Keyword To Run On Failure    Take Screenshot    fullPage=True
Register Keyword To Run On Failure    Take Screenshot    failure-{index}    fullPage=True
```

### Reload

Arguments:

- `timeout: timedelta | None = None` — Maximum time for the reload to succeed. If not given, the currently set browser timeout is used.
- `waitUntil: PageLoadStates = load` — When to consider the operation succeeded, defaults to `load`.

Tags: BrowserControl, Setter

Reloads current active page.

`waitUntil` events can be either: `domcontentloaded` - consider the operation to be finished when the DOMContentLoaded event is fired. `load` - consider the operation to be finished when the load event is fired. `networkidle` - consider the operation to be finished when there are no network connections for at least 500 ms. `commit` - consider the operation to be finished when the network response is received and the document started loading.

If the wait times out, the page's load report is logged: whether its navigation committed, how far the document got and which requests were still open.

### Remove Locator Handler

Arguments:

- `locator: str`

Tags: PageContent, Setter

Remove the locator handler indicated by `locator`.

The `locator` must be exactly the same string that was used as the `selector` argument when the handler was added. Handlers are tied to the page in which they were added, therefore this keyword removes the handler from the active page only. If no handler is found, the keyword does not fail, it only logs that no handler was found.

### Resume Clock

Arguments: none

Tags: Clock, Setter

Resumes the clock.

Once this keyword is called, time resumes flowing and timers are fired as usual.

### Save Page As Pdf

Arguments:

- `path: PathLike` — Where the PDF is saved. If the path is not absolute, the file is saved relative to ${OUTPUT\_DIR}.
- `displayHeaderFooter: bool = False` (named-only) — Display header and footer. Defaults to false.
- `footerTemplate: str = ` (named-only) — HTML template for the print footer. Should use the same format as the `headerTemplate`.
- `format: PdfFormat = Letter` (named-only) — Paper format. If set, takes priority over the `width` and `height` arguments. Defaults to `Letter`.
- `headerTemplate: str = ` (named-only) — HTML template for the print header. Both templates are only rendered when `displayHeaderFooter` is true. See the detailed explanation below.
- `height: str = 0px` (named-only) — Paper height, accepts values labeled with units.
- `landscape: bool = False` (named-only) — Paper orientation. Defaults to false.
- `margin: PdfMarging = {'top': '0px', 'right': '0px', 'bottom': '0px', 'left': '0px'}` (named-only) — Defines the PDF margins, see `PdfMarging` for more details. Defaults to `0px` on all sides.
- `outline: bool = False` (named-only) — Whether or not to embed the document outline into the PDF. Defaults to false.
- `pageRanges: str = ` (named-only) — Paper ranges to print, e.g. `1-5, 8, 11-13`. Defaults to the empty string, which means print all pages.
- `preferCSSPageSize: bool = False` (named-only) — Give any CSS `@page` size declared in the page priority over what is declared in the `width` and `height` or `format` arguments. Defaults to false, which will scale the content to fit the paper size.
- `printBackground: bool = False` (named-only) — Print background graphics. Defaults to false.
- `scale: float = 1` (named-only) — Scale of the webpage rendering. Defaults to 1. Scale amount must be between 0.1 and 2.
- `tagged: bool = False` (named-only) — Whether or not to generate a tagged (accessible) PDF. Defaults to false.
- `width: str = 0px` (named-only) — Paper width, accepts values labeled with units.

Returns: `str`

Tags: Getter, PageContent

Saves page as PDF.

Saving a PDF is currently only supported in Chromium and only when the browser is running in headless mode.

`headerTemplate` and `footerTemplate` should be valid HTML markup. The following classes can be used to inject printing values into them:

-   `date` formatted print date
-   `title` document title
-   `url` document location
-   `pageNumber` current page number
-   `totalPages` total pages in the document

All possible units are:

-   `px` - pixel
-   `in` - inch
-   `cm` - centimeter
-   `mm` - millimeter

`headerTemplate` and `footerTemplate` markup have the following limitations:

-   Script tags inside the templates are not evaluated.
-   Page styles are not visible inside the templates.

Returns the path to the saved PDF file.

More details can be found in the [Playwright pdf documentation](https://playwright.dev/docs/api/class-page#page-pdf).

Example:

```robotframework
New Browser        Chromium              headless=True
New Page           ${URL}
Emulate Media      media=screen
${pdf_path} =      Save Page As Pdf    page.pdf
Should Be Equal    ${pdf_path}           ${OUTPUT_DIR}${/}page.pdf
```

### Save Storage State

Arguments:

- `path: Path | None = None` — Where the state file is written. Relative paths are resolved against the current working directory and missing parent directories are created. If the file already exists, it is overwritten. If not given, a file with a generated name is created in ${OUTPUTDIR}/browser/state. The absolute path of the written file is returned.
- `indexedDB: bool = False` (named-only) — Also save IndexedDB. Needed by applications, like Firebase, which store authentication tokens in IndexedDB.
- `credentials: bool = False` (named-only) — Also save the context's virtual WebAuthn credentials, as created by `Create Credential`. This is not related to the `httpCredentials` argument of `New Context`, which is about HTTP authentication.

Returns: `str`

Tags: BrowserControl, Getter

Saves the current active context storage state to a file.

Web apps use cookie-based or token-based authentication, where authenticated state is stored as [cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies) or in [local storage](https://developer.mozilla.org/en-US/docs/Web/API/Storage). This keyword retrieves the storage state from authenticated contexts and saves it to disk. Then `New Context` can be created with prepopulated state.

Please note that the state file may contain secrets and should not be shared with people outside of your organisation.

Files in ${OUTPUTDIR}/browser/state are automatically deleted when new test execution starts. To keep a state file over several executions, save it with `path` to a location outside of that folder. File path is returned by the keyword.

Example:

```robotframework
Test Case
    New context
    New Page    https://login.page.html
    #  Perform login
    VAR    ${username: Secret}    %{USERNAME}    # Convert environment variable to secret
    VAR    ${password: Secret}    %{PASSWORD}    # Convert environment variable to secret
    Fill Secret    id=username    ${username}
    Fill Secret    id=password    ${password}
    Click    id=button
    Get Text    id=header    ==    Something
    #  Save storage to disk
    ${state_file} =    Save Storage State
    #  Create new context with saved state
    New context    storageState=${state_file}
    New Page    https://login.page.html
    #  Login is not needed because authentication is read from state file
    Get Text    id=header    ==    Something
```

### Scroll By

Arguments:

- `selector: str | None = None` — Selector of the element. If the selector is `${None}` or `${Empty}` the page itself is scrolled. To ensure an element is in view use `Hover` instead. See the `Finding elements` section for details about the selectors.
- `vertical: str = height` — Defines how far and in which direction to scroll vertically. It can be a positive or negative number. Positive scrolls down, like `50`, negative scrolls up, like `-50`. It can be a percentage value of the absolute scrollable size, like `9.95%` or negative like `-10%`. It can be the string `height` to scroll exactly one visible height down, or `-height` to scroll one visible height up. *Be aware that some pages do lazy loading and load more content once you scroll down.* The percentage of the current scrollable height is used and may change. Defaults to `height`.
- `horizontal: str = 0` — Defines how far and in which direction to scroll horizontally. Works the same way as `vertical`, but positive values scroll to the right and negative values to the left. `width` scrolls exactly one visible range to the right. Defaults to `0`.
- `behavior: ScrollBehavior = auto` — Defines whether the scroll happens instantly or smoothly. Defaults to `auto`.

Tags: PageContent, Setter

Scrolls an element or the page relative from current position by the given values.

Keyword uses strict mode, see `Finding elements` for more details about strict mode.

### Scroll To

Arguments:

- `selector: str | None = None` — Selector of the element. If the selector is `${None}` or `${Empty}` the page itself is scrolled. To ensure an element is in view use `Hover` instead. See the `Finding elements` section for details about the selectors.
- `vertical: str = top` — Defines where to scroll vertically. It can be a positive number, like `300`. It can be a percentage value of the absolute scrollable size, like `50%`. It can be a string defining the top or the bottom of the scroll area. < `top` | `bottom` > *Be aware that some pages do lazy loading and load more content once you scroll down.* Bottom defines the currently known bottom coordinate. Defaults to `top`.
- `horizontal: str = left` — Defines where to scroll horizontally. Works the same way as `vertical`, but defines < `left` | `right` > as start and end. Defaults to `left`.
- `behavior: ScrollBehavior = auto` — Defines whether the scroll happens instantly or smoothly. Defaults to `auto`.

Tags: PageContent, Setter

Scrolls an element or the page to an absolute position based on given coordinates.

Keyword uses strict mode, see `Finding elements` for more details about strict mode.

### Scroll To Element

Arguments:

- `selector: str` — Selector of the element. See the `Finding elements` section for details about the selectors.

Tags: PageContent, Setter

This method waits for actionability checks, then tries to scroll element into view, unless it is completely visible.

Keyword uses strict mode, see `Finding elements` for more details about strict mode.

Does nothing if the element is already completely visible.

### Select Options By

Arguments:

- `selector: str` — Selector of the `<select>` tag. See the `Finding elements` section for details about the selectors.
- `attribute: SelectAttribute` — Attribute to select options by. Can be `value`, `label`, `text` or `index`. Where `label` and `text` are same.
- `*values` — Values to select.

Returns: `list[Any]`

Tags: PageContent, Setter

Selects options from select element found by `selector`.

Returns a list of the options which the keyword was able to select. The type of the list items matches the `attribute` definition. For example, if `attribute` equals `label`, the returned list contains label values. Or in case of `index`, it contains the selected indexes.

Keyword uses strict mode, see `Finding elements` for more details about strict mode.

If no values to select are passed, all options of the element are deselected. The keyword fails if none of the given values matches an option.

Example:

```robotframework
${selected} =    Select Options By    select[name=preferred_channel]    label    Direct mail
List Should Contain Value    ${selected}    Direct mail
${selected} =    Select Options By    select[name=interests]    value    males    females    others
List Should Contain Value    ${selected}    males
List Should Contain Value    ${selected}    females
List Should Contain Value    ${selected}    others
Length Should Be    ${selected}    3
${selected} =    Select Options By    select[name=possible_channels]    index    0    2
List Should Contain Value    ${selected}    0
List Should Contain Value    ${selected}    2
${selected} =    Select Options By    select[name=interests]    text     Males    Females
List Should Contain Value    ${selected}    Males
List Should Contain Value    ${selected}    Females
```

### SessionStorage Clear

Arguments:

- `frame_selector: str | None = None` — If this selector points to an element inside an iframe, the SessionStorage of that frame is used. Example: `iframe[name="test"] >>> body`

Tags: PageContent, Setter

Remove all saved data from the session storage.

Example:

```robotframework
SessionStorage Set Item    mykey3    myvalue3
SessionStorage Clear
SessionStorage Get Item    mykey3    ==    ${None}
```

### SessionStorage Get Item

Arguments:

- `key: str` — Named key of the item in the storage.
- `assertion_operator: AssertionOperator | None = None` — Assertion operator to use. See `Assertions` for more information.
- `assertion_expected: Any | None = None` — Expected value to compare with.
- `message: str | None = None` — Custom error message to use.
- `frame_selector: str | None = None` — If this selector points to an element inside an iframe, the SessionStorage of that frame is used. Example: `iframe[name="test"] >>> body`

Returns: `Any`

Tags: Assertion, Getter, PageContent

Get saved data from the session storage.

See `Assertions` for further details about the assertion arguments. They default to `None`.

If the key does not exist in the storage, `${None}` is returned.

Example:

```robotframework
SessionStorage Set Item    key2    value2
${item} =    SessionStorage Get Item    key2
Should Be Equal    ${item}    value2
```

### SessionStorage Remove Item

Arguments:

- `key: str` — The name of the item which shall be deleted.
- `frame_selector: str | None = None` — If this selector points to an element inside an iframe, the SessionStorage of that frame is used. Example: `iframe[name="test"] >>> body`

Tags: PageContent, Setter

Remove saved data with key from the session storage.

Example:

```robotframework
SessionStorage Set Item       mykey2    myvalue2
SessionStorage Remove Item    mykey2
SessionStorage Get Item       mykey2    ==    ${None}
```

### SessionStorage Set Item

Arguments:

- `key: str` — The name of the key under which it should be saved.
- `value: str` — The value which shall be saved as a string.
- `frame_selector: str | None = None` — If this selector points to an element inside an iframe, the SessionStorage of that frame is used. Example: `iframe[name="test"] >>> body`

Tags: PageContent, Setter

Save data to session storage.

Example:

```robotframework
SessionStorage Set Item    key2    value2
```

### Set Assertion Formatters

Arguments:

- `formatters: Dict[FormatterKeywords, list[FormatingRules | LambdaFunction]]` — Dictionary of keywords and formatters, where the key is the name of the keyword where the formatters are applied. The dictionary value is a list of formatters which are applied. Formatters for a defined keyword are always overwritten. An empty list will clear all formatters for the keyword. If `formatters` is an empty dictionary, then all formatters are cleared from all keywords, in the Global scope, regardless of the `scope` argument.
- `scope: Scope = Suite` — Defines the lifetime of the formatter, possible values are Global, Suite and Test.

Returns: `dict[str, list[str]]`

Tags: Config

Set keywords formatters for assertions.

Returns the formatters which were in use before this keyword was called. Formatters defined as lambda functions are not included in the returned value.

See type documentation of `FormatterKeywords` and `FormatingRules` for more information.

It is possible to define own formatters as lambda functions.

Example:

```robotframework
Set Assertion Formatters    {"Get Text": ["strip", "normalize spaces"]}  # This will convert all kinds of spaces to a single space and remove spaces from the start and end of the string.
Set Assertion Formatters    {"Get Title": ["apply to expected","lambda x: x.replace(' ', '')"]}  # This will remove all spaces from the string.
${value} =    Get Text    //div    ==    ${SPACE}Expected${SPACE * 2}Text
Should Be Equal    ${value}    Expected Text
```

### Set Browser Timeout

Arguments:

- `timeout: timedelta` — The timeout is set for the current Playwright context and for new contexts. Supports Robot Framework [time format](https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#time-format).
- `scope: Scope = Suite` — Scope defines the live time of that setting. Available values are `Global`, `Suite` or `Test` / `Task`. See `Scope Setting` for more details.

Returns: `str`

Tags: Config, Setter

Sets the timeout used by most input and getter keywords.

Returns the previous value of the timeout.

Example:

```robotframework
${old_timeout} =    Set Browser Timeout    1m 30 seconds
Click     //button
Set Browser Timeout    ${old_timeout}
```

`Close Browser` and `Close Context` are not shortened by this setting; they always get at least 20 seconds.

### Set Default Run Before Unload

Arguments:

- `runBeforeUnload: bool`

Returns: `bool`

Tags: BrowserControl, Setter

Set default runBeforeUnload value when `Close Page` is called indirectly.

Close Page is called indirectly when [automatic page closing](https://marketsquare.github.io/robotframework-browser/Browser.html#Automatic%20page%20and%20context%20closing) is done. The default value is false and this keyword can be used to change value. Returns the old runBeforeUnload value.

### Set Geolocation

Arguments:

- `latitude: float` — Latitude between -90 and 90.
- `longitude: float` — Longitude between -180 and 180.
- `accuracy: float | None = None` — Non-negative accuracy value. Defaults to 0.

Tags: BrowserControl, Setter

Updates the current context's geolocation.

Latitude can be between -90 and 90 and longitude can be between -180 and 180. The accuracy of the location must be a non-negative number and defaults to 0. When creating the context, grant the `geolocation` permission so that pages can read the geolocation.

Example:

```robotframework
${permissions} =    Create List    geolocation
New Context    permissions=${permissions}
Set Geolocation    60.173708    24.982263    3    # Points to Korkeasaari in Helsinki.
```

### Set Highlight On Failure

Arguments:

- `highlight: bool = True` — If `True`, the element is highlighted when a screenshot is taken on failure. If `False`, the element is not highlighted in the screenshot.
- `scope: Scope = Suite` — Scope defines the live time of that setting. Available values are `Global`, `Suite` or `Test` / `Task`. See `Scope Setting` for more details.

Returns: `bool`

Tags: Config, Setter

Controls if the element is highlighted on failure.

Returns the previous value of the setting.

Example:

```robotframework
Set Highlight On Failure    True
```

### Set Offline

Arguments:

- `offline: bool = True` — Toggles the offline mode. Set to `False` to switch back to online mode. Defaults to `True`.

Tags: BrowserControl, Setter

Toggles the current context's offline emulation.

### Set Presenter Mode

Arguments:

- `mode: HighLightElement | bool` — When set to `True`, enables presenter mode with default settings. When set to `False`, disables presenter mode. Can also be a dictionary containing the highlighting configuration options as defined in `HighLightElement`. Fields which are not given use their default values: `duration` 2 seconds, `width` 2px, `style` dotted and `color` blue.

Returns: `HighLightElement | bool`

Tags: BrowserControl, Setter

Sets presenter mode for element highlighting during test execution.

Presenter mode highlights elements found by keywords, which is useful for test debugging and demonstration. When enabled, the element is scrolled into view and highlighted with a border for a while to visually show what the keyword found.

The keyword returns the previous presenter mode value, allowing you to restore it later.

Example:

```robotframework
${old_mode} =    Set Presenter Mode    True
Click    //button                            # Element will be highlighted
Set Presenter Mode    ${old_mode}            # Restore previous mode

# With custom highlighting configuration
VAR    &{config}
...    duration=5 seconds
...    width=3px
...    style=dotted
...    color=red
Set Presenter Mode    ${config}
Get Text    //input                          # Will use custom highlight settings
Set Presenter Mode    False                  # Turn off highlighting
```

### Set Retry Assertions For

Arguments:

- `timeout: timedelta` — Assertion retry timeout will determine how long Browser library will retry an assertion to be true.
- `scope: Scope = Suite` — Scope defines the live time of that setting. Available values are `Global`, `Suite` or `Test` / `Task`. See `Scope Setting` for more details.

Returns: `str`

Tags: Config, Setter

Sets the timeout used in retrying assertions when they fail.

The other keyword `Set Browser Timeout` controls how long Playwright will wait on the node side for elements to fulfill the requirements of the specific keyword.

Returns the previous value of the assertion retry timeout.

Example:

```robotframework
Set Browser Timeout    10 seconds
${old} =    Set Retry Assertions For    30s
Get Title    ==    Login Page
Set Retry Assertions For    ${old}
```

The example waits 10 seconds in Playwright to get the page title and the library will retry for 30 seconds to make sure that the title is correct.

### Set Selector Prefix

Arguments:

- `prefix: str | None` — Prefix for all selectors. Prefix and selector will be separated by a single space. Use `${None}` or `${EMPTY}` to disable the prefix.
- `scope: Scope = Suite` — Scope defines the live time of that setting. Available values are `Global`, `Suite` or `Test` / `Task`. See `Scope Setting` for more details.

Returns: `str`

Tags: Config, Setter

Sets the prefix for all selectors in the given scope.

Returns the previous value of the prefix.

Example:

```robotframework
${old} =    Set Selector Prefix    iframe#embedded_page >>>
Click    button#login_btn       # Clicks on button inside iframe with the selector iframe#embedded_page >>> button#login_btn
Set Selector Prefix    ${old}
```

Example will click on button with id `login_btn` inside iframe with id `embedded_page`. The resulting selector will be `iframe#embedded_page >>> button#login_btn`.

The effect of this prefix can be disabled by prefixing any selector with `!prefix` , with a trailing space, for single keyword calls, i.e. `!prefix id=btn_outside_a_frame`

`Get Element`, `Get Elements`, `Get Element By` and `Get Element By Role` automatically prefix the returned selector with `!prefix` so that it is possible to use them directly without setting the prefix to `${None}` before usage.

### Set Storage State

Arguments:

- `path: Path` — Path to a state file created by `Save Storage State`. Relative paths are resolved against the current working directory. The keyword fails if the file does not exist.
- `timeout: timedelta | None = None` — Time to wait for the state to be restored. If not defined, the library default timeout is used. Pass 0 to disable the timeout.
- `reload_pages: ReloadPages = affected` — Which pages are reloaded while the state is restored, see `ReloadPages`. Only relevant when the state file contains IndexedDB.

Returns: `None`

Tags: BrowserControl, Setter

Restores a storage state file into the current active context.

Clears the cookies, local storage, IndexedDB and virtual WebAuthn credentials of the currently active context and replaces them with the ones from the `path` file, which must have been created by `Save Storage State`. Unlike creating a `New Context` with the `storageState` argument, the context and all of its pages stay open.

Pages that are already open keep the state they have loaded into memory. Reload them, with the `Reload` keyword, to make them see the restored state. Cookies and local storage are readable right away, without a reload, but the application has read them long ago.

Note that `sessionStorage` is not part of a storage state, neither when saving nor when restoring. It survives this keyword unchanged, so an application which keeps data of the previous user there still has it after the state was replaced.

Restoring a state which was saved with `credentials=True` installs the virtual WebAuthn authenticator into the context, the same way `Install Credential` does. Real authenticators do not work in that context afterwards.

#### Restoring IndexedDB

Restoring IndexedDB deletes the databases of the origin first, and that does not finish while any client of that origin holds an open connection to them. An application which keeps its connection open, which is the normal pattern when authentication tokens are stored in IndexedDB, therefore blocks the restore indefinitely. Playwright does not time out on its own, see [playwright#42258](https://github.com/microsoft/playwright/issues/42258).

This keyword works around that by navigating the pages of the affected origins to `about:blank`, restoring the state, and navigating them back to the url they had before. Use `reload_pages` to control which pages that applies to. A reload is needed in any case, because deleting the databases closes the connection of the application as well.

A service worker of the origin can hold a connection open too, and no value of `reload_pages` helps against that, because a service worker outlives the pages. The keyword then fails when `timeout` expires.

`reload_pages=none` detects a blocking connection up front and fails immediately instead of waiting for the timeout. That detection needs `indexedDB.databases()`, which older browsers, Firefox before 126 among them, do not have. There the keyword cannot tell whether a connection blocks and falls back to waiting for `timeout`.

Example:

```robotframework
New Context
New Page    https://login.page.html
    #  Perform login as first user
${user_a} =    Save Storage State    indexedDB=True
    #  Perform login as second user
${user_b} =    Save Storage State    indexedDB=True
    #  Switch back to the first user without creating a new context
Set Storage State    ${user_a}
Reload
Get Text    id=current-user    ==    userA
```

### Set Strict Mode

Arguments:

- `mode: bool` — When set to `True`, keywords that search elements will use Playwright [strict mode](https://playwright.dev/docs/api/class-page#page-query-selector) and fail if the selector matches more than one element. When set to `False`, such keywords do not fail but operate on the first matching element.
- `scope: Scope = Suite` — Scope defines the live time of that setting. Available values are `Global`, `Suite` or `Test` / `Task`. See `Scope Setting` for more details.

Tags: BrowserControl, Setter

Controls library strict mode.

The keyword returns the strict mode value which was in use before this keyword was called.

Strict mode is enabled by default. The initial value can also be set with the `strict` argument in the library `importing`. Strict mode is applied only to those keywords which state in their documentation that they use strict mode, see `Finding elements` for more details.

Example:

```robotframework
${old_mode} =      Set Strict Mode    False
Get Text           //input            # Does not fail even if the selector matches multiple elements
Set Strict Mode    ${old_mode}
```

### Set Time

Arguments:

- `time: datetime` — The time to set. Supports Robot Framework date and time format
- `clock_type: ClockType = install` — The clock type to set. Default is `install`.

Tags: Clock, Setter

Sets the time of the browser's internal clock.

`fixed` makes `Date.now` and `new Date()` always return the same fake time, while all timers keep running.

`system` sets the current system time but does not trigger any timers.

`install` installs fake timers, which are used to manually control the flow of time in tests. They allow you to advance time, fire timers, and control the behavior of time-dependent functions.

How to use clock related keywords, see [Playwright clock documentation](https://playwright.dev/docs/clock). Also reviewing the Playwright [Clock API](https://playwright.dev/docs/api/class-clock) is recommended.

### Set Viewport Size

Arguments:

- `width: int` — Sets the width in pixels.
- `height: int` — Sets the height in pixels.

Tags: BrowserControl, Setter

Sets the current page's viewport size to the specified dimensions.

In the case of multiple pages in a single browser, each page can have its own viewport size. However, `New Context` allows setting the viewport size (and more) for all later opened pages in the context at once.

`Set Viewport Size` will resize the page. A lot of websites don't expect phones to change size, so you should set the viewport size with `New Context` before opening the page itself.

### Show Keyword Banner

Arguments:

- `show: bool = True` — If `True`, the banner is shown on the page. If `False`, the banner is not shown on the page. If `${None}`, the banner is shown on the page only when running in presenter mode.
- `style: str = ` — Additional CSS styles to be applied to the banner. These styles may override the existing ones for the banner.
- `scope: Scope = Suite` — Scope defines the live time of that setting. Available values are `Global`, `Suite` or `Test` / `Task`. See `Scope Setting` for more details.

Returns: `dict[str, bool | str | None]`

Tags: Config, Setter

Controls if the keyword banner is shown on page or not.

The keyword call banner is a CSS overlay that shows the currently executed keyword directly on the page. This is useful for debugging and for showing the test execution on video recordings. By default, the banner is not shown on the page except when running in presenter mode.

The banner can also be controlled by an import setting of the Browser library. (see `Importing` section)

Returns the previous settings as a dictionary with the keys `show` and `style`.

Example:

```robotframework
Show Keyword Banner     True    top: 5px; bottom: auto; left: 5px; background-color: #00909077; font-size: 9px; color: black;   # Show banner on top left corner with custom styles
Show Keyword Banner     False   # Hide banner
```

### Start Coverage

Arguments:

- `config_file: PathLike | None = None` (named-only) — Optional path to [options file](https://www.npmjs.com/package/monocart-coverage-reports#options). If the file does not exist, it is ignored.
- `coverage_type: CoverageType = all` (named-only) — Type of coverage to start. Default is `all`.
- `path: Path = .` (named-only) — Absolute or relative directory path (relative to `${OUTPUT_DIR}/browser/coverage/`) where the coverage is stored in a directory with the page id name.
- `raw: bool = False` (named-only) — Whether to save raw coverage data. Default is `False`.
- `reportAnonymousScripts: bool = False` (named-only) — Whether to report anonymous scripts. Default is `False`. Only valid for JS coverage.
- `resetOnNavigation: bool = True` (named-only) — Whether to reset coverage on navigation. Default is `True`.

Returns: `str`

Tags: Coverage, Experimental, Setter

Starts the coverage for the current page.

The `coverage_type` can be one of the following:

-   `all`: Both [CSS](https://playwright.dev/docs/api/class-coverage/#coverage-start-css-coverage) and [JS](https://playwright.dev/docs/api/class-coverage/#coverage-start-js-coverage).
-   `css`: [CSS](https://playwright.dev/docs/api/class-coverage/#coverage-start-css-coverage).
-   `js`: [JS](https://playwright.dev/docs/api/class-coverage/#coverage-start-js-coverage).

Coverage must be started when the page is open and before any action is performed on the page. Coverage will be stored when calling the `Stop Coverage` keyword or when the page or context is closed. This is done automatically when using the auto closing.

The `raw` argument saves the raw coverage data in the coverage folder. The raw data is needed to combine multiple coverage reports into a single report. A single report can be created with the `rfbrowser coverage /path/to/basefolder/ /path/to/outputfolder/` command. Please note that the `raw` argument is ignored if the `config_file` is defined. In that case the user is responsible for also setting the raw reporter in the config file. To see more details about combining coverage data, run the `rfbrowser coverage --help` command.

Example:

```robotframework
New Page
Start Coverage
Go To    ${LOGIN_URL}
Do Something In The Page
Stop Coverage
```

### Stop Coverage

Arguments: none

Returns: `Path | None`

Tags: Coverage, Getter

Stops the coverage for the current page.

Creates a coverage report by using [monocart-coverage-reports](https://www.npmjs.com/package/monocart-coverage-reports) To see the default and all possible options, see [options.js](https://github.com/cenfun/monocart-coverage-reports/blob/HEAD/lib/default/options.js) file for more details.

If coverage was not started, the keyword returns `None`. Otherwise it returns the path to the generated HTML report file, or the path to the coverage folder if no HTML file is found from the folder. The latter can happen when the report format or output folder has been changed with the `config_file` argument of the `Start Coverage` keyword.

### Switch Browser

Arguments:

- `id: str` — The id of the browser to switch to. Example: `browser=96207191-8147-44e7-b9ac-5e04f2709c1d`. A browser id is returned by `New Browser` when it is started or can be fetched from the browser catalog when returned by `Get Browser Catalog`.

Returns: `str`

Tags: BrowserControl, Setter

Switches the currently active Browser to another open Browser.

Returns a stable identifier for the previous browser. See `Browser, Context and Page` for more information about Browser and related concepts.

### Switch Context

Arguments:

- `id: str` — The id of the context to switch to. Example: `context=525d8e5b-3c4e-4baa-bfd4-dfdbc6e86089`. A context id is returned by `New Context` when it is started or can be fetched from the browser catalog when returned by `Get Browser Catalog`.
- `browser: SelectionType | str = CURRENT` — The browser in which to search for that context. `CURRENT` for the currently active browser, `ALL` to search in all open browsers or the id of the browser where to switch context.

Returns: `str`

Tags: BrowserControl, Setter

Switches the active BrowserContext to another open context.

Returns a stable identifier for the previous context. See `Browser, Context and Page` for more information about Context and related concepts.

Example:

```robotframework
${first_context} =     New Context
New Page             ${URL1}
${second_context} =    New Context
New Page             ${URL2}
Switch Context       ${first_context}    # Switches back to first context and page.
```

### Switch Page

Arguments:

- `id: NewPageDetails | SelectionType | str` — The id or alias of the page to switch to. Example: `page=8baf2991-5eaf-444d-a318-8045f914e96a` or `NEW`. Can be a string or a dictionary returned by `New Page` Keyword. A page id can be fetched from the browser catalog when returned by `Get Browser Catalog`. `NEW` can be used to switch to a pop-up that just has been opened by the webpage, `CURRENT` can be used to switch to the active page of a different context or browser, identified by their id.
- `context: SelectionType | str = CURRENT` — The context in which to search for that page. `CURRENT` for the currently active context, `ALL` to search in all open contexts or the id of the context where to switch page.
- `browser: SelectionType | str = CURRENT` — The browser in which to search for that page. `CURRENT` for the currently active browser, `ALL` to search in all open browsers or the id of the browser where to switch page.

Returns: `str`

Tags: BrowserControl, Setter

Switches the active browser page to another open page by `id` or `NEW`.

Returns a stable identifier `id` for the previous page. See `Browser, Context and Page` for more information about Page and related concepts.

If a page id is given, the `context` and `browser` arguments are ignored and the page is searched from all open browsers.

`NEW` may time out if no new page is opened before the library timeout expires.

Example:

```robotframework
Click           button#pops_up    # Open new page
${previous} =    Switch Page      NEW
```

### Take Screenshot

Arguments:

- `filename: str | None = robotframework-browser-screenshot-{index}` — Filename into which to save. The file will be saved into the Robot Framework ${OUTPUTDIR}/browser/screenshot directory by default, but it can be overwritten by providing a custom path or filename. String `{index}` in the filename will be replaced with a rolling number. Use this to not overwrite filenames. If filename equals to UUID (case insensitive), then the filename is created by Python uuid; [https://docs.python.org/3/library/uuid.html](https://docs.python.org/3/library/uuid.html). If filename equals to EMBED (case insensitive) or ${NONE}, then the screenshot is embedded as a Base64 image into the log.html. The image is saved temporarily to the disk and a warning is displayed if removing the temporary file fails. The ${OUTPUTDIR}/browser/screenshot directory is removed at the first suite startup.
- `selector: str | None = None` — Take a screenshot of the element matched by selector. See the `Finding elements` section for details about the selectors. If not provided, take a screenshot of the current viewport.
- `crop: BoundingBox | None = None` (named-only) — Crops the taken screenshot to the given box. It takes the same dictionary as returned from `Get BoundingBox`. Cropping only works on a page screenshot, so when no selector is given.
- `disableAnimations: bool = False` (named-only) — When set to `True`, stops CSS animations, CSS transitions and Web Animations. Animations get different treatment depending on their duration: - finite animations are fast-forwarded to completion, so they'll fire the transitionend event. - infinite animations are cancelled to initial state, and then played over after the screenshot.
- `fileType: ScreenshotFileTypes = png` (named-only) — `png` or `jpeg`. Specifies the screenshot type, defaults to `png`.
- `fullPage: bool = False` (named-only) — When `True`, takes a screenshot of the full scrollable page, instead of the currently visible viewport. Defaults to `False`.
- `highlight_selector: str | None = None` (named-only) — Highlights elements while taking the screenshot. Highlight method is `playwright`. This highlighting also automatically happens if the Robot Framework variable `${ROBOT_FRAMEWORK_BROWSER_FAILING_SELECTOR}` is set to a selector string and is available on page. This is the case if `highlight_on_failure` has been set to `True` when importing Browser library.
- `log_screenshot: bool = True` (named-only) — When set to `False` the screenshot is taken but not logged into log.html.
- `mask: list[str] | str = ` (named-only) — Specify selectors that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink box `#FF00FF` that completely covers their bounding box. The argument can take a single selector string or a list of selector strings if multiple different elements should be masked.
- `maskColor: str | None = None` (named-only) — Specify the color of the overlay box for masked elements, in CSS color format. Default color is pink #FF00FF.
- `omitBackground: bool = False` (named-only) — Hides the default white background and allows capturing screenshots with transparency. Not applicable to jpeg images.
- `quality: int | None = None` (named-only) — The quality of the image, between 0-100. Not applicable to png images.
- `scale: Scale | None = None` (named-only) — `css` or `device`. `css` will reduce the image size and `device` keeps the image in its original size. Defaults to `device`.
- `return_as: ScreenshotReturnType = path_string` (named-only) — Defines what this keyword returns. Possible values are documented in `ScreenshotReturnType`. It can be either a path to the screenshot file as string or Path object, or the image data as bytes or base64 encoded string. When the screenshot is embedded into the log, `path_string` returns the string `EMBED`.
- `timeout: timedelta | None = None` (named-only) — Maximum time how long taking the screenshot can last, defaults to the library timeout. Supports Robot Framework time format, like 10s or 1 min, pass 0 to disable the timeout. The default value can be changed by using the `Set Browser Timeout` keyword.

Returns: `str | bytes | Path | None`

Tags: PageContent

Takes a screenshot of the current window or element and saves it to disk.

Keyword uses strict mode if selector is defined. See `Finding elements` for more details about strict mode.

Example

```robotframework
Take Screenshot                                 # Takes screenshot from page with default filename
Take Screenshot   selector=id=username_field    # Captures element in image
# Takes screenshot with jpeg extension, defines image quality and timeout how long taking screenshot should last
Take Screenshot   fullPage=True    fileType=jpeg    quality=50    timeout=10s
Take Screenshot   EMBED                         # Screenshot is embedded as Base64 image to the log.html.
Take Screenshot   UUID                          # Takes screenshot from page with filename generated by: https://docs.python.org/3/library/uuid.html.
```

### Tap

Arguments:

- `selector: str` — Selector element to tap. See the `Finding elements` section for details about the selectors.
- `*modifiers: KeyboardModifier` — Modifier keys to press. Ensures that only these modifiers are pressed during the tap, and then restores current modifiers back. If not specified, currently pressed modifiers are used. Modifiers can be specified in any order, and multiple modifiers can be specified. Valid modifier keys are `Alt`, `Control`, `ControlOrMeta`, `Meta` and `Shift`.
- `force: bool = False` (named-only) — Whether to bypass the actionability checks. Defaults to `False`.
- `noWaitAfter: bool = False` (named-only) — Deprecated. This option has no effect. Defaults to `False`.
- `position_x: int | None = None` (named-only) — A point to tap relative to the top-left corner of element bounding-box. Only positive values within the bounding-box are allowed. Both values must be given, otherwise the position is ignored. If not specified, taps some visible point of the element.
- `position_y: int | None = None` (named-only) — A point to tap relative to the top-left corner of element bounding-box. Only positive values within the bounding-box are allowed. Both values must be given, otherwise the position is ignored. If not specified, taps some visible point of the element.
- `trial: bool = False` (named-only) — When set, this method only performs the actionability checks and skips the action. Defaults to `False`.

Tags: PageContent, Setter

Simulates tap on the element found by `selector`.

Requires that the `hasTouch` option of `New Context` is set to true. This method taps the element by performing the following steps:

-   Wait for actionability checks on the element, unless the `force` option is set.
-   Scroll the element into view if needed.
-   Use page.touchscreen to tap the center of the element, or the specified position.
-   Wait for initiated navigations to either succeed or fail.

Keyword uses strict mode, see `Finding elements` for more details about strict mode.

Example:

```robotframework
New Context    hasTouch=${True}
New Page    ${URL}
Tap    css=input#login_button
```

### Type Secret

Arguments:

- `selector: str` — Selector of the text field. See the `Finding elements` section for details about the selectors.
- `secret: str | Secret` — Supports Robot Framework 7.4 Secret type as normal variable (with curly braces). Also environment variable name with % prefix or a local variable with $ prefix that has the secret text value (without curly braces).
- `delay: timedelta = 0:00:00` — Delay between the single key strokes. It may be either a number or a Robot Framework time string. Time strings are fully explained in an appendix of Robot Framework User Guide. Defaults to `0 ms`. Example: `50 ms`
- `clear: bool = True` — Set to `False` if the field should not be cleared before typing. Defaults to `True`.

Tags: PageContent, Setter

Types the given `secret` into the text field found by `selector`.

This keyword does not log the secret in Robot Framework logs, but if Playwright debug logs are enabled, the secret will be visible as plain text in the Playwright debug logs, regardless of the Robot Framework log level or how `secret` is resolved.

This keyword supports Robot Framework 7.4 [Secret](https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#secret-variables) variable type, which is the recommended way if you are using Robot Framework 7.4 or newer.

For older Robot Framework versions the keyword supports resolving secrets from environment variables and Robot Framework variables in the following ways. The keyword resolves the `secret` from a Robot Framework variable internally, when the `secret` variable is prefixed with `$`, without the curly braces. Example: `$Password` will resolve to the `${Password}` Robot Framework variable.

If the `secret` variable is prefixed with `%`, the library will resolve the corresponding environment variable. Example: `%ENV_PWD` will resolve to the `%{ENV_PWD}` environment variable.

**Using normal Robot Framework variables like `${password}`, which are not Secret type variables, will not work!**

**Normal plain text will not work.** If you want to use plain text, use the `Type Text` keyword instead.

This keyword also works with a cryptographic cipher text that has been encrypted by CryptoLibrary. See [CryptoLibrary](https://github.com/Snooz82/robotframework-crypto) for more details.

Keyword uses strict mode, see `Finding elements` for more details about strict mode.

See `Type Text` for details.

Example

```robotframework
Type Secret    input#username_field    ${username}    # Keyword resolves ${username} variable value from Robot Framework Secret type variable
Type Secret    input#username_field    $username      # Keyword resolves ${username} variable value from Robot Framework variables
Type Secret    input#username_field    %username      # Keyword resolves $USERNAME/%USERNAME% variable value from environment variables
```

### Type Text

Arguments:

- `selector: str` — Selector of the text field. See the `Finding elements` section for details about the selectors.
- `txt: str` — Text for the text field.
- `delay: timedelta = 0:00:00` — Delay between the single key strokes. It may be either a number or a Robot Framework time string. Time strings are fully explained in an appendix of Robot Framework User Guide. Defaults to `0 ms`. Example: `50 ms`
- `clear: bool = True` — Set to `False` if the field should not be cleared before typing. Defaults to `True`.

Tags: PageContent, Setter

Types the given `txt` into the text field found by `selector`.

Sends a `keydown`, `keypress/input`, and `keyup` event for each character in the text.

Keyword uses strict mode, see `Finding elements` for more details about strict mode.

See `Fill Text` for filling the full text at once.

Example

```robotframework
Type Text    input#username_field    user
Type Text    input#username_field    user    delay=10 ms    clear=No
```

### Uncheck Checkbox

Arguments:

- `selector: str` — Selector of the checkbox. See the `Finding elements` section for details about the selectors.
- `force: bool = False` — Set to `True` to skip Playwright's [Actionability checks](https://playwright.dev/docs/actionability).

Tags: PageContent, Setter

Unchecks the checkbox found by `selector`.

Keyword uses strict mode, see `Finding elements` for more details about strict mode.

Does nothing if the element is not checked/selected.

### Upload File By Selector

Arguments:

- `selector: str` — Identifies the file input element.
- `path: PathLike | FileUploadBuffer` — Path to the file or folder to be uploaded. Can also be a `FileUploadBuffer` dictionary.
- `*extra_paths: PathLike` — Additional paths to files or folders to be uploaded.

Tags: PageContent, Setter

Uploads file from `path` to file input element matched by selector.

Fails if the upload is not done before the library timeout. Therefore it may be necessary to increase the timeout with `Set Browser Timeout`. It is possible to upload multiple files or folders by defining additional files or folders in `extra_paths`.

If a path is a directory, all files from the directory are uploaded. Subdirectories are not included. It is possible to upload files and directories with the same keyword. The keyword fails if a given path does not exist.

Keyword uses strict mode, see `Finding elements` for more details about strict mode.

If `path` is a `FileUploadBuffer` dictionary, then the structure should be:

```robotframework
{
  'name': str,
  'mimeType': str,
  'buffer': str
}
```

If `path` argument is `FileUploadBuffer`, then `extra_paths` argument is not supported and using it will raise an error.

Upload single file example:

```robotframework
Upload File By Selector    //input[@type='file']    big_file.zip
```

Upload many files example:

```robotframework
Upload File By Selector    //input[@type='file']    file1.zip    file2.zip    file3.zip
```

Upload folder example:

```robotframework
Upload File By Selector    //input[@type='file']    /path/to/folder
```

Upload as buffer example:

```robotframework
${text} =    Get File    /path/to/file    # Read file from disk
VAR    &{buffer}    name=not_here.txt    mimeType=text/plain    buffer=${text}    # Create buffer dictionary
Upload File By Selector    id=file_chooser    ${buffer}    # Upload buffer
```

### Wait For

Arguments:

- `*promises: Future` — Promises to wait for.

Tags: Wait

Waits for promises to finish and returns results from them.

Returns a single result if only one promise is waited for. Otherwise it returns a list of results in the same order as the promises were given. If one of the promises fails, then this keyword will fail.

See `Promise To` for more information about promises.

For general waiting of elements please see `Implicit waiting`.

Example:

```robotframework
${promise}=    Promise To            Wait For Response     matcher=     timeout=3
Click         \#delayed_request
${body}=       Wait For              ${promise}
```

### Wait For Alert

Arguments:

- `action: DialogAction` — How to handle the alert. Can be `accept` or `dismiss`.
- `prompt_input: str = ` — The value to enter into the prompt. Only valid if the `action` argument equals `accept`. Defaults to an empty string.
- `text: str | None = None` — Optional text to verify the dialog text with.
- `timeout: timedelta | None = None` — Optional timeout in Robot Framework time format. Defaults to the library timeout.

Tags: PageContent, Wait

Returns a promise to wait for next dialog on page, handles it with `action` and optionally verifies the dialogs text.

Dialog/alert can be any of alert, beforeunload, confirm or prompt.

The main difference between this keyword and `Handle Future Dialogs` is that the `Handle Future Dialogs` keyword is automatically set as a promise, but this keyword must be called as an argument to the `Promise To` keyword. Also this keyword can optionally verify the dialog text and returns it. If the `text` argument is `None` or is not set, the dialog text is not verified.

Example with returning text:

```robotframework
${promise} =         Promise To    Wait For Alert    action=accept
Click               id=alerts
${text} =            Wait For      ${promise}
Should Be Equal      ${text}         Am an alert
```

Example with text verification:

```robotframework
${promise} =       Promise To    Wait For Alert    action=accept    text=Am an alert
Click              id=alerts
${text} =          Wait For      ${promise}
```

### Wait For Alerts

Arguments:

- `actions: list[DialogAction]` — List of how to handle the alerts. Can be `accept` or `dismiss`.
- `prompt_inputs: list[str | None]` — List of the values to enter into the prompts. Only valid if the corresponding action equals `accept`. Use `None` if no input is needed.
- `texts: list[str | None]` — List of optional texts to verify the dialog texts with. Use `None` if text verification should be disabled.
- `timeout: timedelta | None = None` — Optional timeout in Robot Framework time format. Defaults to the library timeout. The timeout is applied to each alert separately.

Returns: `list[str]`

Tags: PageContent, Wait

Returns a promise to wait for multiple dialogs on a page.

Handles each alert/dialog with `actions` and optionally verifies the dialog texts. Dialog/alert can be any of alert, beforeunload, confirm or prompt.

There must be an equal amount of items in the `actions`, `prompt_inputs` and `texts` lists. Use `None` if texts and/or prompt inputs are not needed.

This keyword works in the same way as `Wait For Alert`, but it can handle multiple alerts with one promise. Like the `Wait For Alert` keyword, this keyword must be called as an argument to the `Promise To` keyword.

Example to handle two alerts, first one is accepted and second one is dismissed:

```robotframework
${promise} =    Promise To
...    Wait For Alerts
...    ["accept", "dismiss"]
...    [None, None]
...    [None, None]
Click    id=alerts
${texts} =    Wait For    ${promise}
```

Example to handle confirm and prompt alert. Example assumes that the first is a confirm and second one is prompt:

```robotframework
${promise} =    Promise To
...    Wait For Alerts
...    ["dismiss", "accept"]
...    [None, "I am a prompt"]
...    ["First alert accepted?", None]
Click    id=confirmAndPrompt
${texts} =    Wait For    ${promise}
```

### Wait For All Promises

Arguments: none

Tags: Wait

Waits for all promises to finish.

Waits for all promises which have been created but not yet waited for with `Wait For`. If one of the promises fails, then this keyword will fail.

Example:

```robotframework
Promise To               Wait For Response     matcher=     timeout=3
Click                    \#delayed_request
Wait For All Promises
```

### Wait For Condition

Arguments:

- `condition: ConditionInputs` — A condition, defined with Browser getter keywords, without the word `Get`.
- `*args: Any` — Arguments to pass to the condition keyword.
- `timeout: timedelta | None = None` (named-only) — Timeout to wait for the condition to become True. Uses default timeout of the library if not set. As the other assertion keywords this timeout only influences the time the assertion is retried. The browser timeout is used to wait for the element to be found.
- `message: str | None = None` (named-only) — Overrides the default error message.

Returns: `Any`

Tags: PageContent, Wait

Waits for a condition, defined with Browser getter keywords, to become True.

This keyword is basically just a wrapper around our assertion keywords, but with a timeout. It can be used to wait for anything that also can be asserted with our keywords.

In comparison to Robot Framework's `Wait Until Keyword Succeeds` this keyword is more readable and easier to use, but is limited to Browser library's assertion keywords.

The easiest way to use this keyword is first starting with an assertion keyword with assertion like: `Get Text`

Start:

```robotframework
Get Text    id=status_bar   contains    Done
```

Then you replace the word `Get` with `Wait For Condition` and if necessary add the timeout argument.

End:

```robotframework
Wait For Condition    Text    id=status_bar   contains    Done
```

Example usage:

```robotframework
Wait For Condition    Element States    id=cdk-overlay-0    ==    detached
Wait For Condition    Element States     //h1    contains    visible    editable    enabled    timeout=2 s
Wait For Condition    Title    should start with    Robot
Wait For Condition    Url    should end with    robotframework.org
```

### Wait For Elements State

Arguments:

- `selector: str` — Selector of the corresponding object. See the `Finding elements` section for details about the selectors.
- `state: ElementState = visible` — See `ElementState` for explanation.
- `timeout: timedelta | None = None` — uses default timeout from library if not set.
- `message: str | None = None` — overrides the default error message. The `message` argument accepts `{selector}`, `{function}`, and `{timeout}` [format](https://docs.python.org/3/library/stdtypes.html#str.format) options. The `{function}` formatter is the `state` argument value for the states which are waited for by Playwright, that are `attached`, `detached`, `visible`, `hidden`, `stable`, `enabled`, `disabled` and `editable`. For all other states, it is the JavaScript expression which is evaluated for the element.

Tags: PageContent, Wait

Waits for the element found by `selector` to satisfy state option.

Note that Browser library has `Implicit waiting` mechanisms. Depending on the situation you might not need to use `Wait for Elements State`.

If users experience reliability issues with this keyword, consider using `Wait for Condition` with `Get Element States` keyword instead. `Wait For Elements State` uses features of Playwright to wait for element states. However, in some situations these features might not work as expected. `Wait for Condition` with `Get Element States` is more robust as it uses Browser library's own waiting mechanisms that actively poll the state of an element.

State options are appearing in or disappearing from the DOM, becoming visible or hidden, and the other states listed in `ElementState`. If at the moment of calling the keyword, the selector already satisfies the condition, the keyword will return immediately.

If the selector doesn't satisfy the condition within the timeout the keyword will FAIL.

The states `focused` and `defocused` are not supported with iframe selectors, which contain `>>>`. In that case the keyword raises an error and suggests to use `Wait For Condition` with `Get Element States` instead.

Keyword uses strict mode, see `Finding elements` for more details about strict mode.

Example:

```robotframework
Wait For Elements State    //h1    visible    timeout=2 s
Wait For Elements State    //h1    focused    1s
```

### Wait For Function

Arguments:

- `function: str` — A valid javascript function or a javascript function body. For example `() => true` and `true` will behave similarly.
- `selector: str = ` — Selector to resolve and pass to the JavaScript function. This will be the first argument the function receives. If a selector is given, `function` must be a function with an argument which receives the element handle. For example `(element) => document.activeElement === element`. See the `Finding elements` section for details about the selectors.
- `polling: str | timedelta = raf` — Default polling value of `raf` polls in a callback for `requestAnimationFrame`. Any other value for polling will be parsed as a Robot Framework time for the interval between polls.
- `timeout: timedelta | None = None` — Uses default timeout of the library if not set.
- `message: str | None = None` — overrides the default error message. The `message` argument accepts `{selector}`, `{function}`, and `{timeout}` [format](https://docs.python.org/3/library/stdtypes.html#str.format) options.

Tags: PageContent, Wait

Polls JavaScript expression or function in browser until it returns a (JavaScript) truthy value.

Keyword uses strict mode, see `Finding elements` for more details about strict mode.

Example usage:

```robotframework
${promise}      Promise To      Wait For Function    element => element.style.width=="100%"    selector=\#progress_bar    timeout=4s
Click         \#progress_bar
Wait For      ${promise}
```

### Wait For Load State

Arguments:

- `state: PageLoadStates = load` — State to wait for, defaults to `load`. Possible values are `load`, `domcontentloaded`, `networkidle` and `commit`.
- `timeout: timedelta | None = None` — Timeout supports Robot Framework time format. Uses browser timeout if not set.

Tags: PageContent, Wait

Waits until the page reaches the required load state.

This resolves when the page reaches a required load state, load by default. The navigation must have been committed when this method is called. If current document has already reached the required state, resolves immediately.

If the state has been already reached while loading current document, the underlying Playwright will resolve immediately. Can be one of:

```robotframework
load - wait for the load event to be fired.
domcontentloaded - wait for the DOMContentLoaded event to be fired.
networkidle - DISCOURAGED wait until there are no network connections for at least 500 ms.
commit - not supported by this keyword, the keyword returns immediately without waiting.
```

If the wait times out, the page's load report is logged: whether its navigation committed, how far the document got and which requests were still open.

Example:

```robotframework
Go To                         ${URL}
Wait For Load State    domcontentloaded    timeout=3s
```

### Wait For Navigation

Arguments:

- `url: str | RegExp` — Expected navigation target address, either a Glob-Pattern (a plain string without wildcards matches exactly) or a JavaScript-like regex wrapped in `/` symbols.
- `timeout: timedelta | None = None` — Timeout supports Robot Framework time format. Uses default timeout if not set.
- `wait_until: PageLoadStates = load` — When to consider the operation succeeded, defaults to load. Events can be either: `domcontentloaded` - consider operation to be finished when the DOMContentLoaded event is fired. `load` - consider operation to be finished when the load event is fired. `networkidle` - consider operation to be finished when there are no network connections for at least 500 ms. `commit` - consider operation to be finished when network response is received and the document started loading.

Tags: HTTP, Wait

Waits until the page has navigated to the given `url`.

The keyword works only when the page is loaded and it does not work if only the URL fragment changes. Example: if [https://marketsquare.github.io/robotframework-browser/Browser.html](https://marketsquare.github.io/robotframework-browser/Browser.html) changes to [https://marketsquare.github.io/robotframework-browser/Browser.html#Wait%20For%20Navigation](https://marketsquare.github.io/robotframework-browser/Browser.html#Wait%20For%20Navigation) the keyword will fail.

Example:

```robotframework
Go To                  ${ROOT_URL}/redirector.html
Wait for navigation    ${ROOT_URL}/posted.html    wait_until=${wait_until}
```

If the wait times out, the page's load report is logged: whether its navigation committed, how far the document got and which requests were still open.

### Wait For Request

Arguments:

- `matcher: str | RegExp = ` — Request URL matcher. Can be a string (Glob-Pattern), a JavaScript RegExp (enclosed in `/` with optional trailing flags) or a JavaScript arrow-function that receives the [Request](https://playwright.dev/docs/api/class-request) object and returns a boolean. By default (with an empty string) the first request is matched. For additional information, see the Playwright [waitForRequest](https://playwright.dev/docs/api/class-page#page-wait-for-request) documentation.
- `timeout: timedelta | None = None` — Timeout supports Robot Framework time format. Uses default timeout if not set.

Returns: `DotDict | Any`

Tags: HTTP, Wait

Waits for a request matching `matcher` to be made.

Only the request is awaited, not its response. See `Wait For Response` if the response is needed.

The returned object is a dictionary with the keys `url`, `method`, `headers` and `postData`. `headers` is a dictionary of request headers. `postData` is `None` if the request has no body, a dictionary if the body is valid JSON and otherwise the body as a string.

See `Wait For Response` for more details about the matcher.

**CAUTION:** Before Browser library 17.0.0, the `matcher` argument was always either a regex or JS function. But the regex did not need to be in slashes. The most simple way to migrate to the new syntax is to add slashes around the matcher. So `/api/get/json` becomes `//api/get/json/`.

### Wait For Response

Arguments:

- `matcher: str | RegExp = ` — Response URL matcher. Can be a string (Glob-Pattern), a JavaScript RegExp (enclosed in `/` with optional trailing flags) or a JavaScript arrow-function that receives the Response object and returns a boolean. By default (with an empty string) the first response is matched. For additional information, see the Playwright [page.waitForResponse](https://playwright.dev/docs/api/class-page#page-wait-for-response) documentation.
- `timeout: timedelta | None = None` — Timeout supports Robot Framework time format. Uses default timeout if not set.

Returns: `DotDict | Any`

Tags: HTTP, Wait

Waits for a response matching `matcher` and returns the response as a Robot Framework dictionary.

The keyword waits until the response headers are received and then reads the response body.

The response, which is returned by this keyword, is a Robot Framework dictionary with the following attributes:

-   `status` <int> The status code of the response.
-   `statusText` <str> Status text corresponding to `status`, e.g. OK or INTERNAL SERVER ERROR. This may not be available for all browsers.
-   `body` <dict | str> The response body. If the body can be parsed as a JSON object, it will be returned as Python dictionary, otherwise it is returned as a string. It is `None` if the body could not be read and the key is missing altogether if the response body is empty.
-   `headers` <dict> A dictionary containing all response headers.
-   `ok` <bool> Whether the request was successful, i.e. the `status` is in the range 200-299.
-   `request` <dict> containing `method` <str>, `headers` <dict> and `postData` <dict> | <str>
-   `url` <str> url of the response.

**CAUTION:** Before Browser library 17.0.0, the `matcher` argument was always either a regex or JS function. But the regex did not need to be in slashes. The most simple way to migrate to the new syntax is to add slashes around the matcher. So `/api/get/json` becomes `//api/get/json/`.

#### Matcher Examples:

#### Glob-Pattern:

Glob-Patterns are strings that can contain wildcards. Possible wildcards/patterns are:

-   `*` matches any number of characters, except `/`
-   `**` matches any number of characters, including `/`
-   `?` matches one character, except `/`
-   `[abc]` matches one character in the brackets (in this example `a`, `b` or `c`)
-   `[a-z]` matches one character in the range (in this example `a` to `z`)
-   `{foo,bar,baz}` matches one of the strings in the braces (in this example `foo`, `bar` or `baz`)

Example:

```robotframework
Wait For Response    **/api/get/text    # matches any response with url ending with /api/get/text. example: https://browser.fi/api/get/text
```

#### RegExp:

Regular Expressions are JavaScript regular expressions enclosed in `/` with optional trailing flags. Be aware that backslashes need to be escaped in Robot Framework, e.g. `\\w` instead of `\w`. See [regex101](https://regex101.com) for more information on Regular Expressions.

Example:

```robotframework
Wait For Response    /http://\\w+:\\d+/api/get/text/i    # matches any response with url ending with /api/get/text and containing http:// followed by any word and port. example: http://localhost:8080/api/get/text
```

#### JavaScript Arrow-Function:

JavaScript Arrow-Functions are anonymous JavaScript functions that receive the [Response](https://playwright.dev/docs/api/class-response) object and return a boolean.

Example:

```robotframework
Wait For Response    response => response.url() === 'http://localhost/api/post' && response.status() === 200    # matches any response with url http://localhost/api/post and status code 200
```

#### Robot Examples:

Synchronous Example:

```robotframework
Click                \#delayed_request    # Creates response which should be waited before next actions
Wait For Response    matcher=/http://\\w+:\\d+/api/get/text/i
Click                \#save
```

Asynchronous Example:

```robotframework
${promise} =    Promise To    Wait For Response    timeout=60s
Click           \#delayed_request    # Creates response which should be waited before pressing save.
Click           \#next
Wait For        ${promise}            # Waits for the response
Click           \#save
```

JavaScript Function Example:

```robotframework
Click               \#delayed_request    # Creates response which should be waited before pressing save.
Wait For Response   response => response.url().endsWith('json') && response.request().method() === 'GET'
```

## Types

### Any

Kind: Standard

Any value is accepted. No conversion is done.

Accepts: Any

Used by: Evaluate JavaScript, Get Aria Snapshot, Get Attribute, Get BoundingBox, Get Browser Catalog, Get Browser Ids, Get Client Size, Get Console Log, Get Context Ids, Get Download State, Get Page Errors, Get Page Ids, Get Page Source, Get Property, Get Scroll Position, Get Scroll Size, Get Select Options, Get Style, Get Text, Get Title, Get Url, Get Viewport Size, Http, LocalStorage Get Item, Select Options By, SessionStorage Get Item, Wait For Condition, Wait For Request, Wait For Response

### AreaFields

Kind: Enum

Enumeration that defines which coordinates of an area should be selected.

`ALL` defines that all fields are selected and a dictionary with all information is returned.

Members:

- `top`
- `left`
- `bottom`
- `right`
- `ALL`

Accepts: string

Used by: Get Scroll Position

### AriaSnapshotMode

Kind: Enum

Defines the mode of the AriaSnapshot.

| Value | Description |
| --- | --- |
| `default` | Standard aria snapshot. |
| `ai` | Snapshot optimized for AI consumption. It includes element references like `[ref=e2]`, includes snapshots of iframes inside the target and does not wait for a matching element, but fails immediately when no element matches. |

Members:

- `default`
- `ai`

Accepts: string

Used by: Get Aria Snapshot

### AriaSnapshotReturnType

Kind: Enum

Defines the return type of the AriaSnapshot.

| Value | Description |
| --- | --- |
| `dict` | returns the snapshot as a dictionary. |
| `yaml` | returns the snapshot as a yaml string. |
| `parsed` | returns the snapshot as a tree of node dictionaries. |

`dict` loads the yaml as it is. Role, name and all annotations of an element stay inside the dictionary keys, for example `{'heading "Login Page" [level=1]': None}`.

`parsed` splits that information into separate keys. Every node has `role`, `name`, `text`, `props` and `children`, and its values are reachable both as `${node}[role]` and as `${node.role}`. Annotations without a value, like `[selected]`, become `True`, `[level=2]` becomes an integer and `box` uses the same keys as `Get BoundingBox`. The `/url` entry of a link is an annotation in Playwright, not an element, and therefore becomes the `url` property of the link instead of one of its children.

#### Examples

All outputs below come from the same element of the same page. It offers fourteen tag options; the examples stop after the fourth one:

```robotframework
New Browser    chromium
New Page       https://robotframework-browser.org/keywords
${snapshot} =    Get Aria Snapshot    .rail-top
```

#### return\_type=yaml (default)

```robotframework
- text: Filter keywords
- searchbox "Filter keywords"
- group: Version 20.3.0
- text: Filter by tag
- combobox "Filter by tag":
  - option "— Show all tags —" [selected]
  - option "Setter (84)"
  - option "PageContent (83)"
  - option "Getter (45)"
```

#### return\_type=yaml with boxes=True

```robotframework
- text: Filter keywords
- searchbox "Filter keywords" [box=12,77,279,30]
- group [box=12,116,279,34]: Version 20.3.0
- text: Filter by tag
- combobox "Filter by tag" [box=12,158,279,32]:
  - option "— Show all tags —" [selected] [box=0,0,0,0]
  - option "Setter (84)" [box=0,0,0,0]
  - option "PageContent (83)" [box=0,0,0,0]
  - option "Getter (45)" [box=0,0,0,0]
```

#### return\_type=yaml with boxes=True and mode=ai

```robotframework
- generic [ref=f2e1] [box=0,65,303,137]:
  - generic [ref=f2e3] [box=12,77,279,30]:
    - generic [ref=f2e4] [box=12,77,1,1]: Filter keywords
    - searchbox "Filter keywords" [ref=f2e5] [box=12,77,279,30]
  - generic [ref=f2e6] [box=12,116,279,74]:
    - group [ref=f2e7] [box=12,116,279,34]:
      - generic "Version 20.3.0" [ref=f2e8] [cursor=pointer] [box=12,116,157,34]:
        - generic [ref=f2e9] [box=22,124,66,18]: Version
        - generic [ref=f2e10] [box=96,121,49,22]: 20.3.0
    - generic [ref=f2e12] [box=12,158,279,32]:
      - generic [ref=f2e13] [box=12,158,1,1]: Filter by tag
      - combobox "Filter by tag" [ref=f2e14] [box=12,158,279,32]:
        - option "— Show all tags —" [selected] [box=0,0,0,0]
        - option "Setter (84)" [box=0,0,0,0]
        - option "PageContent (83)" [box=0,0,0,0]
        - option "Getter (45)" [box=0,0,0,0]
```

#### return\_type=dict with boxes=True

```robotframework
[
  {
    'text': 'Filter keywords'
  },
  'searchbox "Filter keywords" [box=12,77,279,30]',
  {
    'group [box=12,116,279,34]': 'Version 20.3.0'
  },
  {
    'text': 'Filter by tag'
  },
  {
    'combobox "Filter by tag" [box=12,158,279,32]': [
      'option "— Show all tags —" [selected] [box=0,0,0,0]',
      'option "Setter (84)" [box=0,0,0,0]',
      'option "PageContent (83)" [box=0,0,0,0]'
      'option "Getter (45)" [box=0,0,0,0]'
    ]
  }
]
```

#### return\_type=parsed with boxes=True

Fully parsed snapshot as Robot Framework dictionary:

```robotframework
[
  {
    'role': 'text',
    'name': None,
    'text': 'Filter keywords',
    'props': {},
    'children': []
  },
  {
    'role': 'searchbox',
    'name': 'Filter keywords',
    'text': None,
    'props': {
      'box': {
        'x': 12,
        'y': 77,
        'width': 279,
        'height': 30
      }
    },
    'children': []
  },
  {
    'role': 'group',
    'name': None,
    'text': 'Version 20.3.0',
    'props': {
      'box': {
        'x': 12,
        'y': 116,
        'width': 279,
        'height': 34
      }
    },
    'children': []
  },
  {
    'role': 'text',
    'name': None,
    'text': 'Filter by tag',
    'props': {},
    'children': []
  },
  {
    'role': 'combobox',
    'name': 'Filter by tag',
    'text': None,
    'props': {
      'box': {
        'x': 12,
        'y': 158,
        'width': 279,
        'height': 32
      }
    },
    'children': [
      {
        'role': 'option',
        'name': '— Show all tags —',
        'text': None,
        'props': {
          'selected': True,
          'box': {
            'x': 0,
            'y': 0,
            'width': 0,
            'height': 0
          }
        },
        'children': []
      },
      {
        'role': 'option',
        'name': 'Setter (84)',
        'text': None,
        'props': {
          'box': {
            'x': 0,
            'y': 0,
            'width': 0,
            'height': 0
          }
        },
        'children': []
      },
      {
        'role': 'option',
        'name': 'PageContent (83)',
        'text': None,
        'props': {
          'box': {
            'x': 0,
            'y': 0,
            'width': 0,
            'height': 0
          }
        },
        'children': []
      },
      {
        'role': 'option',
        'name': 'Getter (45)',
        'text': None,
        'props': {
          'box': {
            'x': 0,
            'y': 0,
            'width': 0,
            'height': 0
          }
        },
        'children': []
      }
    ]
  }
]
```

Members:

- `dict`
- `yaml`
- `parsed`

Accepts: string

Used by: Get Aria Snapshot

### AssertionOperator

Kind: Enum

Currently supported assertion operators are:

| Operator | Alternative Operators | Description | Validate Equivalent |
| --- | --- | --- | --- |
| `==` | `equal`, `equals`, `should be` | Checks if returned value is equal to expected value. | `value == expected` |
| `!=` | `inequal`, `should not be` | Checks if returned value is not equal to expected value. | `value != expected` |
| `>` | `greater than` | Checks if returned value is greater than expected value. | `value > expected` |
| `>=` |  | Checks if returned value is greater than or equal to expected value. | `value >= expected` |
| `<` | `less than` | Checks if returned value is less than expected value. | `value < expected` |
| `<=` |  | Checks if returned value is less than or equal to expected value. | `value <= expected` |
| `*=` | `contains` | Checks if returned value contains expected value as substring. | `expected in value` |
|  | `not contains` | Checks if returned value does not contain expected value as substring. | `expected in value` |
| `^=` | `should start with`, `starts` | Checks if returned value starts with expected value. | `re.search(f"^{expected}", value)` |
| `$=` | `should end with`, `ends` | Checks if returned value ends with expected value. | `re.search(f"{expected}$", value)` |
| `matches` |  | Checks if given RegEx matches minimum once in returned value. | `re.search(expected, value)` |
| `validate` |  | Checks if given Python expression evaluates to `True`. |  |
| `evaluate` | `then` | When using this operator, the keyword does return the evaluated Python expression. |  |

There are three different possibilities what keyword returns when matches operator is used: string, tuple or dictionary. What keyword returns depends on how the RegEx is formed. If RegEx does not contain group(s), then keyword will return the string without modifications. If RegEx contains groups, meaning (...), then keyword will return a tuple. Each tuple item contains the text which is matched by the group. If there is group and group has a name, (?P<name>...) syntax, then keyword returns a dictionary. In this case dictionary key is the group name and value contains the matched text. If there mix of groups and groups with names, then tuple is returned.

Currently supported formatters for assertions are:

| Formatter | Description |
| --- | --- |
| `normalize spaces` | Substitutes multiple spaces to single space from the value |
| `strip` | Removes spaces from the beginning and end of the value |
| `case insensitive` | Converts value to lower case before comparing |
| `apply to expected` | Applies rules also for the expected value |

Formatters are applied to the value before assertion is performed and keywords returns a value where rule is applied. Formatter is only applied to the value which keyword returns and not all rules are valid for all assertion operators. If `apply to expected` formatter is defined, then formatters are then formatter are also applied to expected value.

Members:

- `equal`
- `equals`
- `==`
- `should be`
- `inequal`
- `!=`
- `should not be`
- `less than`
- `<`
- `greater than`
- `>`
- `<=`
- `>=`
- `contains`
- `not contains`
- `*=`
- `starts`
- `^=`
- `should start with`
- `ends`
- `should end with`
- `$=`
- `matches`
- `validate`
- `then`
- `evaluate`

Accepts: string

Used by: Get Aria Snapshot, Get Attribute, Get Attribute Names, Get BoundingBox, Get Browser Catalog, Get Browser Ids, Get Checkbox State, Get Classes, Get Client Size, Get Console Log, Get Context Ids, Get Download State, Get Element Count, Get Element States, Get Page Errors, Get Page Ids, Get Page Source, Get Property, Get Scroll Position, Get Scroll Size, Get Select Options, Get Selected Options, Get Style, Get Table Cell Index, Get Table Row Index, Get Text, Get Title, Get Url, Get Viewport Size, LocalStorage Get Item, SessionStorage Get Item

### AutoClosingLevel

Kind: Enum

Controls when contexts and pages are closed during the test execution.

If automatic closing level is `TEST`, contexts and pages that are created during a single test are automatically closed when the test ends. Contexts and pages that are created during suite setup are closed when the suite teardown ends.

If automatic closing level is `SUITE`, all contexts and pages that are created during the test suite are closed when the suite teardown ends.

If automatic closing level is `MANUAL`, nothing is closed automatically while the test execution is ongoing. All browsers, context and pages are automatically closed when test execution ends.

If automatic closing level is `KEEP`, nothing is closed automatically while the test execution is ongoing. Also, nothing is closed when test execution ends, including the node process. Therefore, it is users responsibility to close all browsers, context and pages and ensure that all process that are left running after the test execution end are closed. This level is only intended for test case development and must not be used when running tests in CI or similar environments.

Automatic closing can be configured or switched off with the auto\_closing\_level library import parameter.

See: `Importing`

Members:

- `SUITE`
- `TEST`
- `MANUAL`
- `KEEP`

Accepts: string

Used by: __init__

### boolean

Kind: Standard

Strings `TRUE`, `YES`, `ON`, `1` and possible localization specific "true strings" are converted to Boolean `True`, the empty string, strings `FALSE`, `NO`, `OFF` and `0` and possibly localization specific "false strings" are converted to Boolean `False`, and the string `NONE` is converted to the Python `None` object. Other strings and all other values are passed as-is, allowing keywords to handle them specially if needed. All string comparisons are case-insensitive.

Examples: `TRUE` (converted to `True`), `off` (converted to `False`), `example` (used as-is)

Accepts: string, integer, float, None

Used by: __init__, Add Cookie, Add Locator Handler Click, Add Locator Handler Custom, Check Checkbox, Click With Options, Close Context, Close Page, Connect To Browser, Download, Evaluate JavaScript, Fill Secret, Fill Text, Get Aria Snapshot, Get BoundingBox, Get Checkbox State, Get Console Log, Get Element By, Get Element By Role, Get Page Errors, Hover, Launch Browser Server, New Browser, New Context, New Persistent Context, Open Browser, Promise To Wait For Download, Save Page As Pdf, Save Storage State, Set Default Run Before Unload, Set Highlight On Failure, Set Offline, Set Presenter Mode, Set Strict Mode, Show Keyword Banner, Start Coverage, Take Screenshot, Tap, Type Secret, Type Text, Uncheck Checkbox

### BoundingBox

Kind: TypedDict

Bounding box of an element.

| Key | Description |
| --- | --- |
| `x` | The amount of pixel between the left border of the page and the left border of the element. |
| `y` | The amount of pixel between the top border of the page and the top border of the element. |
| `width` | The width of the element, excluding margins. |
| `height` | The height of the element, excluding margins. |

Keys:

- `x: float`
- `y: float`
- `width: float`
- `height: float`

Accepts: string, Mapping

Used by: Get BoundingBox, Take Screenshot

### BoundingBoxFields

Kind: Enum

Enumeration that defines which location information of an element should be selected.

`x` / `y` defines the position of the top left corner of an element.

`width` / `height` defines the size of an elements bounding box.

`ALL` defines that all fields are selected and a dictionary with all information is returned.

Members:

- `width`
- `height`
- `x`
- `y`
- `ALL`

Accepts: string

Used by: Get BoundingBox

### BrowserInfo

Kind: TypedDict

Dictionary that contains information about a browser instance.

| Key | Description |
| --- | --- |
| `type` | The browser type. e.g. chromium, firefox or webkit. |
| `id` | The unique id of the browser instance. |
| `contexts` | List of context information opened by the browser. |
| `activeContext` | The id of the active context. |
| `activeBrowser` | Boolean if the browser is the currently active browser. |

Structure:

```robotframework
{
  'type': str,
  'id': str,
  'contexts': [
      {
          'type': str,
          'id': str,
          'activePage': str,
          'pages': [
              {
                  'type': str,
                  'title': str,
                  'url': str,
                  'id': str,
                  'timestamp': float
              },
              ...
          ]
      },
      ...
  ],
  'activeContext': str,
  'activeBrowser': bool
}
```

Keys:

- `type: str` (required)
- `id: str` (required)
- `contexts: list[Browser.utils.data_types.ContextInfo]` (required)
- `activeContext: str` (required)
- `activeBrowser: bool` (required)

Accepts: string, Mapping

Used by: Get Browser Catalog

### bytes

Kind: Standard

Strings are converted to bytes so that each Unicode code point below 256 is directly mapped to a matching byte. Higher code points are not allowed. Robot Framework's `\xHH` escape syntax is convenient with bytes having non-printable values.

Examples: `good`, `hyvä` (same as `hyv\xE4`), `\x00` (the null byte)

Integers and sequences of integers are converted to matching bytes directly. They must be in range 0-255.

Examples: `0` (converted to the null byte), `[82, 70]` (converted to `RF`)

Support for integers and sequences of integers is new in Robot Framework 7.4.

Accepts: string, bytearray, Sequence, integer

Used by: Take Screenshot

### ClientCertificate

Kind: TypedDict

Defines client certificate.

-   `origin` Exact origin that the certificate is valid for. Origin includes https protocol, a hostname and optionally a port.
-   `certPath` **Optional** Path to the file with the certificate in PEM format.
-   `keyPath` **Optional** Path to the file with the private key in PEM format.
-   `pfxPath` **Optional** Path to the PFX or PKCS12 encoded private key and certificate chain.
-   `passphrase` **Optional** Passphrase for the private key (PEM or PFX).

Example usage: `{'origin': '[https://playwright.dev](https://playwright.dev)', 'pfxPath': 'certificate.p12', 'passphrase': 'secret'}`

Keys:

- `origin: str`
- `certPath: str`
- `keyPath: str`
- `pfxPath: str`
- `passphrase: str`

Accepts: string, Mapping

Used by: New Context

### ClientCredential

Kind: TypedDict

Returned client credential.

-   `id` Base64url-encoded credential id.
-   `rpId` Relying party id (typically the site's effective domain).
-   `userHandle` Base64url-encoded user handle.
-   `privateKey` Base64url-encoded PKCS#8 (DER) private key.
-   `publicKey` Base64url-encoded SPKI (DER) public key.

Example usage: `{'id': 'localhost', 'rpId': 'localhost', 'userHandle': 'localhost', 'privateKey': 'localhost', 'publicKey': 'localhost'}`

Keys:

- `id: str` (required)
- `rpId: str` (required)
- `userHandle: str` (required)
- `privateKey: Secret` (required)
- `publicKey: Secret` (required)

Accepts: string, Mapping

Used by: Get Credential

### CLockAdvanceType

Kind: Enum

Defines how time is advanced.

`fast_forward`: Advance the clock by jumping forward in time. `run_for`: Advance the clock, firing all the time-related callbacks.

fast\_forward will Only fires due timers at most once. This is equivalent to user closing the laptop lid for a while and reopening it later, after given time.

Members:

- `fast_forward`
- `run_for`

Accepts: string

Used by: Advance Clock

### ClockType

Kind: Enum

Defines how time is set.

The recommended approach is to use fixed to set the time to a specific value.

`fixed`: Sets the fixed time for Date.now() and new Date(). `system`: Is only recommended for advanced use cases. `install`: initializes the clock and allows you to: pause\_at: Pauses the time at a specific time. fast\_forward: Fast forwards the time. run\_for: Runs the time for a specific duration. resume: Resumes the time.

Members:

- `fixed`
- `system`
- `install`

Accepts: string

Used by: Set Time

### ColorScheme

Kind: Enum

Emulates 'prefers-color-scheme' media feature. Supported values are 'light', 'dark', 'no-preference' and `null`. Passing `null` disables color scheme emulation. `no-preference` is deprecated.

See [emulateMedia(options)](https://playwright.dev/docs/api/class-page?_highlight=emulatemedia#pageemulatemediaparams) for more details.

Members:

- `dark`
- `light`
- `no-preference`
- `null`

Accepts: string

Used by: Emulate Media, New Context, New Persistent Context

### ConditionInputs

Kind: Enum

Following values are allowed and represent the assertion keywords to use:

| Value | Keyword |
| --- | --- |
| `Attribute` | `Get Attribute` |
| `Attribute Names` | `Get Attribute Names` |
| `BoundingBox` | `Get BoundingBox` |
| `Browser Catalog` | `Get Browser Catalog` |
| `Checkbox State` | `Get Checkbox State` |
| `Classes` | `Get Classes` |
| `Client Size` | `Get Client Size` |
| `Download State` | `Get Download State` |
| `Element Count` | `Get Element Count` |
| `Element States` | `Get Element States` |
| `Page Source` | `Get Page Source` |
| `Property` | `Get Property` |
| `Scroll Position` | `Get Scroll Position` |
| `Scroll Size` | `Get Scroll Size` |
| `Select Options` | `Get Select Options` |
| `Selected Options` | `Get Selected Options` |
| `Style` | `Get Style` |
| `Table Cell Index` | `Get Table Cell Index` |
| `Table Row Index` | `Get Table Row Index` |
| `Text` | `Get Text` |
| `Title` | `Get Title` |
| `Url` | `Get Url` |
| `Viewport Size` | `Get Viewport Size` |

Members:

- `attribute`
- `attribute_names`
- `bounding_box`
- `browser_catalog`
- `checkbox_state`
- `classes`
- `client_size`
- `download_state`
- `element_count`
- `element_states`
- `page_source`
- `property`
- `scroll_position`
- `scroll_size`
- `select_options`
- `selected_options`
- `style`
- `table_cell_index`
- `table_row_index`
- `text`
- `title`
- `url`
- `viewport_size`

Accepts: string

Used by: Wait For Condition

### CookieSameSite

Kind: Enum

Enum that defines the Cookie SameSite type.

It controls whether or not a cookie is sent with cross-site requests, providing some protection against cross-site request forgery attacks (CSRF).

The possible attribute values are:

| Value | Description |
| --- | --- |
| `Strict` | Means that the browser sends the cookie only for same-site requests, that is, requests originating from the same site that set the cookie. If a request originates from a different domain or scheme (even with the same domain), no cookies with the SameSite=Strict attribute are sent. |
| `Lax` | Means that the cookie is not sent on cross-site requests, such as on requests to load images or frames, but is sent when a user is navigating to the origin site from an external site (for example, when following a link). This is the default behavior if the SameSite attribute is not specified. |
| `None` | means that the browser sends the cookie with both cross-site and same-site requests. The Secure attribute must also be set when setting this value. |

See [MDN Set-Cookie](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie) for more information.

Members:

- `Strict`
- `Lax`
- `None`

Accepts: string

Used by: Add Cookie

### CookieType

Kind: Enum

Enum that defines the Cookie type.

Members:

- `dictionary`
- `dict`
- `string`
- `str`

Accepts: string

Used by: Get Cookie, Get Cookies

### CoverageType

Kind: Enum

Enum that defines the type of coverage to collect.

`js`: [JavaScript](https://playwright.dev/docs/api/class-coverage/#coverage-start-js-coverage) coverage. `css`: [CSS](https://playwright.dev/docs/api/class-coverage/#coverage-start-css-coverage) coverage. `all`: Both [CSS](https://playwright.dev/docs/api/class-coverage/#coverage-start-css-coverage) and [JS](https://playwright.dev/docs/api/class-coverage/#coverage-start-js-coverage) coverage.

Members:

- `js`
- `css`
- `all`

Accepts: string

Used by: Start Coverage

### datetime

Kind: Standard

String timestamps are expected to be in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) like format `YYYY-MM-DD hh:mm:ss.mmmmmm`, where any non-digit character can be used as a separator or separators can be omitted altogether. Additionally, only the date part is mandatory, all possibly missing time components are considered to be zeros.

A special values `NOW` and `TODAY` (case-insensitive) can be used to get the current local `datetime`. This is new in Robot Framework 7.3.

Integers and floats are considered to represent seconds since the [Unix epoch](https://en.wikipedia.org/wiki/Unix_time).

Examples: `2022-02-09T16:39:43.632269`, `20220209 16:39`, `now`, `${1644417583.632269}` (Epoch time)

Accepts: string, integer, float

Used by: Add Cookie, Pause At, Set Time

### DialogAction

Kind: Enum

Enum that defines how to handle a dialog.

Members:

- `accept`
- `dismiss`

Accepts: string

Used by: Handle Future Dialogs, Wait For Alert, Wait For Alerts

### dictionary

Kind: Standard

Strings must be Python [dictionary](https://docs.python.org/library/stdtypes.html#dict) literals. They are converted to actual dictionaries using the [ast.literal\_eval](https://docs.python.org/library/ast.html#ast.literal_eval) function. They can contain any values `ast.literal_eval` supports, including dictionaries and other collections.

Any mapping is accepted and converted to a `dict`.

If the type has nested types like `dict[str, int]`, items are converted to those types automatically. This in new in Robot Framework 6.0.

Examples: `{'a': 1, 'b': 2}`, `{'key': 1, 'nested': {'key': 2}}`

Accepts: string, Mapping

Used by: __init__, Add Locator Handler Custom, Close Page, Emulate Media, Get Aria Snapshot, Get Attribute, Get Console Log, Get Device, Get Devices, Get Page Errors, Get Page Source, Get Style, Get Text, Get Title, Get Url, Get Viewport Size, Http, Launch Browser Server, New Browser, New Context, New Persistent Context, Set Assertion Formatters, Show Keyword Banner

### Dimensions

Kind: TypedDict

Dimensions of an object in pixels.

Keys:

- `width: int` (required)
- `height: int` (required)

Accepts: string, Mapping

Used by: Get Client Size, Get Scroll Size

### DownloadInfo

Kind: TypedDict

Downloaded file information.

| Key | Description |
| --- | --- |
| `saveAs` | is the path where downloaded file is saved. empty string if the file is not yet fully downloaded. |
| `suggestedFilename` | is the suggested filename that was computed from the `Content-Disposition` response header. |
| `state` | is the state of the download. i.e. `in_progress`, `finished` or `canceled`. |
| `downloadID` | is the unique id of the download. |

Keys:

- `saveAs: str` (required)
- `suggestedFilename: str` (required)
- `state: str` (required)
- `downloadID: str | None` (required)

Accepts: string, Mapping

Used by: Cancel Download, Download, Get Download State

### ElementRole

Kind: Enum

Role selector does not replace accessibility audits and conformance tests, but rather gives early feedback about the ARIA guidelines.

Many html elements have an implicitly [defined role](https://w3c.github.io/html-aam/#html-element-role-mappings) that is recognized by the role selector. You can find all the [supported roles](https://www.w3.org/TR/wai-aria-1.2/#role_definitions) here. ARIA guidelines do not recommend duplicating implicit roles and attributes by setting role and/or aria-\* attributes to default values.

Members:

- `ALERT`
- `ALERTDIALOG`
- `APPLICATION`
- `ARTICLE`
- `BANNER`
- `BLOCKQUOTE`
- `BUTTON`
- `CAPTION`
- `CELL`
- `CHECKBOX`
- `CODE`
- `COLUMNHEADER`
- `COMBOBOX`
- `COMPLEMENTARY`
- `CONTENTINFO`
- `DEFINITION`
- `DELETION`
- `DIALOG`
- `DIRECTORY`
- `DOCUMENT`
- `EMPHASIS`
- `FEED`
- `FIGURE`
- `FORM`
- `GENERIC`
- `GRID`
- `GRIDCELL`
- `GROUP`
- `HEADING`
- `IMG`
- `INSERTION`
- `LINK`
- `LIST`
- `LISTBOX`
- `LISTITEM`
- `LOG`
- `MAIN`
- `MARQUEE`
- `MATH`
- `METER`
- `MENU`
- `MENUBAR`
- `MENUITEM`
- `MENUITEMCHECKBOX`
- `MENUITEMRADIO`
- `NAVIGATION`
- `NONE`
- `NOTE`
- `OPTION`
- `PARAGRAPH`
- `PRESENTATION`
- `PROGRESSBAR`
- `RADIO`
- `RADIOGROUP`
- `REGION`
- `ROW`
- `ROWGROUP`
- `ROWHEADER`
- `SCROLLBAR`
- `SEARCH`
- `SEARCHBOX`
- `SEPARATOR`
- `SLIDER`
- `SPINBUTTON`
- `STATUS`
- `STRONG`
- `SUBSCRIPT`
- `SUPERSCRIPT`
- `SWITCH`
- `TAB`
- `TABLE`
- `TABLIST`
- `TABPANEL`
- `TERM`
- `TEXTBOX`
- `TIME`
- `TIMER`
- `TOOLBAR`
- `TOOLTIP`
- `TREE`
- `TREEGRID`
- `TREEITEM`

Accepts: string

Used by: Get Element By Role

### ElementState

Kind: Enum

Enum that defines the state an element can have.

The following `states` are possible:

| State | Description |
| --- | --- |
| `attached` | to be present in DOM. |
| `detached` | to not be present in DOM. |
| `visible` | to have non or empty bounding box and no visibility:hidden. |
| `hidden` | to be detached from DOM, or have an empty bounding box or visibility:hidden. |
| `enabled` | to not be `disabled`. |
| `disabled` | to be `disabled`. Can be used on <button>, <fieldset>, <input>, <optgroup>, <option>, <select> and <textarea>. |
| `editable` | to not be `readOnly`. |
| `readonly` | to be `readOnly`. Can be used on <input> and <textarea>. |
| `selected` | to be `selected`. Can be used on <option>. |
| `deselected` | to not be `selected`. |
| `focused` | to be the `activeElement`. |
| `defocused` | to not be the `activeElement`. |
| `checked` | to be `checked`. Can be used on <input>. |
| `unchecked` | to not be `checked`. |
| `stable` | to be both `visible` and `stable`. |

Members:

- `attached`
- `detached`
- `visible`
- `hidden`
- `enabled`
- `disabled`
- `editable`
- `readonly`
- `selected`
- `deselected`
- `focused`
- `defocused`
- `checked`
- `unchecked`
- `stable`

Accepts: string, integer

Used by: Get Element States, Wait For Elements State

### FileUploadBuffer

Kind: TypedDict

Dictionary that contains information about a file upload buffer.

| Key | Description |
| --- | --- |
| `name` | The name of the file. |
| `mimeType` | The mime type of the file. |
| `buffer` | The file content. |

Structure:

```robotframework
{
  'name': str,
  'mimeType': str,
  'buffer': str
}
```

Keys:

- `name: str` (required)
- `mimeType: str` (required)
- `buffer: str` (required)

Accepts: string, Mapping

Used by: Upload File By Selector

### float

Kind: Standard

Conversion is done using Python's [float](https://docs.python.org/library/functions.html#float) built-in function.

Spaces and underscores can be used as visual separators for digit grouping purposes.

Examples: `3.14`, `2.9979e8`, `10 000.000 01`

Accepts: string, Real

Used by: Click With Options, Drag And Drop By Coordinates, Drag And Drop Relative To, Get BoundingBox, Get Client Size, Get Scroll Position, Get Scroll Size, Hover, Launch Browser Server, Mouse Button, Mouse Move, Mouse Move Relative To, New Browser, New Context, New Persistent Context, Save Page As Pdf, Set Geolocation

### ForcedColors

Kind: Enum

Emulates 'forced-colors' media feature.

Supported values are 'active', 'none' and `null`. Passing `null` disables forced colors emulation.

Members:

- `active`
- `none`
- `null`

Accepts: string

Used by: Emulate Media, New Context, New Persistent Context

### FormatingRules

Kind: Enum

Enum that defines the available formatters.

| Formatter | Description |
| --- | --- |
| `normalize spaces` | Replaces all kind of spaces with a single space. |
| `strip` | Removes spaces from start and end of the string. |
| `apply to expected` | Applies the formatter also to the expected value. |
| `case insensitive` | Converts the string to lower case. |

Members:

- `normalize spaces`
- `strip`
- `apply to expected`
- `case insensitive`

Accepts: string

Used by: Set Assertion Formatters

### FormatterKeywords

Kind: Enum

Enum that defines the available keywords for formatters.

Keywords that are not listed here, do not support formatters.

Members:

- `Get Attribute`
- `Get Browser Catalog`
- `Get Page Source`
- `Get Property`
- `Get Select Options`
- `Get Style`
- `Get Text`
- `Get Title`
- `Get Url`
- `LocalStorage Get Item`
- `SessionStorage Get Item`

Accepts: string

Used by: Set Assertion Formatters

### GeoLocation

Kind: TypedDict

Defines the geolocation.

-   `latitude` Latitude between -90 and 90.
-   `longitude` Longitude between -180 and 180.
-   `accuracy` **Optional** Non-negative accuracy value. Defaults to 0.

Example usage: `{'latitude': 59.95, 'longitude': 30.31667}`

Keys:

- `longitude: float` (required)
- `latitude: float` (required)
- `accuracy: float`

Accepts: string, Mapping

Used by: New Context, New Persistent Context

### HighLightElement

Kind: TypedDict

Presenter mode configuration options.

`duration` Sets for how long the selector shall be highlighted. Defaults to `5s` => 5 seconds.

`width` Sets the width of the higlight border. Defaults to 2px.

`style` Sets the style of the border. Defaults to dotted.

`color` Sets the color of the border, default is blue. Valid colors i.e. are: `red`, `blue`, `yellow`, `pink`, `black`

Keys:

- `duration: timedelta`
- `width: str`
- `style: str`
- `color: str`

Accepts: string, Mapping

Used by: __init__, Set Presenter Mode

### HighlightMode

Kind: Enum

Highlight mode for the element.

`border`: Highlights the element with a border outside of the selected element. This is the classic way to highlight an element of Browser librarary.

`playwright`: Highlights the element with Playwrights built in function.

`both`: Highlights the element with both methods.

Members:

- `border`
- `playwright`
- `both`

Accepts: string

Used by: Highlight Elements

### HttpCredentials

Kind: TypedDict

Sets the credentials for http basic-auth.

`origin`: Restrain sending http credentials on specific origin ([scheme://host:port](scheme://host:port)). Credentials for HTTP authentication. If no origin is specified, the username and password are sent to any servers upon unauthorized responses.

Can be defined as robot dictionary or as string literal. Does not reveal secrets in Robot Framework logs. Instead, username and password values are resolved internally. Please note that if `enable_playwright_debug` is enabled in the library import, secret will be always visible as plain text in the playwright debug logs, regardless of the Robot Framework log level.

Example as literal:

```robotframework
${pwd} =    Set Variable    1234
${username} =    Set Variable    admin
New Context
...    httpCredentials={'username': '$username', 'password': '$pwd'}
```

Example as robot variable

```robotframework
*** Variables ***
${username}=       admin
${pwd}=            1234
&{credentials}=    username=$username    password=$pwd

*** Keywords ***
Open Context
   New Context    httpCredentials=${credentials}
```

Keys:

- `username: str | robot.utils.secret.Secret` (required)
- `password: str | robot.utils.secret.Secret` (required)
- `origin: str`

Accepts: string, Mapping

Used by: New Context, New Persistent Context

### integer

Kind: Standard

Conversion is done using Python's [int](https://docs.python.org/library/functions.html#int) built-in function. Floating point numbers are accepted only if they can be represented as integers exactly. For example, `1.0` is accepted and `1.1` is not.

It is possible to use hexadecimal, octal and binary numbers by prefixing values with `0x`, `0o` and `0b`, respectively. Spaces and underscores can be used as visual separators for digit grouping purposes.

Examples: `42`, `-1`, `0b1010`, `10 000 000`, `0xBAD_C0FFEE`

Accepts: string, float

Used by: __init__, Add Locator Handler Click, Add Locator Handler Custom, Click With Options, Crawl Site, Drag And Drop, Drag And Drop By Coordinates, Drag And Drop Relative To, Get Aria Snapshot, Get BoundingBox, Get Console Log, Get Element By Role, Get Element Count, Get Page Errors, Get Scroll Size, Get Selected Options, Get Table Cell Index, Get Table Row Index, Keyboard Input, Launch Browser Server, Mouse Button, Mouse Move, Mouse Move Relative To, Mouse Wheel, New Browser, New Context, New Persistent Context, Set Viewport Size, Take Screenshot, Tap

### KeyAction

Kind: Enum

Enum that defines which `Keyboard Key` action to perform.

Members:

- `down`
- `up`
- `press`

Accepts: string

Used by: Keyboard Key

### KeyboardInputAction

Kind: Enum

Enum that defines how `Keyboard Input` adds the text into the page.

`insertText` is mostly similar to pasting of text.

`type` is similar to typing by pressing keys on the keyboard.

Members:

- `insertText`
- `type`

Accepts: string

Used by: Keyboard Input

### KeyboardModifier

Kind: Enum

Modifier keys to press while doing other actions.

Modifiers that are pressed during the `Hover` or `Click`.

Members:

- `Alt`
- `Control`
- `ControlOrMeta`
- `Meta`
- `Shift`

Accepts: string

Used by: Click With Options, Hover, Tap

### LambdaFunction

Kind: Custom

Python lambda function.

The string must start with `lambda` and the function must accept one argument.

Example: `lambda value: value.lower().replace(' ', '')`

Accepts: string

Used by: Set Assertion Formatters

### list

Kind: Standard

Strings must be Python [list](https://docs.python.org/library/stdtypes.html#list) or [tuple](https://docs.python.org/library/stdtypes.html#tuple) literals. They are converted using the [ast.literal\_eval](https://docs.python.org/library/ast.html#ast.literal_eval) function and possible tuples converted further to lists. They can contain any values `ast.literal_eval` supports, including lists and other collections.

If the argument is a list, it is used without conversion. Tuples and other sequences are converted to lists.

If the type has nested types like `list[int]`, items are converted to those types automatically.

Examples: `['one', 'two']`, `[('one', 1), ('two', 2)]`

Support to convert nested types is new in Robot Framework 6.0. Support for tuple literals is new in Robot Framework 7.4.

Accepts: string, Sequence

Used by: __init__, Add Locator Handler Custom, Close Page, Get Aria Snapshot, Get Attribute Names, Get Browser Catalog, Get Browser Ids, Get Classes, Get Console Log, Get Context Ids, Get Cookies, Get Element States, Get Elements, Get Page Errors, Get Page Ids, Get Select Options, Get Selected Options, Get Text, Launch Browser Server, Merge Coverage Reports, New Browser, New Context, New Persistent Context, Select Options By, Set Assertion Formatters, Take Screenshot, Wait For Alerts

### Mapping

Kind: Standard

Strings must be Python [dictionary](https://docs.python.org/library/stdtypes.html#dict) literals. They are converted to actual dictionaries using the [ast.literal\_eval](https://docs.python.org/library/ast.html#ast.literal_eval) function. They can contain any values `ast.literal_eval` supports, including dictionaries and other collections.

Any mapping is accepted without conversion. An exception is that if the type is `MutableMapping`, immutable values are converted to `dict`.

If the type has nested types like `Mapping[str, int]`, items are converted to those types automatically. This in new in Robot Framework 6.0.

Examples: `{'a': 1, 'b': 2}`, `{'key': 1, 'nested': {'key': 2}}`

Accepts: string, Mapping

Used by: Get Cookie, Get Cookies, Wait For Request, Wait For Response

### Media

Kind: Enum

Changes the CSS media type of the page.

The only allowed values are 'screen', 'print' and `null`. Passing null disables CSS media emulation. Using False will not define media argument.

Members:

- `screen`
- `print`
- `null`

Accepts: string

Used by: Emulate Media

### MouseButton

Kind: Enum

Enum that defines which mouse button to use.

Members:

- `left`
- `middle`
- `right`

Accepts: string

Used by: Click, Click With Options, Mouse Button

### MouseButtonAction

Kind: Enum

Enum that defines which `Mouse Button` action to perform.

Members:

- `click`
- `down`
- `up`

Accepts: string

Used by: Mouse Button

### NewPageDetails

Kind: TypedDict

Return value of `New Page` keyword.

`page_id` is the UUID of the opened page. `video_path` path to the video or empty string if video is not created.

Keys:

- `page_id: str` (required)
- `video_path: str` (required)

Accepts: string, Mapping

Used by: Close Page, New Page, Switch Page

### None

Kind: Standard

String `NONE` (case-insensitive) and the empty string are converted to the Python `None` object. Other values cause an error.

Converting the empty string is new in Robot Framework 7.4.

Accepts: string

Used by: __init__, Add Cookie, Add Locator Handler Click, Add Locator Handler Custom, Click With Options, Close Browser Server, Crawl Site, Create Credential, Download, Emulate Media, Evaluate JavaScript, Get Aria Snapshot, Get Attribute, Get Attribute Names, Get BoundingBox, Get Browser Catalog, Get Browser Ids, Get Checkbox State, Get Classes, Get Client Size, Get Console Log, Get Context Ids, Get Credential, Get Download State, Get Element By Role, Get Element Count, Get Element States, Get Page Errors, Get Page Ids, Get Page Source, Get Property, Get Scroll Position, Get Scroll Size, Get Select Options, Get Selected Options, Get Style, Get Table Cell Index, Get Table Row Index, Get Text, Get Title, Get Url, Get Viewport Size, Go To, Grant Permissions, Hover, Http, Launch Browser Server, LocalStorage Clear, LocalStorage Get Item, LocalStorage Remove Item, LocalStorage Set Item, Merge Coverage Reports, Mouse Button, New Browser, New Context, New Page, New Persistent Context, Open Browser, Promise To Wait For Download, Record Keyword, Record Keywords, Record Selector, Register Keyword To Run On Failure, Reload, Save Storage State, Scroll By, Scroll To, SessionStorage Clear, SessionStorage Get Item, SessionStorage Remove Item, SessionStorage Set Item, Set Geolocation, Set Selector Prefix, Set Storage State, Show Keyword Banner, Start Coverage, Stop Coverage, Take Screenshot, Tap, Wait For Alert, Wait For Alerts, Wait For Condition, Wait For Elements State, Wait For Function, Wait For Load State, Wait For Navigation, Wait For Request, Wait For Response

### NotSet

Kind: Enum

Defines a value that is not set.

This is used to differentiate between a value that is set to None and a value that is not set at all. Example `ForcedColors` has an options active, none and null. If user does not not want to give any of the `ForcedColors` options, user can use not\_set value. Then keyword will not define `ForcedColors` option at all when underlying Playwright method(s) is called.

Members:

- `not_set`

Accepts: string

Used by: Emulate Media

### PageLoadStates

Kind: Enum

Enum that defines available page load states.

Members:

- `load`
- `domcontentloaded`
- `networkidle`
- `commit`

Accepts: string

Used by: Go To, New Page, Reload, Wait For Load State, Wait For Navigation

### Path

Kind: Standard

Strings are converted [Path](https://docs.python.org/library/pathlib.html) objects. On Windows `/` is converted to `\` automatically.

Examples: `/tmp/absolute/path`, `relative/path/to/file.ext`, `name.txt`

Accepts: string, PurePath

Used by: Merge Coverage Reports, New Context, New Persistent Context, Promise To Upload File, Save Page As Pdf, Save Storage State, Set Storage State, Start Coverage, Stop Coverage, Take Screenshot, Upload File By Selector

### PdfFormat

Kind: Enum

PDF format argument options are

Letter: 8.5in x 11in Legal: 8.5in x 14in Tabloid: 11in x 17in Ledger: 17in x 11in A0: 33.1in x 46.8in A1: 23.4in x 33.1in A2: 16.54in x 23.4in A3: 11.7in x 16.54in A4: 8.27in x 11.7in A5: 5.83in x 8.27in A6: 4.13in x 5.83in

Members:

- `Letter`
- `Legal`
- `Tabloid`
- `Ledger`
- `A0`
- `A1`
- `A2`
- `A3`
- `A4`
- `A5`
- `A6`

Accepts: string

Used by: Save Page As Pdf

### PdfMarging

Kind: TypedDict

Margins of the pdf.

Top margin, accepts values labeled with units. Defaults to 0px. Right margin, accepts values labeled with units. Defaults to 0px. Bottom margin, accepts values labeled with units. Defaults to 0px. Left margin, accepts values labeled with units. Defaults to 0px.

Keys:

- `top: str` (required)
- `right: str` (required)
- `bottom: str` (required)
- `left: str` (required)

Accepts: string, Mapping

Used by: Save Page As Pdf

### Permission

Kind: Enum

Enum that defines the permission to grant to a context.

See [grantPermissions(permissions)](https://playwright.dev/docs/api/class-browsercontext#browser-context-grant-permissions) for more details.

Members:

- `accelerometer`
- `accessibility-events`
- `accessibility_events`
- `ambient-light-sensor`
- `ambient_light_sensor`
- `background-sync`
- `background_sync`
- `camera`
- `clipboard-read`
- `clipboard_read`
- `clipboard-write`
- `clipboard_write`
- `geolocation`
- `gyroscope`
- `local-network-access`
- `local_network_access`
- `magnetometer`
- `midi`
- `midi-sysex`
- `midi_sysex`
- `microphone`
- `notifications`
- `payment-handler`
- `payment_handler`

Accepts: string

Used by: Grant Permissions, New Context, New Persistent Context

### PlaywrightLogTypes

Kind: Enum

Enable low level debug information from the playwright to playwright-log.txt file.

It is possible to disable the creation of playwright-log.txt totally. Mainly useful for the library developers and for debugging purposes. Will log everything as plain text, also including secrets. If playwright-log.txt file can not be deleted, time.time\_ns() is added at the end of file name. Example playwright-log-12345.txt

`disabled`: playwright-log.txt is not created at all. All node side logging is lost. `library`: Default, only logging from Browser library node side is written to the playwright-log.txt file. `playwright`: Also includes Playwright log messages to the playwright-log.txt file. `false`: Same as library and for backwards compatability. `true`: Same as playwright and for backwards compatibility.

Members:

- `disabled`
- `library`
- `playwright`
- `false`
- `true`

Accepts: string

Used by: __init__

### Proxy

Kind: TypedDict

Network proxy settings.

`server` Proxy to be used for all requests. HTTP and SOCKS proxies are supported, for example [http://myproxy.com:3128](http://myproxy.com:3128) or [socks5://myproxy.com:3128](socks5://myproxy.com:3128). Short form myproxy.com:3128 is considered an HTTP proxy.

`bypass` **Optional** coma-separated domains to bypass proxy, for example ".com, chromium.org, .domain.com".

`username` **Optional** username to use if HTTP proxy requires authentication.

`password` **Optional** password to use if HTTP proxy requires authentication.

Keys:

- `server: str` (required)
- `bypass: str`
- `username: str | robot.utils.secret.Secret`
- `password: str | robot.utils.secret.Secret`

Accepts: string, Mapping

Used by: Launch Browser Server, New Browser, New Context, New Persistent Context

### RecordHar

Kind: TypedDict

Enables HAR recording for all pages into to a file.

If not specified, the HAR is not recorded. Make sure to await context to close for the [HAR](http://www.softwareishard.com/blog/har-12-spec/) to be saved.

omitContent: Optional setting to control whether to omit request content from the HAR. Default is False

`path`: Path on the filesystem to write the HAR file to. A relative path is relative to the output directory.

Example:

```robotframework
${har} =    Create Dictionary     path=/path/to/har.file    omitContent=True
New Context    recordHar=${har}
```

Keys:

- `omitContent: bool`
- `path: str`

Accepts: string, Mapping

Used by: New Context, New Persistent Context

### RecordVideo

Kind: TypedDict

Enables Video recording

| Key | Description |
| --- | --- |
| `dir` | Folder of the videos. |
| `size` | `ViewportDimensions` of the videos. |
| `fps` | Frame rate of the videos. Defaults to 25. Firefox and WebKit record at most 25 frames per second. |
| `showActions` | Annotates the interacted elements in the videos, with the keys below. |

Keys of `showActions`:

| Key | Description |
| --- | --- |
| `duration` | How long each annotation is shown, in milliseconds. Defaults to 500. |
| `position` | Position of the action title: `top-left`, `top`, `top-right` (default), `bottom-left`, `bottom` or `bottom-right`. |
| `cursor` | `pointer` (default) shows a mouse pointer that moves from one action point to the next, `none` shows no cursor. |
| `style` | CSS declarations of the annotations: `point` for the marker on the action point and `highlight` for the box over the element, both shown only when given, and `title` for the action title. |

Examples:

```robotframework
 New Context  recordVideo={'dir':'videos', 'size':{'width':400, 'height':200}}
 New Context  recordVideo={'dir': 'd:/automation/video'}
 New Context  recordVideo={'showActions': {'position': 'bottom', 'style': {'title': 'font-size: 32px'}}}
```

Keys:

- `dir: str`
- `size: ViewportDimensions`
- `fps: int`
- `showActions: ShowActions`

Accepts: string, Mapping

Used by: New Context, New Persistent Context

### ReducedMotion

Kind: Enum

Emulates 'prefers-reduced-motion' media feature.

Supported values are 'reduce', 'no-preference' and `null`. Passing `null` disables reduced motion emulation.

Members:

- `reduce`
- `no_preference`
- `null`

Accepts: string

Used by: Emulate Media

### ReduceMotion

Kind: Enum

Emulates prefers-reduced-motion media feature, supported values are reduce, no-preference.

Members:

- `reduce`
- `no_preference`

Accepts: string

Used by: New Context, New Persistent Context

### RegExp

Kind: Custom

Create a (JavaScript) RegExp object from a string.

The matcher must start with a slash and end with a slash and can be followed by flags.

Example: `/hello world/gi` Which is equivalent to `new RegExp("hello world", "gi")` in JavaScript.

Following flags are supported:

| Flag | Description |
| --- | --- |
| g | Global search. |
| i | Case-insensitive search. |
| m | Allows `^` and `$` to match newline characters. |
| s | Allows `.` to match newline characters. |
| u | "unicode"; treat a pattern as a sequence of unicode code points. |
| y | Perform a "sticky" search that matches starting at the current position in the target string. |

See [RegExp Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp) and [RegExp Guide](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions) for more information.

Accepts: string

Used by: Get Element By, Get Element By Role, Wait For Navigation, Wait For Request, Wait For Response

### ReloadPages

Kind: Enum

Defines which pages `Set Storage State` reloads while it restores the state.

Restoring a state file that contains IndexedDB does not finish while a page of the context holds an open connection to a database of that origin. To get around that, the pages are navigated to `about:blank`, the state is restored, and they are navigated back to the url they had before.

`affected`: Reloads the pages whose origin has IndexedDB in the state file. `none`: Reloads nothing. The keyword fails immediately when it detects an open connection which would block the restore. `all`: Reloads every page of the context.

Members:

- `affected`
- `none`
- `all`

Accepts: string

Used by: Set Storage State

### RequestMethod

Kind: Enum

Enum that defines the request type.

Members:

- `HEAD`
- `DELETE`
- `GET`
- `PATCH`
- `POST`
- `PUT`

Accepts: string

Used by: Http

### Scale

Kind: Enum

Enum that defines the scale of the screenshot.

When set to "css", screenshot will have a single pixel per each css pixel on the page. For high-dpi devices, this will keep screenshots small. Using "device" option will produce a single pixel per each device pixel, so screenshots of high-dpi devices will be twice as large or even larger.

Members:

- `css`
- `device`

Accepts: string

Used by: Take Screenshot

### Scope

Kind: Enum

Some keywords which manipulates library settings have a scope argument. With that scope argument one can set the "live time" of that setting. Available Scopes are: `Global`, `Suite` and `Test` / `Task`. Is a scope finished, this scoped setting, like timeout, will no longer be used and the previous higher scope setting applies again.

Live Times:

-   A `Global` scope will live forever until it is overwritten by another Global scope. Or locally temporarily overridden by a more narrow scope.
-   A `Suite` scope will locally override the Global scope and live until the end of the Suite within it is set, or if it is overwritten by a later setting with Global or same scope. Children suite does inherit the setting from the parent suite but also may have its own local Suite setting that then will be inherited to its children suites.
-   A `Test` or `Task` scope will be inherited from its parent suite but when set, lives until the end of that particular test or task.

A new set higher order scope will always remove the lower order scope which may be in charge. So the setting of a Suite scope from a test, will set that scope to the robot file suite where that test is and removes the Test scope that may have been in place.

Members:

- `Global`
- `Suite`
- `Test`
- `Task`

Accepts: string

Used by: Register Keyword To Run On Failure, Set Assertion Formatters, Set Browser Timeout, Set Highlight On Failure, Set Retry Assertions For, Set Selector Prefix, Set Strict Mode, Show Keyword Banner

### ScreenshotFileTypes

Kind: Enum

Enum that defines available file types for screenshots.

Members:

- `png`
- `jpeg`

Accepts: string

Used by: Take Screenshot

### ScreenshotReturnType

Kind: Enum

Enum that defines what `Take Screenshot` keyword returns.

-   `path` returns the path to the screenshot file as `pathlib.Path` object.
-   `path_string` returns the path to the screenshot file as string.
-   `bytes` returns the screenshot itself as bytes.
-   `base64` returns the screenshot itself as base64 encoded string.

Members:

- `path`
- `path_string`
- `bytes`
- `base64`

Accepts: string

Used by: Take Screenshot

### ScrollBehavior

Kind: Enum

Enum that controls the behavior of scrolling.

`smooth`

Members:

- `auto`
- `smooth`

Accepts: string

Used by: Scroll By, Scroll To

### ScrollPosition

Kind: TypedDict

Scroll position of an element.

| Key | Description |
| --- | --- |
| `top` | The amount of pixel between the top border of the page and the top border of visible area. |
| `left` | The amount of pixel between the left border of the page and the left border of visible area. |
| `bottom` | The amount of pixel between the top border of the page and the bottom border of visible area. |
| `right` | The amount of pixel between the left border of the page and the right border of visible area. |

Keys:

- `top: float` (required)
- `left: float` (required)
- `bottom: float` (required)
- `right: float` (required)

Accepts: string, Mapping

Used by: Get Scroll Position

### Secret

Kind: Standard

Encapsulates secret values to avoid them being shown in Robot Framework logs.

The value is required to be [robot.api.types.Secret](https://robot-framework.readthedocs.io/en/master/autodoc/robot.utils.html#robot.utils.secret.Secret) object. These objects encapsulate confidential values so that they are not exposed in log files. How to create them is explained in the [User Guide](https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#secret-variables).

New in Robot Framework 7.4.

Accepts: string

Used by: Create Credential, Fill Secret, Type Secret

### SelectAttribute

Kind: Enum

Enum that defines the attribute of an <option> element in a <select>-list.

This defines by what attribute an option is selected/chosen.

```robotframework
<select class="my_drop_down">
  <option value="0: Object">None</option>
  <option value="1: Object">Some</option>
  <option value="2: Object">Other</option>
</select>
```

`value` of the first option would be `0: Object`.

`label` / `text` both defines the innerText which would be `None` for first element.

`index` 0 indexed number of an option. Would be `0` for the first element.

Members:

- `value`
- `label`
- `text`
- `index`

Accepts: string

Used by: Get Selected Options, Select Options By

### SelectionStrategy

Kind: Enum

SelectionStrategy to be used. Refers to Playwrights `page.getBy***` functions. See [Playwright Locators](https://playwright.dev/docs/locators)

#### AltText

All images should have an alt attribute that describes the image. You can locate an image based on the text alternative using page.getByAltText().

For example, consider the following DOM structure.

```robotframework
<img alt="playwright logo" src="/img/playwright-logo.svg" width="100" />
```

#### Label

Allows locating input elements by the text of the associated `<label>` or `aria-labelledby` element, or by the `aria-label` attribute.

For example, this method will find inputs by label "Username" and "Password" in the following DOM:

```robotframework
<input aria-label="Username">
<label for="password-input">Password:</label>
<input id="password-input">
```

#### Placeholder

Allows locating input elements by the placeholder text.

Example:

```robotframework
<input type="email" placeholder="name@example.com" />
```

#### TestId

Locate element by the test id.

Currently only the exact attribute `data-testid` is supported.

Example:

```robotframework
<button data-testid="directions">Itinéraire</button>
```

#### Text

Allows locating elements that contain given text.

Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one, turns line breaks into spaces and ignores leading and trailing whitespace. Input elements of the type button and submit are matched by their value instead of the text content. For example, locating by text "Log in" matches <input type=button value="Log in">.

#### Title

Allows locating elements by their title attribute.

Example:

```robotframework
<img alt="playwright logo" src="/img/playwright-logo.svg" title="Playwright" width="100" />
```

Members:

- `AltText`
- `Label`
- `Placeholder`
- `TestID`
- `Text`
- `Title`

Accepts: string

Used by: Get Element By

### SelectionType

Kind: Enum

Enum that defines if the current id or all ids shall be returned.

`ACTIVE` / `CURRENT` defines to return only the id of the currently active instance of a Browser/Context/Page.

`ALL` / `ANY` defines to return ids of all instances.

Members:

- `CURRENT`
- `ACTIVE`
- `ALL`
- `ANY`

Accepts: string

Used by: Close Browser, Close Context, Close Page, Get Browser Ids, Get Context Ids, Get Page Ids, Switch Context, Switch Page

### SelectOptions

Kind: TypedDict

Dictionary with the following keys and their values "index", "value", "label" and "selected".

| Keys | Description |
| --- | --- |
| `index` | 0 based index of the option. |
| `value` | Value attribute of the option. |
| `label` | Label/Text of the option. |
| `selected` | Boolean if the option is selected. |

Keys:

- `index: int` (required)
- `value: str` (required)
- `label: str` (required)
- `selected: bool` (required)

Accepts: string, Mapping

Used by: Get Select Options

### SelectorGenerator

Kind: Enum

How `Record Selector` writes the selector of the picked element.

`playwright`: Playwright's own selector, the one its codegen and `Record Keyword` use: role, text, label, placeholder or test id where they identify the element, written in Browser selector syntax, for example `role=button[name="Save"s]`.

`css`: A CSS selector built from ids, classes, attributes and the element's position, for example `#login > div.form > button:nth-child(2)`. Frames are joined with `>>>` and open shadow roots with `>>`.

Members:

- `playwright`
- `css`

Accepts: string

Used by: Record Selector

### ServiceWorkersPermissions

Kind: Enum

Whether to allow sites to register Service workers.

`allow`: Service Workers can be registered.

`block`: Playwright will block all registration of Service Workers.

Members:

- `allow`
- `block`

Accepts: string

Used by: New Context, New Persistent Context

### SizeFields

Kind: Enum

Enum that defines how the returned size is filtered.

`ALL` defines that the size is returned as a dictionary. `{'width': <float>, 'height': <float>}.`

`width` / `height` will return a single float value of the chosen dimension.

Members:

- `width`
- `height`
- `ALL`

Accepts: string

Used by: Get Client Size, Get Scroll Size, Get Viewport Size

### string

Kind: Standard

All arguments are converted to Unicode strings.

Most values are converted simply by using `str(value)`. An exception is that bytes are mapped directly to Unicode code points with same ordinals. This means that, for example, `b"hyv\xe4"` becomes `"hyvä"`.

Converting bytes specially is new Robot Framework 7.4.

Accepts: Any

Used by: __init__, Add Cookie, Add Locator Handler Click, Add Locator Handler Custom, Add Style Tag, Cancel Download, Check Checkbox, Clear Text, Click, Click With Options, Close Browser, Close Browser Server, Close Context, Close Page, Connect To Browser, Crawl Site, Create Credential, Delete Credential, Deselect Options, Download, Drag And Drop, Drag And Drop Relative To, Evaluate JavaScript, Fill Secret, Fill Text, Focus, Get Aria Snapshot, Get Attribute, Get Attribute Names, Get BoundingBox, Get Browser Catalog, Get Browser Ids, Get Checkbox State, Get Classes, Get Client Size, Get Console Log, Get Context Ids, Get Cookie, Get Cookies, Get Credential, Get Device, Get Download State, Get Element, Get Element By, Get Element By Role, Get Element Count, Get Element States, Get Elements, Get Page Errors, Get Page Ids, Get Page Source, Get Property, Get Scroll Position, Get Scroll Size, Get Select Options, Get Selected Options, Get Style, Get Table Cell Element, Get Table Cell Index, Get Table Row Index, Get Text, Get Title, Get Url, Get Viewport Size, Go To, Grant Permissions, Handle Future Dialogs, Highlight Elements, Hover, Http, Keyboard Input, Keyboard Key, Launch Browser Server, LocalStorage Clear, LocalStorage Get Item, LocalStorage Remove Item, LocalStorage Set Item, Merge Coverage Reports, Mouse Move Relative To, New Browser, New Context, New Page, New Persistent Context, Open Browser, Press Keys, Promise To, Promise To Wait For Download, Record Keyword, Record Keywords, Record Selector, Register Keyword To Run On Failure, Remove Locator Handler, Save Page As Pdf, Save Storage State, Scroll By, Scroll To, Scroll To Element, Select Options By, SessionStorage Clear, SessionStorage Get Item, SessionStorage Remove Item, SessionStorage Set Item, Set Assertion Formatters, Set Browser Timeout, Set Retry Assertions For, Set Selector Prefix, Show Keyword Banner, Start Coverage, Switch Browser, Switch Context, Switch Page, Take Screenshot, Tap, Type Secret, Type Text, Uncheck Checkbox, Upload File By Selector, Wait For Alert, Wait For Alerts, Wait For Condition, Wait For Elements State, Wait For Function, Wait For Navigation, Wait For Request, Wait For Response

### SupportedBrowsers

Kind: Enum

Defines which browser shall be started.

| Browser | Browser with this engine |
| --- | --- |
| `chromium` | Google Chrome, Microsoft Edge (since 2020), Opera |
| `firefox` | Mozilla Firefox |
| `webkit` | Apple Safari, Mail, AppStore on MacOS and iOS |

Since [Playwright](https://github.com/microsoft/playwright) comes with a pack of builtin binaries for all browsers, no additional drivers e.g. geckodriver are needed.

All these browsers that cover more than 85% of the world wide used browsers, can be tested on Windows, Linux and MacOS. Theres is not need for dedicated machines anymore.

Members:

- `chromium`
- `firefox`
- `webkit`

Accepts: string

Used by: __init__, Connect To Browser, Launch Browser Server, New Browser, New Context, New Persistent Context, Open Browser

### TextType

Kind: Enum

Defines which Playwright method is used to get the text of an element.

`allInnerTexts`: Returns a list of node.innerText values for all matching nodes.

`allTextContents`: Returns a list of node.textContent values for all matching nodes.

`innerText`: Returns the element node.innerText value, which represents the rendered text content of a node and its descendants.

`inputValue`: Returns the value for the matching <input> or <textarea> or <select> element.

`innerHTML`: Returns the element node.innerHTML value, which is the HTML markup contained within the element, omitting any shadow roots.

Members:

- `allInnerTexts`
- `allTextContents`
- `innerText`
- `inputValue`
- `innerHTML`

Accepts: string

Used by: Get Text

### timedelta

Kind: Standard

Strings are expected to represent a time interval in one of the time formats Robot Framework supports:

-   a number representing seconds like `42` or `10.5`
-   a time string like `1 hour 2 seconds` or `1h 2s`
-   a "timer" string like `01:02` (1 minute 2 seconds) or `01:00:03` (1 hour 3 seconds)

Integers and floats are considered to be seconds.

See the [Robot Framework User Guide](https://robotframework.org/robotframework/) for more details about the supported time formats.

Accepts: string, integer, float

Used by: __init__, Advance Clock, Click With Options, Connect To Browser, Download, Get Console Log, Get Page Errors, Go To, Highlight Elements, Keyboard Input, Keyboard Key, Launch Browser Server, Mouse Button, New Browser, New Persistent Context, Press Keys, Promise To Wait For Download, Record Keyword, Record Keywords, Record Selector, Reload, Set Browser Timeout, Set Retry Assertions For, Set Storage State, Take Screenshot, Type Secret, Type Text, Wait For Alert, Wait For Alerts, Wait For Condition, Wait For Elements State, Wait For Function, Wait For Load State, Wait For Navigation, Wait For Request, Wait For Response

### TracingGroupMode

Kind: Enum

Defines in what detail level keywords are written to Playwright trace.

Playwrright trace is a full log of all playwright actions and events that happen in the browser during the test run. This includes all API calls, events, logs, network requests, and responses as well as the DOM at every moment during execution. This trace can be activated with the `tracing` parameter of `New Context` keyword.

-   `Full` All keyword calls are written to trace as groups even if they do not call Browser keywords.
-   `Browser` Just Browser library keywords are written to the logs as groups.
-   `Playwright` No additional keywords are logged, just the Playwright API calls.

Members:

- `Full`
- `Browser`
- `Playwright`

Accepts: string

Used by: __init__

### tuple

Kind: Standard

Strings must be Python [tuple](https://docs.python.org/library/stdtypes.html#tuple) or [list](https://docs.python.org/library/stdtypes.html#list) literals. They are converted using the [ast.literal\_eval](https://docs.python.org/library/ast.html#ast.literal_eval) function and possible lists converted further to tuples. They can contain any values `ast.literal_eval` supports, including tuples and other collections.

If the argument is a tuple, it is used without conversion. Lists and other sequences are converted to tuples.

If the type has nested types like `tuple[str, int, int]`, items are converted to those types automatically.

Examples: `('one', 'two')`, `(('one', 1), ('two', 2))`

Support to convert nested types is new in Robot Framework 6.0. Support for list literals is new in Robot Framework 7.4.

Accepts: string, Sequence

Used by: Get Aria Snapshot, Get Attribute, Get Page Source, Get Style, Get Text, Get Title, Get Url, Get Viewport Size

### ViewportDimensions

Kind: TypedDict

Viewport dimensions.

Viewport is the browsers inner window size that is used to display the page.

| Key | Description |
| --- | --- |
| `width` | page width in pixels. |
| `height` | page height in pixels. |

Keys:

- `width: int` (required)
- `height: int` (required)

Accepts: string, Mapping

Used by: Get Viewport Size, New Context, New Persistent Context
