robotframework-plugins 2026.11.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- robotframework_plugins/__init__.py +14 -0
- robotframework_plugins/_assets/catalog.json +143 -0
- robotframework_plugins/_assets/plugins/rf-agentskills/.claude-plugin/plugin.json +25 -0
- robotframework_plugins/_assets/plugins/rf-agentskills/CHANGELOG.md +198 -0
- robotframework_plugins/_assets/plugins/rf-agentskills/README.md +27 -0
- robotframework_plugins/_assets/plugins/rf-agentskills/catalog.yaml +25 -0
- robotframework_plugins/_assets/plugins/rf-api/.claude-plugin/plugin.json +25 -0
- robotframework_plugins/_assets/plugins/rf-api/CHANGELOG.md +9 -0
- robotframework_plugins/_assets/plugins/rf-api/README.md +27 -0
- robotframework_plugins/_assets/plugins/rf-api/catalog.yaml +27 -0
- robotframework_plugins/_assets/plugins/rf-api/skills/rf-requests/SKILL.md +113 -0
- robotframework_plugins/_assets/plugins/rf-api/skills/rf-requests/assets/examples/authentication-patterns.robot +39 -0
- robotframework_plugins/_assets/plugins/rf-api/skills/rf-requests/assets/examples/basic-crud.robot +46 -0
- robotframework_plugins/_assets/plugins/rf-api/skills/rf-requests/assets/examples/file-upload.robot +28 -0
- robotframework_plugins/_assets/plugins/rf-api/skills/rf-requests/assets/examples/session-handling.robot +48 -0
- robotframework_plugins/_assets/plugins/rf-api/skills/rf-requests/references/async-jobs.md +42 -0
- robotframework_plugins/_assets/plugins/rf-api/skills/rf-requests/references/authentication.md +58 -0
- robotframework_plugins/_assets/plugins/rf-api/skills/rf-requests/references/install.md +10 -0
- robotframework_plugins/_assets/plugins/rf-api/skills/rf-requests/references/loose-assertions.md +20 -0
- robotframework_plugins/_assets/plugins/rf-api/skills/rf-requests/references/request-options.md +90 -0
- robotframework_plugins/_assets/plugins/rf-api/skills/rf-requests/references/response-validation.md +64 -0
- robotframework_plugins/_assets/plugins/rf-api/skills/rf-requests/references/troubleshooting.md +64 -0
- robotframework_plugins/_assets/plugins/rf-api/skills/rf-restinstance/SKILL.md +120 -0
- robotframework_plugins/_assets/plugins/rf-api/skills/rf-restinstance/assets/examples/basic-rest.robot +51 -0
- robotframework_plugins/_assets/plugins/rf-api/skills/rf-restinstance/assets/examples/schema-validation.robot +38 -0
- robotframework_plugins/_assets/plugins/rf-api/skills/rf-restinstance/assets/examples/schemas/user.json +10 -0
- robotframework_plugins/_assets/plugins/rf-api/skills/rf-restinstance/references/authentication.md +61 -0
- robotframework_plugins/_assets/plugins/rf-api/skills/rf-restinstance/references/install.md +11 -0
- robotframework_plugins/_assets/plugins/rf-api/skills/rf-restinstance/references/json-handling.md +89 -0
- robotframework_plugins/_assets/plugins/rf-api/skills/rf-restinstance/references/loose-assertions.md +18 -0
- robotframework_plugins/_assets/plugins/rf-api/skills/rf-restinstance/references/migrate-from-requests.md +15 -0
- robotframework_plugins/_assets/plugins/rf-api/skills/rf-restinstance/references/schema-validation.md +85 -0
- robotframework_plugins/_assets/plugins/rf-api/skills/rf-restinstance/references/troubleshooting.md +68 -0
- robotframework_plugins/_assets/plugins/rf-core/.claude-plugin/plugin.json +19 -0
- robotframework_plugins/_assets/plugins/rf-core/CHANGELOG.md +13 -0
- robotframework_plugins/_assets/plugins/rf-core/README.md +38 -0
- robotframework_plugins/_assets/plugins/rf-core/agents/rf-debug-expert.md +120 -0
- robotframework_plugins/_assets/plugins/rf-core/agents/rf-migration-guide.md +73 -0
- robotframework_plugins/_assets/plugins/rf-core/agents/rf-test-architect.md +98 -0
- robotframework_plugins/_assets/plugins/rf-core/catalog.yaml +19 -0
- robotframework_plugins/_assets/plugins/rf-core/hooks/README.md +445 -0
- robotframework_plugins/_assets/plugins/rf-core/hooks/hooks.json +70 -0
- robotframework_plugins/_assets/plugins/rf-core/scripts/_hook_input.mjs +101 -0
- robotframework_plugins/_assets/plugins/rf-core/scripts/_pending_errors.mjs +65 -0
- robotframework_plugins/_assets/plugins/rf-core/scripts/_python_env.mjs +181 -0
- robotframework_plugins/_assets/plugins/rf-core/scripts/check_rf_environment.mjs +181 -0
- robotframework_plugins/_assets/plugins/rf-core/scripts/maybe_inject_rf_context.mjs +74 -0
- robotframework_plugins/_assets/plugins/rf-core/scripts/maybe_remind_robot_tests.mjs +128 -0
- robotframework_plugins/_assets/plugins/rf-core/scripts/report_pending_errors.mjs +72 -0
- robotframework_plugins/_assets/plugins/rf-core/scripts/rf_error_hints.mjs +126 -0
- robotframework_plugins/_assets/plugins/rf-core/scripts/validate_robot.mjs +517 -0
- robotframework_plugins/_assets/plugins/rf-core/scripts/validate_robot_project.mjs +103 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/SKILL.md +313 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/assets/examples/resources/api.resource +30 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/assets/examples/resources/calc.resource +23 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/assets/examples/resources/embedded.resource +20 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/assets/examples/resources/keywords.resource +26 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/assets/examples/resources/login.resource +10 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/assets/examples/tests/01__keyword_driven.robot +15 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/assets/examples/tests/02__data_driven.robot +10 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/assets/examples/tests/03__templates.robot +17 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/assets/examples/tests/04__bdd.robot +10 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/assets/examples/tests/05__embedded.robot +13 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/assets/examples/tests/__init__.robot +6 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/assets/examples/tests/api/__init__.robot +7 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/assets/examples/tests/api/users.robot +18 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/assets/examples/tests/env.robot +15 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/assets/examples/variables/common.py +11 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/assets/examples/variables/dev.yaml +3 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/assets/examples/variables/staging.yaml +3 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/references/arguments.md +139 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/references/control-structures.md +175 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/references/embedded-arguments.md +135 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/references/migration.md +90 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/references/resources-and-variable-files.md +127 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/references/styles.md +92 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/references/suites-and-init.md +96 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/references/tags-and-selection.md +104 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/references/templates.md +124 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/references/variables-and-scopes.md +129 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/scripts/rf_conventions.py +883 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-python-library/SKILL.md +216 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-python-library/assets/examples/ExampleLibrary.py +61 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-python-library/assets/examples/ResultListener.py +60 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-python-library/assets/examples/converters.py +48 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-python-library/assets/examples/converters.robot +20 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-python-library/assets/examples/example_library.robot +31 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-python-library/assets/examples/listener.robot +12 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-python-library/references/api-variants.md +291 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-python-library/references/communication.md +248 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-python-library/references/conversion.md +347 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-python-library/references/listeners.md +150 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-python-library/references/packaging-and-docs.md +155 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-python-library/scripts/check_library.py +842 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-setup/SKILL.md +159 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-setup/assets/examples/github-actions-robot.yml +32 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-setup/assets/examples/gitignore.txt +22 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-setup/assets/examples/pyproject.poetry.toml +28 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-setup/assets/examples/pyproject.uv.toml +20 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-setup/assets/examples/requirements.txt +9 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-setup/assets/examples/robot.toml +16 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-setup/assets/examples/smoke.robot +22 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-setup/references/ci.md +61 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-setup/references/cli-tools.md +33 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-setup/references/libraries.md +47 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-setup/references/poetry.md +77 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-setup/references/project-layout.md +86 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-setup/references/troubleshooting.md +73 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-setup/references/uv.md +108 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-setup/references/venv-pip.md +71 -0
- robotframework_plugins/_assets/plugins/rf-core/variants/codex/agents/rf-debug-expert.toml +119 -0
- robotframework_plugins/_assets/plugins/rf-core/variants/codex/agents/rf-migration-guide.toml +72 -0
- robotframework_plugins/_assets/plugins/rf-core/variants/codex/agents/rf-test-architect.toml +97 -0
- robotframework_plugins/_assets/plugins/rf-core/variants/opencode/agents/rf-debug-expert.md +123 -0
- robotframework_plugins/_assets/plugins/rf-core/variants/opencode/agents/rf-migration-guide.md +76 -0
- robotframework_plugins/_assets/plugins/rf-core/variants/opencode/agents/rf-test-architect.md +101 -0
- robotframework_plugins/_assets/plugins/rf-core/variants/opencode/plugins/rf-core.js +93 -0
- robotframework_plugins/_assets/plugins/rf-desktop/.claude-plugin/plugin.json +24 -0
- robotframework_plugins/_assets/plugins/rf-desktop/CHANGELOG.md +10 -0
- robotframework_plugins/_assets/plugins/rf-desktop/README.md +26 -0
- robotframework_plugins/_assets/plugins/rf-desktop/catalog.yaml +23 -0
- robotframework_plugins/_assets/plugins/rf-desktop/skills/rf-platynui/SKILL.md +268 -0
- robotframework_plugins/_assets/plugins/rf-desktop/skills/rf-platynui/assets/examples/calculator.robot +45 -0
- robotframework_plugins/_assets/plugins/rf-desktop/skills/rf-platynui/assets/examples/mock-deterministic.robot +33 -0
- robotframework_plugins/_assets/plugins/rf-desktop/skills/rf-platynui/references/cli-and-inspector.md +82 -0
- robotframework_plugins/_assets/plugins/rf-desktop/skills/rf-platynui/references/install.md +14 -0
- robotframework_plugins/_assets/plugins/rf-desktop/skills/rf-platynui/references/keywords-reference.md +102 -0
- robotframework_plugins/_assets/plugins/rf-desktop/skills/rf-platynui/references/locators-and-queries.md +95 -0
- robotframework_plugins/_assets/plugins/rf-desktop/skills/rf-platynui/references/platform-setup.md +65 -0
- robotframework_plugins/_assets/plugins/rf-desktop/skills/rf-platynui/references/status-and-migration.md +41 -0
- robotframework_plugins/_assets/plugins/rf-mobile/.claude-plugin/plugin.json +24 -0
- robotframework_plugins/_assets/plugins/rf-mobile/CHANGELOG.md +9 -0
- robotframework_plugins/_assets/plugins/rf-mobile/README.md +26 -0
- robotframework_plugins/_assets/plugins/rf-mobile/catalog.yaml +23 -0
- robotframework_plugins/_assets/plugins/rf-mobile/skills/rf-appium/SKILL.md +134 -0
- robotframework_plugins/_assets/plugins/rf-mobile/skills/rf-appium/assets/examples/android-basic.robot +60 -0
- robotframework_plugins/_assets/plugins/rf-mobile/skills/rf-appium/assets/examples/gestures-example.robot +59 -0
- robotframework_plugins/_assets/plugins/rf-mobile/skills/rf-appium/assets/examples/hybrid-app.robot +54 -0
- robotframework_plugins/_assets/plugins/rf-mobile/skills/rf-appium/assets/examples/ios-basic.robot +48 -0
- robotframework_plugins/_assets/plugins/rf-mobile/skills/rf-appium/references/capabilities.md +117 -0
- robotframework_plugins/_assets/plugins/rf-mobile/skills/rf-appium/references/gestures-touch.md +84 -0
- robotframework_plugins/_assets/plugins/rf-mobile/skills/rf-appium/references/install.md +21 -0
- robotframework_plugins/_assets/plugins/rf-mobile/skills/rf-appium/references/locators-mobile.md +74 -0
- robotframework_plugins/_assets/plugins/rf-mobile/skills/rf-appium/references/platform-specific.md +105 -0
- robotframework_plugins/_assets/plugins/rf-mobile/skills/rf-appium/references/troubleshooting.md +70 -0
- robotframework_plugins/_assets/plugins/rf-web/.claude-plugin/plugin.json +25 -0
- robotframework_plugins/_assets/plugins/rf-web/CHANGELOG.md +9 -0
- robotframework_plugins/_assets/plugins/rf-web/README.md +27 -0
- robotframework_plugins/_assets/plugins/rf-web/catalog.yaml +27 -0
- robotframework_plugins/_assets/plugins/rf-web/skills/rf-browser/SKILL.md +134 -0
- robotframework_plugins/_assets/plugins/rf-web/skills/rf-browser/assets/examples/authentication-flow.robot +34 -0
- robotframework_plugins/_assets/plugins/rf-web/skills/rf-browser/assets/examples/basic-web-test.robot +29 -0
- robotframework_plugins/_assets/plugins/rf-web/skills/rf-browser/assets/examples/form-handling.robot +49 -0
- robotframework_plugins/_assets/plugins/rf-web/skills/rf-browser/assets/examples/iframe-shadow-dom.robot +31 -0
- robotframework_plugins/_assets/plugins/rf-web/skills/rf-browser/references/assertion-engine.md +79 -0
- robotframework_plugins/_assets/plugins/rf-web/skills/rf-browser/references/authentication-storage.md +86 -0
- robotframework_plugins/_assets/plugins/rf-web/skills/rf-browser/references/browser-context-page.md +110 -0
- robotframework_plugins/_assets/plugins/rf-web/skills/rf-browser/references/downloads-uploads.md +51 -0
- robotframework_plugins/_assets/plugins/rf-web/skills/rf-browser/references/iframes-shadow-dom.md +67 -0
- robotframework_plugins/_assets/plugins/rf-web/skills/rf-browser/references/install.md +67 -0
- robotframework_plugins/_assets/plugins/rf-web/skills/rf-browser/references/locators.md +83 -0
- robotframework_plugins/_assets/plugins/rf-web/skills/rf-browser/references/migrate-from-selenium.md +22 -0
- robotframework_plugins/_assets/plugins/rf-web/skills/rf-browser/references/selector-drift.md +29 -0
- robotframework_plugins/_assets/plugins/rf-web/skills/rf-browser/references/troubleshooting.md +100 -0
- robotframework_plugins/_assets/plugins/rf-web/skills/rf-selenium/SKILL.md +123 -0
- robotframework_plugins/_assets/plugins/rf-web/skills/rf-selenium/assets/examples/basic-web-test.robot +64 -0
- robotframework_plugins/_assets/plugins/rf-web/skills/rf-selenium/assets/examples/multi-window.robot +55 -0
- robotframework_plugins/_assets/plugins/rf-web/skills/rf-selenium/assets/examples/wait-patterns.robot +53 -0
- robotframework_plugins/_assets/plugins/rf-web/skills/rf-selenium/references/browser-setup.md +103 -0
- robotframework_plugins/_assets/plugins/rf-web/skills/rf-selenium/references/frames-windows.md +84 -0
- robotframework_plugins/_assets/plugins/rf-web/skills/rf-selenium/references/install.md +12 -0
- robotframework_plugins/_assets/plugins/rf-web/skills/rf-selenium/references/javascript-execution.md +65 -0
- robotframework_plugins/_assets/plugins/rf-web/skills/rf-selenium/references/locators.md +86 -0
- robotframework_plugins/_assets/plugins/rf-web/skills/rf-selenium/references/troubleshooting.md +122 -0
- robotframework_plugins/_assets/plugins/rf-web/skills/rf-selenium/references/waiting-strategies.md +84 -0
- robotframework_plugins/_assets.py +120 -0
- robotframework_plugins/_catalog.py +123 -0
- robotframework_plugins/_snapshot.py +320 -0
- robotframework_plugins/adapters/__init__.py +53 -0
- robotframework_plugins/adapters/_base.py +400 -0
- robotframework_plugins/adapters/claude_code.py +312 -0
- robotframework_plugins/adapters/claude_desktop.py +129 -0
- robotframework_plugins/adapters/codex.py +276 -0
- robotframework_plugins/adapters/copilot.py +87 -0
- robotframework_plugins/adapters/cursor.py +295 -0
- robotframework_plugins/adapters/goose.py +240 -0
- robotframework_plugins/adapters/opencode.py +170 -0
- robotframework_plugins/bundle.py +85 -0
- robotframework_plugins/cli.py +1311 -0
- robotframework_plugins/detect.py +121 -0
- robotframework_plugins/manifest.py +338 -0
- robotframework_plugins/py.typed +0 -0
- robotframework_plugins/skillzip.py +39 -0
- robotframework_plugins/transforms.py +725 -0
- robotframework_plugins-2026.11.0.dist-info/METADATA +198 -0
- robotframework_plugins-2026.11.0.dist-info/RECORD +199 -0
- robotframework_plugins-2026.11.0.dist-info/WHEEL +4 -0
- robotframework_plugins-2026.11.0.dist-info/entry_points.txt +2 -0
- robotframework_plugins-2026.11.0.dist-info/licenses/LICENSE +201 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rf-browser
|
|
3
|
+
description: "Use first, before answering, for RF web tests with Browser Library (Playwright): selectors."
|
|
4
|
+
license: Apache-2.0
|
|
5
|
+
compatibility: Requires Python 3.10+, robotframework>=7, robotcode[all]>=2.8 and robotframework-browser in the project environment. Node.js 22+ LTS only when the robotframework-browser[bb] batteries extra is not used. Needs network access for rfbrowser install.
|
|
6
|
+
metadata:
|
|
7
|
+
author: manykarim
|
|
8
|
+
version: "1.0.0"
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Browser Library Skill
|
|
12
|
+
|
|
13
|
+
Browser Library drives Chromium, Firefox and WebKit through Playwright: auto-waiting actions, retrying assertions, one isolated context per session. It is the default for new web tests; for suites that already import SeleniumLibrary, use rf-selenium.
|
|
14
|
+
Verified against Browser 19.14.2, Robot Framework 7.4.
|
|
15
|
+
|
|
16
|
+
## When to use
|
|
17
|
+
|
|
18
|
+
Load this skill first, before exploring the project or answering from memory, when a Robot Framework web UI test uses Browser Library (`Library Browser`, Playwright):
|
|
19
|
+
|
|
20
|
+
- writing or fixing a web test: pages, contexts and tabs, CSS/text/XPath selectors including iframes and shadow DOM, auto-waiting, assertions with an operator, downloads, storage state;
|
|
21
|
+
- a click or selector times out (`TimeoutError: locator.click`), or the user mentions Browser Library, Playwright or rfbrowser, even if they only say "browser lib";
|
|
22
|
+
- a new web test with no library chosen yet: Browser Library is the default.
|
|
23
|
+
|
|
24
|
+
Not this skill: suites that import SeleniumLibrary or run on WebDriver/Selenium Grid use `rf-selenium`; installing the library or errors in its Node.js `rfbrowser init` step use `rf-setup` (plugin `rf-core`).
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
Install into the project environment, with the tool the project already uses. Full steps and verification: `references/install.md`. For a new environment, Poetry and venv + pip forms, and troubleshooting, see `rf-setup` (plugin `rf-core`).
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
uv add "robotframework-browser[bb]"
|
|
32
|
+
uv run rfbrowser install chromium
|
|
33
|
+
```
|
|
34
|
+
BrowserBatteries (`[bb]`) ships the Playwright wrapper, so no Node.js is needed. `rfbrowser install` downloads the browser binaries.
|
|
35
|
+
|
|
36
|
+
Node.js escape hatch — only if no BrowserBatteries wheel exists for your platform, or you need Node plugins (Node 22/24/26 LTS):
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
uv add robotframework-browser
|
|
40
|
+
uv run rfbrowser init chromium
|
|
41
|
+
```
|
|
42
|
+
Don't mix the paths: `rfbrowser install` belongs to `[bb]`, `rfbrowser init` to the Node.js path.
|
|
43
|
+
|
|
44
|
+
## Import and defaults
|
|
45
|
+
|
|
46
|
+
Import the library without arguments; its defaults are the recommendation: strict mode on, `timeout=10s` for actions and waits, `retry_assertions_for=1s`, `auto_closing_level=TEST`, and a screenshot on every failing Browser keyword.
|
|
47
|
+
|
|
48
|
+
```robotframework
|
|
49
|
+
*** Settings ***
|
|
50
|
+
Library Browser
|
|
51
|
+
Suite Setup Open Test Browser
|
|
52
|
+
Test Setup New Page ${URL}
|
|
53
|
+
|
|
54
|
+
*** Variables ***
|
|
55
|
+
${URL} https://example.com
|
|
56
|
+
|
|
57
|
+
*** Keywords ***
|
|
58
|
+
Open Test Browser
|
|
59
|
+
New Browser chromium headless=True
|
|
60
|
+
New Context viewport={'width': 1280, 'height': 800}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
The browser and context opened in Suite Setup live until the suite ends; each test gets a fresh page that is closed at test end. Use a new context per test when tests must not share cookies or storage, or per user in multi-user tests — see `references/browser-context-page.md`. Reuse a login with `storageState` — see `references/authentication-storage.md`.
|
|
64
|
+
|
|
65
|
+
## Which keyword for which situation
|
|
66
|
+
|
|
67
|
+
| Situation | Use | Details |
|
|
68
|
+
|---|---|---|
|
|
69
|
+
| Click, hover, check | `Click`, `Hover`, `Check Checkbox` (auto-wait for actionability) | `references/locators.md` |
|
|
70
|
+
| Enter text | `Fill Text`; `Type Text` when key events matter; `Fill Secret` for passwords | — |
|
|
71
|
+
| Choose from a `<select>` | `Select Options By select#country value US` | — |
|
|
72
|
+
| Assert text, URL, count, state | Getter + operator: `Get Text h1 == Welcome`, `Get Url contains /home`, `Get Element Count li == 3` | `references/assertion-engine.md` |
|
|
73
|
+
| Wait for appear/disappear | `Wait For Elements State .spinner hidden` | `references/assertion-engine.md` |
|
|
74
|
+
| Wait for page load or an API call | `Wait For Load State networkidle`; `Promise To Wait For Response **/api/items` before the click, `Wait For` after it | `references/troubleshooting.md` |
|
|
75
|
+
| Retry any getter until true | `Wait For Condition Text h1 == Done` | `references/assertion-engine.md` |
|
|
76
|
+
| Element inside an iframe or shadow DOM | `Click iframe#pay >>> button#submit`; CSS pierces open shadow roots | `references/iframes-shadow-dom.md` |
|
|
77
|
+
| Popup, new tab, several pages | `Switch Page NEW`, `Get Page Ids`, `Close Page` | `references/browser-context-page.md` |
|
|
78
|
+
| Log in once, reuse the session | `Save Storage State`, then `New Context storageState=${state}` | `references/authentication-storage.md` |
|
|
79
|
+
| Upload or download a file | `Upload File By Selector`; `Promise To Wait For Download` + `Wait For` | `references/downloads-uploads.md` |
|
|
80
|
+
| Selector stopped matching after a UI change, or a test passes only some runs | stable locator (test id, then role); measure before any rerun | `references/selector-drift.md` |
|
|
81
|
+
| Run JavaScript on the page | `Evaluate JavaScript ${None} () => document.title` | — |
|
|
82
|
+
|
|
83
|
+
## Agent workflow
|
|
84
|
+
|
|
85
|
+
1. Look up each keyword before you use it: `robotcode doc keyword Browser "<Keyword>"`; find names with `robotcode doc keywords Browser "<text>"`. Copy names and arguments exactly as robotcode shows them.
|
|
86
|
+
2. Write the test with the defaults above and the decision table.
|
|
87
|
+
3. Check the changed files statically: `robotcode analyze code <changed files>` (through the project environment, e.g. `uv run robotcode …`). Fix every error it reports.
|
|
88
|
+
4. Run them by longname: `robotcode robot -bl "<Suite.Sub.Test>"` (longnames from `robotcode discover tests`), or pass a whole directory. Don't pass a single `.robot` file: it skips the parent `__init__.robot`.
|
|
89
|
+
5. Read the results: `robotcode results show --failed`, then `robotcode results log -bl "<longname>"`. Don't parse output.xml by hand.
|
|
90
|
+
6. Fix the cause and go back to step 3 (static check). Stop when the tests pass or the failure is shown to be in the system under test, and say which.
|
|
91
|
+
|
|
92
|
+
## Selector strategy
|
|
93
|
+
|
|
94
|
+
Prefer, in order: test ids (`[data-testid="save"]`), accessible roles (`role=button[name="Save"]`), short CSS, text (`text=Save`), XPath last. Narrow with `>>` chaining (`.cart >> text=Remove`) or `>> nth=0` instead of long absolute paths. Details: `references/locators.md`.
|
|
95
|
+
|
|
96
|
+
## Gotchas
|
|
97
|
+
|
|
98
|
+
- **Strict mode fails on several matches** — actions and getters fail when a selector matches more than one element, because the import default is `strict=True`. Make the selector unique or add `>> nth=0`; switch it off for one scope with `Set Strict Mode False` only when the page really has duplicates.
|
|
99
|
+
- **A plain getter does not retry** — `${t}= Get Text h1` followed by `Should Be Equal` checks once. Getters with an assertion operator (`Get Text h1 == Welcome`) retry for `retry_assertions_for` (default 1 s). Put the operator in the getter; for longer waits raise it with `Set Retry Assertions For` or use `Wait For Condition`, and never add `Sleep`.
|
|
100
|
+
- **Two different timeouts** — `timeout` (default 10 s, `Set Browser Timeout`) bounds actions and waits; `retry_assertions_for` bounds assertion retries. A slow assertion needs the second one raised, not the first.
|
|
101
|
+
- **`Wait Until Network Is Idle` is deprecated** — use `Wait For Load State networkidle`, or better wait for the element or response you need (`Wait For Elements State`, `Wait For Response`).
|
|
102
|
+
- **`Fill Text` sets the value in one step** — it fills and fires one input event, so key handlers (autocomplete, masks) never see keystrokes. Use `Type Text` (keydown/keypress/keyup per character) or `Press Keys` there.
|
|
103
|
+
- **`Fill Secret` rejects `${password}`** — it takes a Robot Framework 7.4 `Secret` variable, or the name as `$password` / `%ENV_VAR`, so the value is not logged. A plain `${password}` string fails; use `Fill Text` if hiding is not needed.
|
|
104
|
+
- **`auto_closing_level=TEST` closes what a test opened** — contexts and pages created inside a test close when it ends; those from Suite Setup live until suite teardown. Open shared browser/context in Suite Setup. `KEEP` leaves browsers and the node process running and is meant for local development only, not CI.
|
|
105
|
+
- **`New Page` without a browser uses defaults** — it silently runs `New Browser` and `New Context` with default values (headless Chromium, default viewport), so a `viewport`, `storageState` or `httpCredentials` you meant to set is missing. Call `New Browser` and `New Context` first.
|
|
106
|
+
- **Selector shortcuts** — a selector starting with `//` or `..` is XPath, one in quotes (`"Login"`) is exact text, anything else is CSS; `text=Login` matches case-insensitively as a substring. A cell that starts with `#` is a Robot Framework comment: write `id=login` or `\#login`. XPath does not pierce shadow roots; frames need `>>>`.
|
|
107
|
+
- **No screenshot teardown needed** — `run_on_failure` defaults to `Take Screenshot fail-screenshot-{index}`, so a `Run Keyword If Test Failed Take Screenshot` teardown only duplicates it.
|
|
108
|
+
|
|
109
|
+
## When to read the references
|
|
110
|
+
|
|
111
|
+
| Read | When |
|
|
112
|
+
|---|---|
|
|
113
|
+
| `references/install.md` | installing the library, its post-install steps, verifying the install, or a failed post-install step |
|
|
114
|
+
| `references/migrate-from-selenium.md` | a suite moves from SeleniumLibrary to Browser: the keyword map |
|
|
115
|
+
| `references/locators.md` | a selector is ambiguous, brittle, or needs chaining, `nth=`, `:has()` or role selectors |
|
|
116
|
+
| `references/assertion-engine.md` | you need an operator other than `==`/`contains`, `validate`, or custom wait logic |
|
|
117
|
+
| `references/browser-context-page.md` | several browsers, contexts or users; popups and tabs; video/tracing; closing levels |
|
|
118
|
+
| `references/iframes-shadow-dom.md` | an element sits inside an iframe or a web component |
|
|
119
|
+
| `references/authentication-storage.md` | reusing a login, HTTP auth, cookies or local/session storage |
|
|
120
|
+
| `references/downloads-uploads.md` | a test uploads or downloads files |
|
|
121
|
+
| `references/troubleshooting.md` | a run fails with an error message you need to decode |
|
|
122
|
+
| `references/selector-drift.md` | a selector stopped matching after a UI change, matches several elements, or a test passes only some runs |
|
|
123
|
+
|
|
124
|
+
Examples in `assets/examples/`: `basic-web-test.robot`, `form-handling.robot`, `authentication-flow.robot`, `iframe-shadow-dom.robot`.
|
|
125
|
+
|
|
126
|
+
## Companion Skills
|
|
127
|
+
|
|
128
|
+
| Need | Skill |
|
|
129
|
+
|------|-------|
|
|
130
|
+
| Web UI tests with SeleniumLibrary (WebDriver) | `rf-selenium` |
|
|
131
|
+
| Install Robot Framework or a library, fix the environment | `rf-setup` (plugin `rf-core`) |
|
|
132
|
+
| Write tests, suites, user keywords, resources and variables in Robot Framework syntax | `rf-language` (plugin `rf-core`) |
|
|
133
|
+
|
|
134
|
+
For running, discovering, keyword documentation, result analysis and debugging with the robotcode CLI, use the `robotcode` skill of the robotcode plugin (`robotcode@robotframework-agent-plugins`); the commands above work without it.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
*** Settings ***
|
|
2
|
+
Documentation Log in once in Suite Setup, save the storage state and
|
|
3
|
+
... reuse it in every test's context (no login per test).
|
|
4
|
+
Library Browser
|
|
5
|
+
Suite Setup Log In Once
|
|
6
|
+
|
|
7
|
+
*** Variables ***
|
|
8
|
+
${BASE_URL} https://the-internet.herokuapp.com
|
|
9
|
+
${USER} tomsmith
|
|
10
|
+
${PASSWORD} SuperSecretPassword!
|
|
11
|
+
|
|
12
|
+
*** Test Cases ***
|
|
13
|
+
Secure Area Without Logging In Again
|
|
14
|
+
New Context storageState=${STATE}
|
|
15
|
+
New Page ${BASE_URL}/secure
|
|
16
|
+
Get Url contains /secure
|
|
17
|
+
Get Text h2 contains Secure Area
|
|
18
|
+
|
|
19
|
+
Fresh Context Is Logged Out
|
|
20
|
+
New Context
|
|
21
|
+
New Page ${BASE_URL}/secure
|
|
22
|
+
Get Url contains /login
|
|
23
|
+
|
|
24
|
+
*** Keywords ***
|
|
25
|
+
Log In Once
|
|
26
|
+
New Browser chromium headless=True
|
|
27
|
+
New Context
|
|
28
|
+
New Page ${BASE_URL}/login
|
|
29
|
+
Fill Text id=username ${USER}
|
|
30
|
+
Fill Secret id=password $PASSWORD
|
|
31
|
+
Click button[type="submit"]
|
|
32
|
+
Get Url contains /secure
|
|
33
|
+
${state}= Save Storage State
|
|
34
|
+
VAR ${STATE} ${state} scope=SUITE
|
robotframework_plugins/_assets/plugins/rf-web/skills/rf-browser/assets/examples/basic-web-test.robot
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
*** Settings ***
|
|
2
|
+
Documentation Basic Browser Library suite: shared browser and context from
|
|
3
|
+
... Suite Setup, a fresh page per test, getter assertions.
|
|
4
|
+
Library Browser
|
|
5
|
+
Suite Setup Open Test Browser
|
|
6
|
+
Test Setup New Page ${URL}
|
|
7
|
+
|
|
8
|
+
*** Variables ***
|
|
9
|
+
${URL} https://example.com
|
|
10
|
+
|
|
11
|
+
*** Test Cases ***
|
|
12
|
+
Title And Heading
|
|
13
|
+
Get Title == Example Domain
|
|
14
|
+
Get Text h1 == Example Domain
|
|
15
|
+
Get Element Count p >= 1
|
|
16
|
+
|
|
17
|
+
Link Navigates
|
|
18
|
+
Get Attribute a href contains iana.org
|
|
19
|
+
Click a
|
|
20
|
+
Get Url contains iana.org
|
|
21
|
+
|
|
22
|
+
Element States
|
|
23
|
+
Get Element States h1 contains visible
|
|
24
|
+
Get Text p >> nth=0 contains documentation
|
|
25
|
+
|
|
26
|
+
*** Keywords ***
|
|
27
|
+
Open Test Browser
|
|
28
|
+
New Browser chromium headless=True
|
|
29
|
+
New Context viewport={'width': 1280, 'height': 800}
|
robotframework_plugins/_assets/plugins/rf-web/skills/rf-browser/assets/examples/form-handling.robot
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
*** Settings ***
|
|
2
|
+
Documentation Form handling: text, secrets, checkboxes, dropdowns and
|
|
3
|
+
... validation messages on the-internet.herokuapp.com.
|
|
4
|
+
Library Browser
|
|
5
|
+
Suite Setup Open Test Browser
|
|
6
|
+
Test Setup New Page ${BASE_URL}
|
|
7
|
+
|
|
8
|
+
*** Variables ***
|
|
9
|
+
${BASE_URL} https://the-internet.herokuapp.com
|
|
10
|
+
${USER} tomsmith
|
|
11
|
+
${PASSWORD} SuperSecretPassword!
|
|
12
|
+
|
|
13
|
+
*** Test Cases ***
|
|
14
|
+
Valid Login
|
|
15
|
+
Go To ${BASE_URL}/login
|
|
16
|
+
Fill Text id=username ${USER}
|
|
17
|
+
Fill Secret id=password $PASSWORD
|
|
18
|
+
Click button[type="submit"]
|
|
19
|
+
Get Url contains /secure
|
|
20
|
+
Get Text id=flash contains You logged into a secure area
|
|
21
|
+
|
|
22
|
+
Invalid Login Shows Error
|
|
23
|
+
Go To ${BASE_URL}/login
|
|
24
|
+
Fill Text id=username nobody
|
|
25
|
+
Fill Text id=password wrong
|
|
26
|
+
Click button[type="submit"]
|
|
27
|
+
Get Text id=flash contains Your username is invalid
|
|
28
|
+
|
|
29
|
+
Checkboxes
|
|
30
|
+
Go To ${BASE_URL}/checkboxes
|
|
31
|
+
Check Checkbox input[type="checkbox"] >> nth=0
|
|
32
|
+
Uncheck Checkbox input[type="checkbox"] >> nth=1
|
|
33
|
+
Get Checkbox State input[type="checkbox"] >> nth=0 == checked
|
|
34
|
+
Get Checkbox State input[type="checkbox"] >> nth=1 == unchecked
|
|
35
|
+
|
|
36
|
+
Dropdown
|
|
37
|
+
Go To ${BASE_URL}/dropdown
|
|
38
|
+
Select Options By id=dropdown label Option 2
|
|
39
|
+
Get Selected Options id=dropdown label == Option 2
|
|
40
|
+
|
|
41
|
+
Typing For Key Handlers
|
|
42
|
+
Go To ${BASE_URL}/key_presses
|
|
43
|
+
Type Text id=target a delay=50ms
|
|
44
|
+
Get Text id=result == You entered: A
|
|
45
|
+
|
|
46
|
+
*** Keywords ***
|
|
47
|
+
Open Test Browser
|
|
48
|
+
New Browser chromium headless=True
|
|
49
|
+
New Context
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
*** Settings ***
|
|
2
|
+
Documentation Frames with >>> and shadow DOM piercing with plain CSS.
|
|
3
|
+
Library Browser
|
|
4
|
+
Suite Setup Open Test Browser
|
|
5
|
+
Test Setup New Page ${BASE_URL}
|
|
6
|
+
|
|
7
|
+
*** Variables ***
|
|
8
|
+
${BASE_URL} https://the-internet.herokuapp.com
|
|
9
|
+
|
|
10
|
+
*** Test Cases ***
|
|
11
|
+
Nested Frames
|
|
12
|
+
Go To ${BASE_URL}/nested_frames
|
|
13
|
+
Get Text frame[name="frame-top"] >>> frame[name="frame-left"] >>> body contains LEFT
|
|
14
|
+
Get Text frame[name="frame-bottom"] >>> body contains BOTTOM
|
|
15
|
+
|
|
16
|
+
Many Steps In One Frame
|
|
17
|
+
Go To ${BASE_URL}/nested_frames
|
|
18
|
+
${old}= Set Selector Prefix frame[name="frame-top"] >>> frame[name="frame-middle"] >>>
|
|
19
|
+
Get Text id=content == MIDDLE
|
|
20
|
+
Set Selector Prefix ${old}
|
|
21
|
+
|
|
22
|
+
Shadow DOM
|
|
23
|
+
Go To ${BASE_URL}/shadowdom
|
|
24
|
+
# CSS pierces open shadow roots: no special syntax needed.
|
|
25
|
+
Get Text my-paragraph >> span[slot="my-text"] >> nth=0 contains text
|
|
26
|
+
Get Element Count css=my-paragraph p >= 1
|
|
27
|
+
|
|
28
|
+
*** Keywords ***
|
|
29
|
+
Open Test Browser
|
|
30
|
+
New Browser chromium headless=True
|
|
31
|
+
New Context
|
robotframework_plugins/_assets/plugins/rf-web/skills/rf-browser/references/assertion-engine.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# Assertion Engine
|
|
2
|
+
|
|
3
|
+
- How getter assertions work
|
|
4
|
+
- Operators
|
|
5
|
+
- Types of expected values
|
|
6
|
+
- validate and then
|
|
7
|
+
- Waiting keywords
|
|
8
|
+
- Timeouts
|
|
9
|
+
|
|
10
|
+
## How getter assertions work
|
|
11
|
+
|
|
12
|
+
Every getter with `assertion_operator` / `assertion_expected` arguments (`Get Text`, `Get Title`, `Get Url`, `Get Element Count`, `Get Element States`, `Get Property`, `Get Attribute`, `Get Classes`, `Get Style`, `Get Checkbox State`, `Get Selected Options`, `LocalStorage Get Item`, …) asserts and returns the value in one step. With an operator it retries until the assertion passes or `retry_assertions_for` runs out; without one it reads once.
|
|
13
|
+
|
|
14
|
+
```robotframework
|
|
15
|
+
*** Test Cases ***
|
|
16
|
+
Getter Assertions
|
|
17
|
+
Get Text h1 == Welcome
|
|
18
|
+
Get Url contains /dashboard
|
|
19
|
+
Get Element Count li.item >= 3
|
|
20
|
+
Get Element States button#save contains enabled
|
|
21
|
+
Get Attribute a.help href ^= https://
|
|
22
|
+
Get Text .error == Required message=Form did not show {expected}, got {value}
|
|
23
|
+
${title}= Get Title != ${EMPTY}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
`message=` replaces the default failure message; `{value}`, `{expected}`, `{value_type}` and `{expected_type}` are filled in.
|
|
27
|
+
|
|
28
|
+
## Operators
|
|
29
|
+
|
|
30
|
+
| Operator | Also written | Passes when |
|
|
31
|
+
|---|---|---|
|
|
32
|
+
| `==` | `equal`, `equals`, `should be` | value equals expected |
|
|
33
|
+
| `!=` | `inequal`, `should not be` | value differs |
|
|
34
|
+
| `>` `>=` `<` `<=` | `greater than`, `less than` | numeric (or character-wise string) comparison |
|
|
35
|
+
| `*=` | `contains` | expected is a substring / member |
|
|
36
|
+
| `not contains` | | expected is not contained |
|
|
37
|
+
| `^=` | `starts`, `should start with` | value starts with expected |
|
|
38
|
+
| `$=` | `ends`, `should end with` | value ends with expected |
|
|
39
|
+
| `matches` | | regular expression matches somewhere in the value |
|
|
40
|
+
| `validate` | | Python expression over `value` is true |
|
|
41
|
+
| `then` | `evaluate` | returns the Python expression over `value` (no assertion) |
|
|
42
|
+
|
|
43
|
+
For `Get Element States`, `contains` and `not contains` check states such as `visible`, `hidden`, `enabled`, `disabled`, `editable`, `checked`, `focused`, `attached`, `detached`.
|
|
44
|
+
|
|
45
|
+
## Types of expected values
|
|
46
|
+
|
|
47
|
+
The expected value is not converted: `Get Text` returns a string, so compare it with a string. Getters that return numbers (`Get Element Count`, filtered `Get Viewport Size`, `Get BoundingBox`) convert the expected value to a number. String `<`/`>` compares character by character (`'100' < '2'`).
|
|
48
|
+
|
|
49
|
+
## validate and then
|
|
50
|
+
|
|
51
|
+
```robotframework
|
|
52
|
+
*** Test Cases ***
|
|
53
|
+
Validate And Then
|
|
54
|
+
Get Text .price validate float(value.strip('$')) > 10
|
|
55
|
+
Get Element Count li.item validate value % 2 == 0
|
|
56
|
+
${upper}= Get Title then value.upper()
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Waiting keywords
|
|
60
|
+
|
|
61
|
+
| Need | Keyword |
|
|
62
|
+
|---|---|
|
|
63
|
+
| Element appears, disappears, becomes enabled | `Wait For Elements State .spinner hidden timeout=20s` |
|
|
64
|
+
| Any getter reaches a value, with its own timeout | `Wait For Condition Text h1 == Done timeout=20s` |
|
|
65
|
+
| Page load state | `Wait For Load State networkidle` (`load`, `domcontentloaded`, `networkidle`, `commit`) |
|
|
66
|
+
| Navigation to a URL | `Wait For Navigation **/success` |
|
|
67
|
+
| A JavaScript predicate | `Wait For Function () => window.appReady === true` |
|
|
68
|
+
| A network response | `Promise To Wait For Response **/api/items`, trigger, then `Wait For` |
|
|
69
|
+
|
|
70
|
+
`Wait For Condition` takes the getter name without `Get` (`Text`, `Url`, `Title`, `Element Count`, `Element States`, `Attribute`, `Property`, …) followed by the getter's own arguments.
|
|
71
|
+
|
|
72
|
+
## Timeouts
|
|
73
|
+
|
|
74
|
+
| Setting | Default | Scope keyword | Bounds |
|
|
75
|
+
|---|---|---|---|
|
|
76
|
+
| `timeout` | 10 s | `Set Browser Timeout` | actions, waits, `Switch Page NEW` |
|
|
77
|
+
| `retry_assertions_for` | 1 s | `Set Retry Assertions For` | getter assertion retries |
|
|
78
|
+
|
|
79
|
+
Both scope keywords take `scope=Global|Suite|Test` (default `Suite`). A per-call `timeout=` on wait keywords overrides `timeout` for that call only.
|
robotframework_plugins/_assets/plugins/rf-web/skills/rf-browser/references/authentication-storage.md
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Authentication and Storage State
|
|
2
|
+
|
|
3
|
+
- Log in once, reuse the state
|
|
4
|
+
- HTTP authentication
|
|
5
|
+
- Cookies
|
|
6
|
+
- Local and session storage
|
|
7
|
+
|
|
8
|
+
## Log in once, reuse the state
|
|
9
|
+
|
|
10
|
+
A context's cookies and local storage can be saved and loaded into new contexts, so only one test (or Suite Setup) goes through the login form.
|
|
11
|
+
|
|
12
|
+
```robotframework
|
|
13
|
+
*** Settings ***
|
|
14
|
+
Library Browser
|
|
15
|
+
Suite Setup Log In Once
|
|
16
|
+
|
|
17
|
+
*** Variables ***
|
|
18
|
+
${URL} https://app.example.com
|
|
19
|
+
${USER} demo
|
|
20
|
+
${PASSWORD} demo
|
|
21
|
+
|
|
22
|
+
*** Test Cases ***
|
|
23
|
+
Dashboard Shows User
|
|
24
|
+
New Context storageState=${STATE}
|
|
25
|
+
New Page ${URL}/dashboard
|
|
26
|
+
Get Text .user-menu contains ${USER}
|
|
27
|
+
|
|
28
|
+
*** Keywords ***
|
|
29
|
+
Log In Once
|
|
30
|
+
New Browser chromium headless=True
|
|
31
|
+
New Context
|
|
32
|
+
New Page ${URL}/login
|
|
33
|
+
Fill Text input[name="username"] ${USER}
|
|
34
|
+
Fill Secret input[name="password"] $PASSWORD
|
|
35
|
+
Click button[type="submit"]
|
|
36
|
+
Get Url contains /dashboard
|
|
37
|
+
${state}= Save Storage State
|
|
38
|
+
VAR ${STATE} ${state} scope=SUITE
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
- `Save Storage State` takes no arguments. It writes to `${OUTPUTDIR}/browser/state/` and returns the path; those files are deleted when the next run starts, so the state is reused within one run. Copy the file (for example with `Copy File`) if another run must reuse it.
|
|
42
|
+
- `storageState=` needs the full path returned by `Save Storage State`.
|
|
43
|
+
- The state file holds session secrets; keep it out of version control.
|
|
44
|
+
- Only cookies and local storage are saved; session storage is not part of it.
|
|
45
|
+
|
|
46
|
+
## HTTP authentication
|
|
47
|
+
|
|
48
|
+
For basic or digest auth, give credentials to the context instead of the URL:
|
|
49
|
+
|
|
50
|
+
```robotframework
|
|
51
|
+
*** Keywords ***
|
|
52
|
+
Open Protected Site
|
|
53
|
+
New Context httpCredentials={'username': '$USER', 'password': '$PASSWORD'}
|
|
54
|
+
New Page https://intranet.example.com
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Write the values as `$NAME` (Robot Framework variable) or `%NAME` (environment variable), or pass a dictionary of Robot Framework 7.4 `Secret` values built with `VAR &{creds}`. Plain values such as `{'username': 'u', 'password': 'p'}` are rejected with "Direct assignment of values or variables as 'httpCredentials' is not allowed". For token-based APIs behind the UI, `extraHTTPHeaders={'Authorization': 'Bearer ${TOKEN}'}` on `New Context` sends a header with every request.
|
|
58
|
+
|
|
59
|
+
## Cookies
|
|
60
|
+
|
|
61
|
+
```robotframework
|
|
62
|
+
*** Test Cases ***
|
|
63
|
+
Cookie Handling
|
|
64
|
+
Add Cookie session abc123 url=https://app.example.com
|
|
65
|
+
${cookie}= Get Cookie session
|
|
66
|
+
Should Be Equal ${cookie.value} abc123
|
|
67
|
+
${all}= Get Cookies
|
|
68
|
+
Delete All Cookies
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
`Add Cookie` needs either `url=` or both `domain=` and `path=`. `Get Cookie` returns a dot-accessible dictionary by default.
|
|
72
|
+
|
|
73
|
+
## Local and session storage
|
|
74
|
+
|
|
75
|
+
```robotframework
|
|
76
|
+
*** Test Cases ***
|
|
77
|
+
Storage Handling
|
|
78
|
+
LocalStorage Set Item theme dark
|
|
79
|
+
LocalStorage Get Item theme == dark
|
|
80
|
+
LocalStorage Remove Item theme
|
|
81
|
+
LocalStorage Clear
|
|
82
|
+
SessionStorage Set Item step 2
|
|
83
|
+
SessionStorage Get Item step == 2
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Storage belongs to the page's origin: open a page on the application's URL before setting items. Getters take assertion operators like other getters.
|
robotframework_plugins/_assets/plugins/rf-web/skills/rf-browser/references/browser-context-page.md
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# Browser, Context and Page
|
|
2
|
+
|
|
3
|
+
- Hierarchy and ids
|
|
4
|
+
- Browser
|
|
5
|
+
- Context
|
|
6
|
+
- Page, popups and tabs
|
|
7
|
+
- Automatic closing
|
|
8
|
+
- Recording video and traces
|
|
9
|
+
|
|
10
|
+
## Hierarchy and ids
|
|
11
|
+
|
|
12
|
+
A browser (one process: `chromium`, `firefox` or `webkit`) holds contexts; a context (its own cookies, local/session storage, cache, permissions) holds pages; a page is one tab or popup. Tabs and windows are pages. `New Browser`, `New Context` and `New Page` return ids you can pass to `Switch Context`, `Switch Page`, `Close Context` and `Close Page`; `CURRENT`, `ACTIVE`, `ALL` and `ANY` select without an id.
|
|
13
|
+
|
|
14
|
+
```robotframework
|
|
15
|
+
*** Keywords ***
|
|
16
|
+
Show Catalog
|
|
17
|
+
${ids}= Get Page Ids ALL ALL ALL
|
|
18
|
+
${catalog}= Get Browser Catalog
|
|
19
|
+
Log ${catalog}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Browser
|
|
23
|
+
|
|
24
|
+
```robotframework
|
|
25
|
+
*** Keywords ***
|
|
26
|
+
Open Browsers
|
|
27
|
+
New Browser chromium headless=True
|
|
28
|
+
New Browser firefox headless=False slowMo=0.5s
|
|
29
|
+
New Browser chromium channel=chrome args=["--start-maximized"]
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
`New Browser` reuses an already open browser with the same arguments. `channel=chrome` or `channel=msedge` drives an installed branded browser instead of the bundled Chromium. `Close Browser ALL` closes everything.
|
|
33
|
+
|
|
34
|
+
## Context
|
|
35
|
+
|
|
36
|
+
One context per user or per test that needs isolated storage. Common options, all keyword-only arguments of `New Context`:
|
|
37
|
+
|
|
38
|
+
```robotframework
|
|
39
|
+
*** Keywords ***
|
|
40
|
+
Open Mobile Context
|
|
41
|
+
New Context
|
|
42
|
+
... viewport={'width': 375, 'height': 812}
|
|
43
|
+
... deviceScaleFactor=3 isMobile=True hasTouch=True
|
|
44
|
+
... locale=de-DE timezoneId=Europe/Berlin
|
|
45
|
+
... ignoreHTTPSErrors=True
|
|
46
|
+
... baseURL=https://staging.example.com
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
- `storageState=<path>` restores a login saved by `Save Storage State` (full path).
|
|
50
|
+
- `httpCredentials={'username': '$USER', 'password': '$PASSWORD'}` answers HTTP basic/digest auth (values must use the `$NAME` / `%NAME` form).
|
|
51
|
+
- `baseURL` lets `Go To /cart` resolve relative URLs.
|
|
52
|
+
- `extraHTTPHeaders`, `geolocation` + `permissions`, `colorScheme`, `offline`, `proxy` exist too; check them with libdoc.
|
|
53
|
+
- `acceptDownloads` defaults to `True`.
|
|
54
|
+
|
|
55
|
+
Two users at once:
|
|
56
|
+
|
|
57
|
+
```robotframework
|
|
58
|
+
*** Test Cases ***
|
|
59
|
+
Admin Sees Message From User
|
|
60
|
+
${user}= New Context
|
|
61
|
+
New Page ${URL}/login
|
|
62
|
+
${admin}= New Context
|
|
63
|
+
New Page ${URL}/admin
|
|
64
|
+
Switch Context ${user}
|
|
65
|
+
Get Url contains /login
|
|
66
|
+
Switch Context ${admin}
|
|
67
|
+
Get Url contains /admin
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Page, popups and tabs
|
|
71
|
+
|
|
72
|
+
```robotframework
|
|
73
|
+
*** Test Cases ***
|
|
74
|
+
Popup Flow
|
|
75
|
+
New Page ${URL}
|
|
76
|
+
Click a[target="_blank"]
|
|
77
|
+
${previous}= Switch Page NEW
|
|
78
|
+
Get Title contains Help
|
|
79
|
+
Close Page
|
|
80
|
+
Get Url == ${URL}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
- `Switch Page NEW` switches to the page the site just opened; it waits up to the library timeout and fails if no new page appears.
|
|
84
|
+
- `Switch Page` returns the id of the previous page; keep it to switch back.
|
|
85
|
+
- `Close Page` makes the page that was active before the closed one active again.
|
|
86
|
+
- `New Page` returns a dictionary; its `page_id` works with `Switch Page` and `Close Page`.
|
|
87
|
+
- Viewport per page: `Set Viewport Size 1280 800`.
|
|
88
|
+
|
|
89
|
+
## Automatic closing
|
|
90
|
+
|
|
91
|
+
`auto_closing_level` (import argument, default `TEST`):
|
|
92
|
+
|
|
93
|
+
| Level | Closes |
|
|
94
|
+
|---|---|
|
|
95
|
+
| `TEST` | contexts and pages opened in a test at the end of that test; those from Suite Setup at suite teardown |
|
|
96
|
+
| `SUITE` | everything opened in the suite at suite teardown |
|
|
97
|
+
| `MANUAL` | nothing during the run; everything when the run ends |
|
|
98
|
+
| `KEEP` | nothing, not even at the end (browsers and the node process stay running) — local development only |
|
|
99
|
+
|
|
100
|
+
With `TEST`, open the browser and context in Suite Setup and a page per test: fast, and each test still starts on a fresh page.
|
|
101
|
+
|
|
102
|
+
## Recording video and traces
|
|
103
|
+
|
|
104
|
+
```robotframework
|
|
105
|
+
*** Keywords ***
|
|
106
|
+
Open Recorded Context
|
|
107
|
+
New Context recordVideo={'dir': '${OUTPUT_DIR}/videos'} tracing=True
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Videos and traces are written when the context closes. `tracing=True` stores a Playwright trace per context; open it with `uv run rfbrowser show-trace <file>`.
|
robotframework_plugins/_assets/plugins/rf-web/skills/rf-browser/references/downloads-uploads.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Downloads and Uploads
|
|
2
|
+
|
|
3
|
+
- Uploads
|
|
4
|
+
- Downloads
|
|
5
|
+
- Where files go
|
|
6
|
+
|
|
7
|
+
## Uploads
|
|
8
|
+
|
|
9
|
+
```robotframework
|
|
10
|
+
*** Test Cases ***
|
|
11
|
+
Upload Through Input Element
|
|
12
|
+
Upload File By Selector input[type="file"] ${CURDIR}/data/report.pdf
|
|
13
|
+
Upload File By Selector input#photos ${CURDIR}/a.png ${CURDIR}/b.png
|
|
14
|
+
Get Text .upload-status contains uploaded
|
|
15
|
+
|
|
16
|
+
Upload Through Custom Button
|
|
17
|
+
${promise}= Promise To Upload File ${CURDIR}/data/report.pdf
|
|
18
|
+
Click button#choose-file
|
|
19
|
+
Wait For ${promise}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
- `Upload File By Selector` needs the `<input type="file">` element; extra paths upload several files, and a directory uploads all files directly in it.
|
|
23
|
+
- When the site opens a file chooser from a non-input button, start `Promise To Upload File` before the click and `Wait For` it afterwards.
|
|
24
|
+
- Large uploads can exceed the library `timeout`; raise it with `Set Browser Timeout` for that test.
|
|
25
|
+
|
|
26
|
+
## Downloads
|
|
27
|
+
|
|
28
|
+
```robotframework
|
|
29
|
+
*** Test Cases ***
|
|
30
|
+
Download Report
|
|
31
|
+
${promise}= Promise To Wait For Download ${OUTPUT_DIR}/report.csv
|
|
32
|
+
Click text=Export CSV
|
|
33
|
+
${file}= Wait For ${promise}
|
|
34
|
+
File Should Exist ${file}[saveAs]
|
|
35
|
+
Should Be Equal ${file}[suggestedFilename] report.csv
|
|
36
|
+
|
|
37
|
+
Download Direct Link
|
|
38
|
+
${file}= Download https://example.com/files/manual.pdf
|
|
39
|
+
Log ${file}[saveAs]
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
- Start `Promise To Wait For Download` before the click that triggers the download; waiting afterwards can miss the event.
|
|
43
|
+
- It returns a `DownloadInfo` dictionary with `saveAs` (where the file is) and `suggestedFilename`. `wait_for_finished=False` returns when the download starts; check it later with `Get Download State`.
|
|
44
|
+
- `Download` fetches a URL directly; when a page element starts the download, use the promise instead.
|
|
45
|
+
- `File Should Exist` comes from `OperatingSystem`; import it for file checks.
|
|
46
|
+
|
|
47
|
+
## Where files go
|
|
48
|
+
|
|
49
|
+
- Without `saveAs`, files get a generated name and are deleted when the context closes. Pass `saveAs` (absolute, or relative to the browser's `downloadsPath`) to keep them.
|
|
50
|
+
- `New Context` has `acceptDownloads=True` by default; a context created with `acceptDownloads=False` never produces downloads.
|
|
51
|
+
- With a remote browser (`Connect To Browser`), `saveAs` is required to store the file where the browser runs.
|