robotframework-plugins 2026.11.0.dev1__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 +110 -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/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/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 +119 -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/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 +11 -0
- robotframework_plugins/_assets/plugins/rf-core/README.md +38 -0
- robotframework_plugins/_assets/plugins/rf-core/agents/rf-debug-expert.md +104 -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 +435 -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 +108 -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 +509 -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 +103 -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 +107 -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 +9 -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 +266 -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 +132 -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/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 +230 -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.dev1.dist-info/METADATA +178 -0
- robotframework_plugins-2026.11.0.dev1.dist-info/RECORD +195 -0
- robotframework_plugins-2026.11.0.dev1.dist-info/WHEEL +4 -0
- robotframework_plugins-2026.11.0.dev1.dist-info/entry_points.txt +2 -0
- robotframework_plugins-2026.11.0.dev1.dist-info/licenses/LICENSE +201 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rf-selenium
|
|
3
|
+
description: "Use first, before answering, for RF web tests with SeleniumLibrary. Not installs/drivers: rf-setup."
|
|
4
|
+
license: Apache-2.0
|
|
5
|
+
compatibility: Requires Python 3.10+, robotframework>=7, robotcode[all]>=2.8 in the project environment and robotframework-seleniumlibrary 6.x, plus a locally installed browser (drivers resolved by Selenium Manager) or a Selenium Grid URL.
|
|
6
|
+
metadata:
|
|
7
|
+
author: manykarim
|
|
8
|
+
version: "1.0.0"
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
# SeleniumLibrary Skill
|
|
13
|
+
|
|
14
|
+
Web UI tests through Selenium WebDriver. Unlike Browser Library, element keywords do not wait: every dynamic step needs an explicit wait.
|
|
15
|
+
Use this skill for suites that already import SeleniumLibrary or need Selenium Grid; for new web tests with no library chosen, use rf-browser.
|
|
16
|
+
Verified against SeleniumLibrary 6.8.0, Robot Framework 7.4.
|
|
17
|
+
|
|
18
|
+
## When to use
|
|
19
|
+
|
|
20
|
+
Load this skill first, before exploring the project or answering from memory, when a Robot Framework web UI test uses SeleniumLibrary (`Library SeleniumLibrary`, Selenium WebDriver):
|
|
21
|
+
|
|
22
|
+
- writing or fixing a SeleniumLibrary test: browser options, `id:`/`css:`/`xpath:` locators, explicit waits, hover menus, frames, windows, alerts, JavaScript;
|
|
23
|
+
- a WebDriver exception in a robot run (element not found, click intercepted, stale element), or the user mentions SeleniumLibrary, WebDriver, chromedriver or Selenium Grid.
|
|
24
|
+
|
|
25
|
+
Not this skill: Browser Library/Playwright suites, or new web tests with no library chosen, use `rf-browser`; installing SeleniumLibrary or a driver uses `rf-setup` (plugin `rf-core`).
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
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`).
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
uv add robotframework-seleniumlibrary
|
|
33
|
+
```
|
|
34
|
+
A real browser (Chrome, Firefox, Edge) must be installed; Selenium Manager (bundled with Selenium ≥ 4.6) fetches the matching driver on first use. No driver downloads or PATH setup. Offline or air-gapped machines: see `references/install.md`.
|
|
35
|
+
|
|
36
|
+
## Import and defaults
|
|
37
|
+
|
|
38
|
+
```robotframework
|
|
39
|
+
*** Settings ***
|
|
40
|
+
Library SeleniumLibrary timeout=10s implicit_wait=0s
|
|
41
|
+
Suite Setup Open Browser ${BASE_URL} headlesschrome
|
|
42
|
+
Suite Teardown Close All Browsers
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
- `timeout=10s` raises the 5 s default of the `Wait Until …` and alert keywords, because CI pages load slower than local ones.
|
|
46
|
+
- `implicit_wait=0s` (the default) keeps element lookups fast and explicit; waits are written as `Wait Until …` steps.
|
|
47
|
+
- `run_on_failure` stays at its default, `Capture Page Screenshot`, so every failing SeleniumLibrary keyword leaves a screenshot in the log.
|
|
48
|
+
- `Open Browser` with `headlesschrome` (or `chrome` locally) lets Selenium Manager resolve the driver.
|
|
49
|
+
|
|
50
|
+
Use `options=` (for example `options=add_argument("--window-size=1920,1080")`), `remote_url=` for Selenium Grid, or `Create Webdriver` when you need browser flags, a grid or a custom driver service — see `references/browser-setup.md`.
|
|
51
|
+
|
|
52
|
+
## Which keyword for which situation
|
|
53
|
+
|
|
54
|
+
| Situation | Use | Details |
|
|
55
|
+
|---|---|---|
|
|
56
|
+
| Click, type, select | `Click Element`, `Input Text`, `Input Password`, `Select From List By Label` — after a wait if the element appears late | `references/locators.md` |
|
|
57
|
+
| Element appears after navigation or AJAX | `Wait Until Element Is Visible`, `Wait Until Page Contains Element` | `references/waiting-strategies.md` |
|
|
58
|
+
| Spinner or dialog must go away | `Wait Until Element Is Not Visible` | `references/waiting-strategies.md` |
|
|
59
|
+
| Button becomes clickable | `Wait Until Element Is Enabled` | `references/waiting-strategies.md` |
|
|
60
|
+
| Assert text that loads late | `Wait Until Element Contains`, `Wait Until Page Contains` | `references/waiting-strategies.md` |
|
|
61
|
+
| Assert a state that is already settled | `Element Text Should Be`, `Element Should Be Visible`, `Title Should Be` | — |
|
|
62
|
+
| Wait for a count or any custom condition | `Wait Until Keyword Succeeds` + `Get Element Count` | `references/waiting-strategies.md` |
|
|
63
|
+
| Element inside an iframe | `Select Frame` … `Unselect Frame` | `references/frames-windows.md` |
|
|
64
|
+
| Popup window or new tab | `Switch Window NEW`, back with `Switch Window MAIN` | `references/frames-windows.md` |
|
|
65
|
+
| JavaScript alert or confirm | `Handle Alert` | `references/frames-windows.md` |
|
|
66
|
+
| File upload | `Choose File` on the `<input type="file">` | — |
|
|
67
|
+
| Something no keyword covers | `Execute Javascript` with `ARGUMENTS` | `references/javascript-execution.md` |
|
|
68
|
+
| Extra evidence for a failure | `Capture Element Screenshot`, `Log Source` | `references/troubleshooting.md` |
|
|
69
|
+
|
|
70
|
+
Keyword names and arguments: `robotcode doc keywords SeleniumLibrary "wait until"` lists them; there is no keyword catalog in this skill.
|
|
71
|
+
|
|
72
|
+
## Agent workflow
|
|
73
|
+
|
|
74
|
+
1. Look up each keyword before you use it: `robotcode doc keyword SeleniumLibrary "<Keyword>"`; find names with `robotcode doc keywords SeleniumLibrary "<text>"`. Copy names and arguments exactly as robotcode shows them.
|
|
75
|
+
2. Write the test with the defaults above and the decision table.
|
|
76
|
+
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.
|
|
77
|
+
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`.
|
|
78
|
+
5. Read the results: `robotcode results show --failed`, then `robotcode results log -bl "<longname>"`. Don't parse output.xml by hand.
|
|
79
|
+
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.
|
|
80
|
+
|
|
81
|
+
## Locator rules
|
|
82
|
+
|
|
83
|
+
- A locator without a prefix matches the `id` or `name` attribute (some keywords add more, e.g. `Click Link` also matches link text and `href`).
|
|
84
|
+
- A locator starting with `//` (or `(//`) is XPath; everything else needs an explicit strategy: `css:`, `xpath:`, `link:`, `partial link:`, `class:`, `tag:`, `data:`.
|
|
85
|
+
- Prefer `id:`/`css:` with stable attributes (`css:[data-testid="save"]`); XPath for text matches only: `xpath://button[normalize-space()="Save"]`.
|
|
86
|
+
- Keep locators in variables, never stored WebElements (see Gotchas).
|
|
87
|
+
|
|
88
|
+
## Gotchas
|
|
89
|
+
|
|
90
|
+
- **Element keywords do not wait** — `Click Element`, `Input Text` and `Get Text` fail at once when the element is not there yet, because `implicit_wait` defaults to 0 and the import `timeout` applies only to `Wait …` and alert keywords. Put a `Wait Until Element Is Visible` (or `… Is Enabled`) before acting on anything that loads late.
|
|
91
|
+
- **Assertions check once** — `Page Should Contain`, `Element Should Be Visible` and `Element Text Should Be` do not retry. After navigation or AJAX use `Wait Until Page Contains`, `Wait Until Element Is Visible` or `Wait Until Element Contains`.
|
|
92
|
+
- **`Page Should Contain` leaves the frame** — it searches all frames and resets the selection to the main frame, because of how it walks frames. Call `Select Frame` again before the next locator inside the iframe.
|
|
93
|
+
- **`Select Frame` is sticky** — every later locator is resolved inside that frame until `Unselect Frame`, so a main-page element then fails with "element not found", not with a frame error. Pair each `Select Frame` with `Unselect Frame`.
|
|
94
|
+
- **Headless browser names have no underscore** — `Open Browser` accepts `headlesschrome` and `headlessfirefox`; `headless_chrome` fails with "is not a supported browser", and there is no headless Edge name. For headless Edge use `edge` with `options=add_argument("--headless=new")`.
|
|
95
|
+
- **`Open Browser` defaults to Firefox** — the `browser` argument defaults to `firefox`, so a call without it fails on machines that only have Chrome. Always pass the browser (e.g. from a `${BROWSER}` variable).
|
|
96
|
+
- **Implicit plus explicit waits** — setting `implicit_wait` (or `Set Selenium Implicit Wait`) makes every lookup block for up to that time, also inside the polling loop of `Wait Until …` keywords, so waits overshoot their `timeout` and absence checks such as `Wait Until Page Does Not Contain Element` slow down. Keep `implicit_wait=0s` and use explicit waits.
|
|
97
|
+
- **Stale WebElements** — a `${el}= Get WebElement …` stored before the page re-renders raises `StaleElementReferenceException` later, because Selenium element references die with the DOM node. Pass locator strings and look elements up again.
|
|
98
|
+
- **Covered elements** — `Click Element` on an element under an overlay or cookie banner fails with `ElementClickInterceptedException`. Wait for the overlay with `Wait Until Element Is Not Visible`, or use `Scroll Element Into View`; a JavaScript click is the last resort because it skips the user-visible check.
|
|
99
|
+
- **Screenshot teardowns are redundant** — `run_on_failure` already runs `Capture Page Screenshot` when a SeleniumLibrary keyword fails; a `Capture Page Screenshot` teardown only duplicates it. Change the behaviour with the `run_on_failure` import argument or `Register Keyword To Run On Failure`.
|
|
100
|
+
|
|
101
|
+
## When to read the references
|
|
102
|
+
|
|
103
|
+
| Read | When |
|
|
104
|
+
|---|---|
|
|
105
|
+
| `references/install.md` | installing the library, its post-install steps, verifying the install, or a failed post-install step |
|
|
106
|
+
| `references/browser-setup.md` | you need browser options, window size, Selenium Grid (`remote_url`), `Create Webdriver`, or CI flags |
|
|
107
|
+
| `references/waiting-strategies.md` | a test is flaky, you need a count or custom wait, or you tune timeouts |
|
|
108
|
+
| `references/locators.md` | a locator does not match, or you need chaining, `Add Location Strategy` or WebElement arguments |
|
|
109
|
+
| `references/frames-windows.md` | the page uses iframes, popups, new tabs or alerts |
|
|
110
|
+
| `references/javascript-execution.md` | no keyword does what you need and you want `Execute Javascript` / `Execute Async Javascript` |
|
|
111
|
+
| `references/troubleshooting.md` | you have an error message (stale element, click intercepted, session not created, no such frame) or need screenshots and page source |
|
|
112
|
+
|
|
113
|
+
Examples in `assets/examples/`: `basic-web-test.robot` (navigation, forms, assertions), `wait-patterns.robot` (explicit waits, count wait), `multi-window.robot` (windows, frames, alerts).
|
|
114
|
+
|
|
115
|
+
## Companion Skills
|
|
116
|
+
|
|
117
|
+
| Need | Skill |
|
|
118
|
+
|------|-------|
|
|
119
|
+
| Web UI tests with Browser Library (Playwright) | `rf-browser` |
|
|
120
|
+
| Install Robot Framework or a library, fix the environment | `rf-setup` (plugin `rf-core`) |
|
|
121
|
+
| Write tests, suites, user keywords, resources and variables in Robot Framework syntax | `rf-language` (plugin `rf-core`) |
|
|
122
|
+
|
|
123
|
+
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,64 @@
|
|
|
1
|
+
*** Settings ***
|
|
2
|
+
Documentation SeleniumLibrary basics: open a browser, fill a form, assert with explicit waits.
|
|
3
|
+
... Runs against https://the-internet.herokuapp.com (needs network and Chrome).
|
|
4
|
+
Library SeleniumLibrary timeout=10s implicit_wait=0s
|
|
5
|
+
Suite Setup Open Browser ${BASE_URL} ${BROWSER} options=${CHROME_OPTIONS}
|
|
6
|
+
Suite Teardown Close All Browsers
|
|
7
|
+
Test Setup Start Logged Out
|
|
8
|
+
|
|
9
|
+
*** Variables ***
|
|
10
|
+
${BASE_URL} https://the-internet.herokuapp.com
|
|
11
|
+
${BROWSER} headlesschrome
|
|
12
|
+
${USERNAME} tomsmith
|
|
13
|
+
${PASSWORD} SuperSecretPassword!
|
|
14
|
+
# Chrome's password-leak check opens a dialog after logging in with a known
|
|
15
|
+
# demo password; it swallows later clicks, so switch the password manager off.
|
|
16
|
+
${CHROME_OPTIONS} add_experimental_option("prefs", {"credentials_enable_service": False, "profile.password_manager_enabled": False, "profile.password_manager_leak_detection": False})
|
|
17
|
+
|
|
18
|
+
*** Test Cases ***
|
|
19
|
+
Home Page Lists The Examples
|
|
20
|
+
Title Should Be The Internet
|
|
21
|
+
Wait Until Page Contains Element css:ul li a
|
|
22
|
+
${links}= Get Element Count css:ul li a
|
|
23
|
+
Should Be True ${links} > 10
|
|
24
|
+
|
|
25
|
+
Valid Login Shows The Secure Area
|
|
26
|
+
Login As ${USERNAME} ${PASSWORD}
|
|
27
|
+
Wait Until Location Contains /secure
|
|
28
|
+
Wait Until Element Contains id:flash You logged into a secure area!
|
|
29
|
+
|
|
30
|
+
Invalid Login Shows An Error
|
|
31
|
+
Login As ${USERNAME} wrong-password
|
|
32
|
+
Wait Until Element Contains id:flash Your password is invalid!
|
|
33
|
+
Location Should Contain /login
|
|
34
|
+
|
|
35
|
+
Checkboxes And Dropdown
|
|
36
|
+
Go To ${BASE_URL}/checkboxes
|
|
37
|
+
Select Checkbox xpath:(//form[@id="checkboxes"]/input)[1]
|
|
38
|
+
Checkbox Should Be Selected xpath:(//form[@id="checkboxes"]/input)[1]
|
|
39
|
+
Unselect Checkbox xpath:(//form[@id="checkboxes"]/input)[2]
|
|
40
|
+
Checkbox Should Not Be Selected xpath:(//form[@id="checkboxes"]/input)[2]
|
|
41
|
+
Go To ${BASE_URL}/dropdown
|
|
42
|
+
Select From List By Label id:dropdown Option 2
|
|
43
|
+
List Selection Should Be id:dropdown Option 2
|
|
44
|
+
|
|
45
|
+
Upload A File
|
|
46
|
+
Go To ${BASE_URL}/upload
|
|
47
|
+
VAR ${file} ${TEMPDIR}${/}upload-example.txt
|
|
48
|
+
Evaluate pathlib.Path($file).write_text("hello") modules=pathlib
|
|
49
|
+
Choose File id:file-upload ${file}
|
|
50
|
+
Click Button id:file-submit
|
|
51
|
+
Wait Until Element Contains id:uploaded-files upload-example.txt
|
|
52
|
+
|
|
53
|
+
*** Keywords ***
|
|
54
|
+
Start Logged Out
|
|
55
|
+
Delete All Cookies
|
|
56
|
+
Go To ${BASE_URL}
|
|
57
|
+
|
|
58
|
+
Login As
|
|
59
|
+
[Arguments] ${username} ${password}
|
|
60
|
+
Go To ${BASE_URL}/login
|
|
61
|
+
Wait Until Element Is Visible id:username
|
|
62
|
+
Input Text id:username ${username}
|
|
63
|
+
Input Password id:password ${password}
|
|
64
|
+
Click Button css:button[type="submit"]
|
robotframework_plugins/_assets/plugins/rf-web/skills/rf-selenium/assets/examples/multi-window.robot
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
*** Settings ***
|
|
2
|
+
Documentation Windows, frames and alerts with SeleniumLibrary.
|
|
3
|
+
... Runs against https://the-internet.herokuapp.com (needs network and Chrome).
|
|
4
|
+
Library SeleniumLibrary timeout=10s implicit_wait=0s
|
|
5
|
+
Suite Setup Open Browser ${BASE_URL} ${BROWSER}
|
|
6
|
+
Suite Teardown Close All Browsers
|
|
7
|
+
Test Teardown Switch Window MAIN
|
|
8
|
+
|
|
9
|
+
*** Variables ***
|
|
10
|
+
${BASE_URL} https://the-internet.herokuapp.com
|
|
11
|
+
${BROWSER} headlesschrome
|
|
12
|
+
|
|
13
|
+
*** Test Cases ***
|
|
14
|
+
Link Opens A New Window
|
|
15
|
+
Go To ${BASE_URL}/windows
|
|
16
|
+
Click Link link:Click Here
|
|
17
|
+
Switch Window NEW timeout=10s
|
|
18
|
+
Title Should Be New Window
|
|
19
|
+
Close Window
|
|
20
|
+
|
|
21
|
+
Switch By Excluding Known Windows
|
|
22
|
+
Go To ${BASE_URL}/windows
|
|
23
|
+
${before}= Get Window Handles
|
|
24
|
+
Click Link link:Click Here
|
|
25
|
+
Switch Window ${before} timeout=10s
|
|
26
|
+
Page Should Contain New Window
|
|
27
|
+
Close Window
|
|
28
|
+
|
|
29
|
+
Type Inside An Iframe
|
|
30
|
+
Go To ${BASE_URL}/iframe
|
|
31
|
+
Wait Until Page Contains Element id:mce_0_ifr
|
|
32
|
+
Select Frame id:mce_0_ifr
|
|
33
|
+
Wait Until Element Is Visible id:tinymce
|
|
34
|
+
${text}= Get Text id:tinymce
|
|
35
|
+
Unselect Frame
|
|
36
|
+
Should Not Be Empty ${text}
|
|
37
|
+
|
|
38
|
+
Nested Frames
|
|
39
|
+
Go To ${BASE_URL}/nested_frames
|
|
40
|
+
Select Frame name:frame-top
|
|
41
|
+
Select Frame name:frame-middle
|
|
42
|
+
Element Text Should Be id:content MIDDLE
|
|
43
|
+
Unselect Frame
|
|
44
|
+
|
|
45
|
+
Accept And Dismiss Alerts
|
|
46
|
+
Go To ${BASE_URL}/javascript_alerts
|
|
47
|
+
Click Button xpath://button[.="Click for JS Alert"]
|
|
48
|
+
${message}= Handle Alert ACCEPT
|
|
49
|
+
Should Be Equal ${message} I am a JS Alert
|
|
50
|
+
Click Button xpath://button[.="Click for JS Confirm"]
|
|
51
|
+
Handle Alert DISMISS
|
|
52
|
+
Wait Until Element Contains id:result You clicked: Cancel
|
|
53
|
+
Click Button xpath://button[.="Click for JS Prompt"]
|
|
54
|
+
Input Text Into Alert hello
|
|
55
|
+
Wait Until Element Contains id:result You entered: hello
|
robotframework_plugins/_assets/plugins/rf-web/skills/rf-selenium/assets/examples/wait-patterns.robot
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
*** Settings ***
|
|
2
|
+
Documentation Explicit waits with SeleniumLibrary: visibility, disappearance, enabled state,
|
|
3
|
+
... text, exact and minimum counts. Runs against https://the-internet.herokuapp.com.
|
|
4
|
+
Library SeleniumLibrary timeout=10s implicit_wait=0s
|
|
5
|
+
Suite Setup Open Browser ${BASE_URL} ${BROWSER}
|
|
6
|
+
Suite Teardown Close All Browsers
|
|
7
|
+
|
|
8
|
+
*** Variables ***
|
|
9
|
+
${BASE_URL} https://the-internet.herokuapp.com
|
|
10
|
+
${BROWSER} headlesschrome
|
|
11
|
+
|
|
12
|
+
*** Test Cases ***
|
|
13
|
+
Wait For Hidden Element To Appear
|
|
14
|
+
Go To ${BASE_URL}/dynamic_loading/1
|
|
15
|
+
Click Element css:#start button
|
|
16
|
+
Wait Until Element Is Not Visible id:loading timeout=15s
|
|
17
|
+
Wait Until Element Is Visible id:finish
|
|
18
|
+
Element Text Should Be css:#finish h4 Hello World!
|
|
19
|
+
|
|
20
|
+
Wait For Element Rendered After Click
|
|
21
|
+
Go To ${BASE_URL}/dynamic_loading/2
|
|
22
|
+
Click Element css:#start button
|
|
23
|
+
Wait Until Page Contains Hello World! timeout=15s
|
|
24
|
+
|
|
25
|
+
Wait For Control To Become Enabled
|
|
26
|
+
Go To ${BASE_URL}/dynamic_controls
|
|
27
|
+
Click Button css:#input-example button
|
|
28
|
+
Wait Until Element Is Enabled css:#input-example input[type="text"]
|
|
29
|
+
Input Text css:#input-example input[type="text"] typed after enable
|
|
30
|
+
|
|
31
|
+
Wait For Exact Count
|
|
32
|
+
Go To ${BASE_URL}/add_remove_elements/
|
|
33
|
+
FOR ${_} IN RANGE 3
|
|
34
|
+
Click Button css:button[onclick="addElement()"]
|
|
35
|
+
END
|
|
36
|
+
Wait Until Page Contains Element css:#elements button limit=3
|
|
37
|
+
|
|
38
|
+
Wait For Minimum Count
|
|
39
|
+
Go To ${BASE_URL}/add_remove_elements/
|
|
40
|
+
FOR ${_} IN RANGE 4
|
|
41
|
+
Click Button css:button[onclick="addElement()"]
|
|
42
|
+
END
|
|
43
|
+
Wait Until Keyword Succeeds 10s 500ms Element Count Should Be At Least css:#elements button 4
|
|
44
|
+
|
|
45
|
+
Wait For Condition In JavaScript
|
|
46
|
+
Go To ${BASE_URL}
|
|
47
|
+
Wait For Condition return document.readyState == "complete"
|
|
48
|
+
|
|
49
|
+
*** Keywords ***
|
|
50
|
+
Element Count Should Be At Least
|
|
51
|
+
[Arguments] ${locator} ${minimum}
|
|
52
|
+
${count}= Get Element Count ${locator}
|
|
53
|
+
Should Be True ${count} >= ${minimum}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# Browser Setup
|
|
2
|
+
|
|
3
|
+
- Drivers and Selenium Manager
|
|
4
|
+
- Browser names
|
|
5
|
+
- Browser options
|
|
6
|
+
- Selenium Grid
|
|
7
|
+
- Create Webdriver
|
|
8
|
+
- CI
|
|
9
|
+
|
|
10
|
+
## Drivers and Selenium Manager
|
|
11
|
+
|
|
12
|
+
Selenium ≥ 4.6 ships Selenium Manager. On the first `Open Browser` it finds the installed browser, downloads the matching driver (chromedriver, geckodriver, msedgedriver) and caches it in `~/.cache/selenium` (`SE_CACHE_PATH` moves the cache, for example into a CI cache directory). Nothing goes on `PATH` and no helper library is needed. Offline or locked-down machines: see rf-setup (plugin rf-core).
|
|
13
|
+
|
|
14
|
+
## Browser names
|
|
15
|
+
|
|
16
|
+
`Open Browser` lower-cases the name and removes spaces, then looks it up:
|
|
17
|
+
|
|
18
|
+
| Browser | Names |
|
|
19
|
+
|---|---|
|
|
20
|
+
| Chrome | `chrome`, `googlechrome`, `gc` |
|
|
21
|
+
| Headless Chrome | `headlesschrome` |
|
|
22
|
+
| Firefox (the default) | `firefox`, `ff` |
|
|
23
|
+
| Headless Firefox | `headlessfirefox` |
|
|
24
|
+
| Edge | `edge` |
|
|
25
|
+
| Safari | `safari` |
|
|
26
|
+
|
|
27
|
+
`headless_chrome` and `headless_firefox` are rejected ("is not a supported browser"). For headless Edge, pass `edge` with a headless option.
|
|
28
|
+
|
|
29
|
+
## Browser options
|
|
30
|
+
|
|
31
|
+
`options=` takes a string of method calls on the browser's Options object, separated by `;`:
|
|
32
|
+
|
|
33
|
+
```robotframework
|
|
34
|
+
*** Test Cases ***
|
|
35
|
+
Chrome With Options
|
|
36
|
+
Open Browser ${URL} chrome
|
|
37
|
+
... options=add_argument("--headless=new");add_argument("--window-size=1920,1080")
|
|
38
|
+
[Teardown] Close Browser
|
|
39
|
+
|
|
40
|
+
Headless Edge
|
|
41
|
+
Open Browser ${URL} edge options=add_argument("--headless=new")
|
|
42
|
+
[Teardown] Close Browser
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Useful Chrome/Edge arguments in containers: `--no-sandbox`, `--disable-dev-shm-usage`, `--window-size=W,H` (headless windows start small, so responsive layouts may hide elements). Firefox takes `-headless`, `-width`, `-height`. Capabilities go through the same string: `set_capability("acceptInsecureCerts", True)`.
|
|
46
|
+
|
|
47
|
+
For many settings, build the Options object once:
|
|
48
|
+
|
|
49
|
+
```robotframework
|
|
50
|
+
*** Keywords ***
|
|
51
|
+
Open Chrome For CI
|
|
52
|
+
[Arguments] ${url}
|
|
53
|
+
${options}= Evaluate selenium.webdriver.ChromeOptions() modules=selenium.webdriver
|
|
54
|
+
Call Method ${options} add_argument --headless\=new
|
|
55
|
+
Call Method ${options} add_argument --window-size\=1920,1080
|
|
56
|
+
Open Browser ${url} chrome options=${options}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Selenium Grid
|
|
60
|
+
|
|
61
|
+
`remote_url=` sends the session to a Grid (or Selenium standalone container). Grid 4 listens on `http://<host>:4444`; the old `/wd/hub` suffix is still accepted.
|
|
62
|
+
|
|
63
|
+
```robotframework
|
|
64
|
+
*** Variables ***
|
|
65
|
+
${GRID_URL} http://localhost:4444
|
|
66
|
+
|
|
67
|
+
*** Keywords ***
|
|
68
|
+
Open Browser On Grid
|
|
69
|
+
[Arguments] ${url} ${browser}=chrome
|
|
70
|
+
Open Browser ${url} ${browser} remote_url=${GRID_URL}
|
|
71
|
+
... options=set_capability("platformName", "linux")
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
The browser and driver live on the Grid node, so the test machine needs neither.
|
|
75
|
+
|
|
76
|
+
## Create Webdriver
|
|
77
|
+
|
|
78
|
+
Use `Create Webdriver` only when `Open Browser` cannot pass what you need (a proxy object, a custom service). It passes keyword arguments straight to the Selenium WebDriver class and does not navigate:
|
|
79
|
+
|
|
80
|
+
```robotframework
|
|
81
|
+
*** Keywords ***
|
|
82
|
+
Open Firefox Through Proxy
|
|
83
|
+
[Arguments] ${url}
|
|
84
|
+
${proxy}= Evaluate selenium.webdriver.Proxy() modules=selenium.webdriver
|
|
85
|
+
${proxy.http_proxy}= Set Variable localhost:8888
|
|
86
|
+
Create Webdriver Firefox proxy=${proxy}
|
|
87
|
+
Go To ${url}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## CI
|
|
91
|
+
|
|
92
|
+
Install from the project's lock file and install a browser; Selenium Manager fetches the driver, so there is no driver step. Pass the browser name as a variable so CI can run headless:
|
|
93
|
+
|
|
94
|
+
```yaml
|
|
95
|
+
steps:
|
|
96
|
+
- uses: actions/checkout@v4
|
|
97
|
+
- uses: astral-sh/setup-uv@v6
|
|
98
|
+
- uses: browser-actions/setup-chrome@v1
|
|
99
|
+
- run: uv sync --locked
|
|
100
|
+
- run: uv run robot --variable BROWSER:headlesschrome tests/
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Other CI systems (GitLab services, Jenkins) follow the same shape; see rf-setup (plugin rf-core) for CI setup.
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# Frames, Windows and Alerts
|
|
2
|
+
|
|
3
|
+
- Frames
|
|
4
|
+
- Windows and tabs
|
|
5
|
+
- Alerts
|
|
6
|
+
- Several browsers
|
|
7
|
+
|
|
8
|
+
## Frames
|
|
9
|
+
|
|
10
|
+
`Select Frame` makes a frame the context for every later keyword until `Unselect Frame` returns to the main document. Nested frames are selected one level at a time.
|
|
11
|
+
|
|
12
|
+
```robotframework
|
|
13
|
+
*** Keywords ***
|
|
14
|
+
Fill Card Details
|
|
15
|
+
Wait Until Page Contains Element css:iframe#payment
|
|
16
|
+
Select Frame css:iframe#payment
|
|
17
|
+
Input Text id:card-number 4111111111111111
|
|
18
|
+
Unselect Frame
|
|
19
|
+
|
|
20
|
+
Read Nested Frame
|
|
21
|
+
Select Frame id:outer
|
|
22
|
+
Select Frame id:inner
|
|
23
|
+
${text}= Get Text css:.message
|
|
24
|
+
Unselect Frame
|
|
25
|
+
RETURN ${text}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
- `Unselect Frame` always goes back to the top document, not to the parent frame.
|
|
29
|
+
- `Page Should Contain` searches all frames and leaves the main document selected; select the frame again after it.
|
|
30
|
+
- `Current Frame Should Contain` and `Frame Should Contain <frame> <text>` check text in one frame without changing the selection logic of the test.
|
|
31
|
+
- A locator that fails with "element not found" right after frame work is usually resolved in the wrong frame.
|
|
32
|
+
|
|
33
|
+
## Windows and tabs
|
|
34
|
+
|
|
35
|
+
`Switch Window` selects a window by locator and returns the handle of the window it left:
|
|
36
|
+
|
|
37
|
+
| Locator | Selects |
|
|
38
|
+
|---|---|
|
|
39
|
+
| `NEW` | the last opened window (fails if it is the current one) |
|
|
40
|
+
| `MAIN` (default) | the first window |
|
|
41
|
+
| `CURRENT` | stays; use it to get the current handle: `${handle}= Switch Window CURRENT` |
|
|
42
|
+
| `title:…`, `name:…`, `url:…` | by title, window name or URL |
|
|
43
|
+
| a list of handles | the window not in the list |
|
|
44
|
+
|
|
45
|
+
```robotframework
|
|
46
|
+
*** Keywords ***
|
|
47
|
+
Check Help Opens In New Tab
|
|
48
|
+
Click Link link:Help
|
|
49
|
+
Switch Window NEW timeout=10s
|
|
50
|
+
Title Should Be Help
|
|
51
|
+
Close Window
|
|
52
|
+
Switch Window MAIN
|
|
53
|
+
|
|
54
|
+
Switch To The Window A Click Opens
|
|
55
|
+
${before}= Get Window Handles
|
|
56
|
+
Click Element id:open-report
|
|
57
|
+
Switch Window ${before} timeout=10s
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
- `timeout=` on `Switch Window` polls until the window exists, so no separate wait is needed.
|
|
61
|
+
- `Close Window` closes the current window only; select another window afterwards, because keywords do not switch automatically.
|
|
62
|
+
- `Get Window Handles`, `Get Window Titles`, `Get Window Names` list windows; count windows with `Get Length` on `Get Window Handles`.
|
|
63
|
+
|
|
64
|
+
## Alerts
|
|
65
|
+
|
|
66
|
+
`Handle Alert` waits for a JavaScript alert, confirm or prompt (up to the library `timeout`), accepts or dismisses it and returns its message:
|
|
67
|
+
|
|
68
|
+
```robotframework
|
|
69
|
+
*** Keywords ***
|
|
70
|
+
Delete And Confirm
|
|
71
|
+
Click Element id:delete
|
|
72
|
+
${message}= Handle Alert ACCEPT
|
|
73
|
+
Should Contain ${message} Are you sure
|
|
74
|
+
|
|
75
|
+
Cancel The Prompt
|
|
76
|
+
Click Element id:rename
|
|
77
|
+
Input Text Into Alert new-name action=DISMISS
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
`action` is `ACCEPT` (default), `DISMISS` or `LEAVE`. `Alert Should Be Present text=…` asserts the text and handles the alert in one step. An alert left open makes the next keyword fail with an "unexpected alert open" error.
|
|
81
|
+
|
|
82
|
+
## Several browsers
|
|
83
|
+
|
|
84
|
+
`Open Browser … alias=admin` names a browser; `Switch Browser admin` changes between them, and `Close All Browsers` in the suite teardown closes all of them. Use this for two-user scenarios; for more tabs of one user use windows.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Installing SeleniumLibrary
|
|
2
|
+
|
|
3
|
+
Commands are in uv form. For a new environment, Poetry and venv + pip forms, and the general troubleshooting (wrong interpreter, PEP 668, old Python), see `rf-setup` (plugin `rf-core`): `uv add <pkg>` is `poetry add <pkg>` (pip alternative: `.venv/bin/python -m pip install <pkg>`), and `uv run <cmd>` is `poetry run <cmd>` or `.venv/bin/<cmd>`. Versions and floors checked on PyPI 2026-09-26.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
uv add robotframework-seleniumlibrary
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
- Package `robotframework-seleniumlibrary` (6.9, Python ≥ 3.10). Module `SeleniumLibrary`. It pulls in `selenium` 4.x.
|
|
10
|
+
- After installing: a real browser (Chrome, Firefox, Edge) must be installed. **Selenium Manager** (built into selenium ≥ 4.6) downloads a matching driver on first use. Don't install chromedriver by hand unless the machine is offline.
|
|
11
|
+
- Offline or locked-down CI: preinstall the driver and put it on PATH; Selenium Manager then finds it.
|
|
12
|
+
- Verify: `uv run python -c "import SeleniumLibrary"`, then a one-line `Open Browser about:blank headlesschrome` test.
|
robotframework_plugins/_assets/plugins/rf-web/skills/rf-selenium/references/javascript-execution.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# JavaScript Execution
|
|
2
|
+
|
|
3
|
+
- When to use JavaScript
|
|
4
|
+
- Execute Javascript
|
|
5
|
+
- Passing arguments
|
|
6
|
+
- Asynchronous scripts
|
|
7
|
+
|
|
8
|
+
## When to use JavaScript
|
|
9
|
+
|
|
10
|
+
Use `Execute Javascript` when no keyword covers the need: reading page state (`document.readyState`, a value from the app's store), scrolling a custom container, or setting up test data in `localStorage`. A JavaScript click or value assignment skips the checks a user would hit (visibility, overlays, disabled state) and fires no key events, so a test can pass while the real UI is broken; use it for clicks only as a last resort.
|
|
11
|
+
|
|
12
|
+
## Execute Javascript
|
|
13
|
+
|
|
14
|
+
The code runs as the body of an anonymous function in the selected frame or window, so a value comes back only with `return`:
|
|
15
|
+
|
|
16
|
+
```robotframework
|
|
17
|
+
*** Test Cases ***
|
|
18
|
+
Read Page State
|
|
19
|
+
${state}= Execute Javascript return document.readyState;
|
|
20
|
+
Should Be Equal ${state} complete
|
|
21
|
+
${count}= Execute Javascript return document.querySelectorAll('li.item').length;
|
|
22
|
+
Should Be True ${count} >= 3
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
- Return values are converted to Python types (numbers, strings, lists, dicts; DOM elements become WebElements).
|
|
26
|
+
- If the code is split over several cells (`...` lines), the parts are joined without spaces: end each part with `;` or a space inside the code.
|
|
27
|
+
- A path to an existing `.js` file runs that file: `Execute Javascript ${CURDIR}/helpers.js`.
|
|
28
|
+
- After `Select Frame`, `document` is the frame's document.
|
|
29
|
+
|
|
30
|
+
## Passing arguments
|
|
31
|
+
|
|
32
|
+
Pass values and WebElements after the `ARGUMENTS` marker instead of formatting them into the code (no quoting problems, WebElements arrive as DOM nodes). If `ARGUMENTS` comes first, the code needs the `JAVASCRIPT` marker.
|
|
33
|
+
|
|
34
|
+
```robotframework
|
|
35
|
+
*** Keywords ***
|
|
36
|
+
Scroll Container To Bottom
|
|
37
|
+
[Arguments] ${locator}
|
|
38
|
+
${box}= Get WebElement ${locator}
|
|
39
|
+
Execute Javascript arguments[0].scrollTop = arguments[0].scrollHeight; ARGUMENTS ${box}
|
|
40
|
+
|
|
41
|
+
Set Value And Notify App
|
|
42
|
+
[Arguments] ${locator} ${value}
|
|
43
|
+
${input}= Get WebElement ${locator}
|
|
44
|
+
Execute Javascript
|
|
45
|
+
... arguments[0].value = arguments[1];
|
|
46
|
+
... arguments[0].dispatchEvent(new Event('input', {bubbles: true}));
|
|
47
|
+
... ARGUMENTS ${input} ${value}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Frameworks such as React or Angular listen for `input`/`change` events; a bare `value =` assignment without the event leaves the app's state unchanged.
|
|
51
|
+
|
|
52
|
+
## Asynchronous scripts
|
|
53
|
+
|
|
54
|
+
`Execute Async Javascript` injects a callback as the last argument and waits until the script calls it (up to the library `timeout`):
|
|
55
|
+
|
|
56
|
+
```robotframework
|
|
57
|
+
*** Test Cases ***
|
|
58
|
+
Fetch Health Endpoint From The Page
|
|
59
|
+
${status}= Execute Async Javascript
|
|
60
|
+
... var done = arguments[arguments.length - 1];
|
|
61
|
+
... fetch('/health').then(function (r) { done(r.status); });
|
|
62
|
+
Should Be Equal As Integers ${status} 200
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
To wait for a condition written in JavaScript, `Wait For Condition return window.appReady === true` is shorter than an async script.
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Locators
|
|
2
|
+
|
|
3
|
+
- Strategies
|
|
4
|
+
- Default strategy and implicit XPath
|
|
5
|
+
- Choosing a locator
|
|
6
|
+
- Chaining and lists
|
|
7
|
+
- WebElement arguments
|
|
8
|
+
- Custom strategies
|
|
9
|
+
|
|
10
|
+
## Strategies
|
|
11
|
+
|
|
12
|
+
Write the strategy as a prefix, `strategy:value`. The `strategy=value` form also works, but it is the same syntax as a Robot Framework named argument, which libdoc warns can cause problems; prefer the colon.
|
|
13
|
+
|
|
14
|
+
| Strategy | Matches | Example |
|
|
15
|
+
|---|---|---|
|
|
16
|
+
| `id` | `id` attribute | `id:login` |
|
|
17
|
+
| `name` | `name` attribute | `name:username` |
|
|
18
|
+
| `identifier` | `id` or `name` | `identifier:email` |
|
|
19
|
+
| `css` | CSS selector | `css:form#login button[type="submit"]` |
|
|
20
|
+
| `xpath` | XPath | `xpath://button[normalize-space()="Save"]` |
|
|
21
|
+
| `link` / `partial link` | exact / partial link text | `link:Sign in`, `partial link:Sign` |
|
|
22
|
+
| `class` | one class name | `class:btn-primary` |
|
|
23
|
+
| `tag` | tag name | `tag:h1` |
|
|
24
|
+
| `data` | a `data-*` attribute | `data:testid:save` (matches `data-testid="save"`) |
|
|
25
|
+
| `dom` | JavaScript DOM expression | `dom:document.forms[0]` |
|
|
26
|
+
|
|
27
|
+
`sizzle` and `jquery` need jQuery on the page and `sizzle` is deprecated; use `css:`.
|
|
28
|
+
|
|
29
|
+
## Default strategy and implicit XPath
|
|
30
|
+
|
|
31
|
+
- No prefix: the keyword's default strategy, which matches `id` or `name`. Some keywords add their own attributes (`Click Link` also matches link text and `href`, `Click Image` matches `src` and `alt`). A plain `Submit` therefore looks for `id="Submit"` or `name="Submit"`, not for text.
|
|
32
|
+
- A value starting with `//` or `(//` is XPath without the prefix: `//div[@id="main"]`, `(//li)[2]`.
|
|
33
|
+
- Anything that could be read as a strategy (`css:…` inside a text) can be forced to the default with `default:`.
|
|
34
|
+
|
|
35
|
+
## Choosing a locator
|
|
36
|
+
|
|
37
|
+
1. `id:` when the id is stable.
|
|
38
|
+
2. `css:` with a test attribute: `css:[data-testid="checkout"]` (or `data:testid:checkout`).
|
|
39
|
+
3. `css:` with structure and stable classes.
|
|
40
|
+
4. `xpath:` when you need the element's text or an ancestor: `xpath://tr[td[.="Alice"]]//button[.="Edit"]`.
|
|
41
|
+
|
|
42
|
+
Keep locators in `*** Variables ***` or keyword arguments, so a UI change is fixed in one place.
|
|
43
|
+
|
|
44
|
+
## Chaining and lists
|
|
45
|
+
|
|
46
|
+
`>>` chains locators; each part needs its own strategy, and each part searches inside the previous match:
|
|
47
|
+
|
|
48
|
+
```robotframework
|
|
49
|
+
*** Test Cases ***
|
|
50
|
+
Click Edit In Alice Row
|
|
51
|
+
Click Element css:table#users >> xpath:.//tr[td[.="Alice"]] >> css:button.edit
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Chaining works for Selenium-based strategies (`css`, `xpath`, `id`, …), not for `jquery`/`sizzle`. If a locator contains ` >> ` literally, pass a list instead: `${loc}= Create List css:div#main xpath://a`.
|
|
55
|
+
|
|
56
|
+
## WebElement arguments
|
|
57
|
+
|
|
58
|
+
Every `locator` argument also accepts a WebElement, for example from `Get WebElement` or `Get WebElements`. Use them only within a few steps: the reference goes stale when the page re-renders.
|
|
59
|
+
|
|
60
|
+
```robotframework
|
|
61
|
+
*** Test Cases ***
|
|
62
|
+
Check Every Price Is Shown
|
|
63
|
+
@{prices}= Get WebElements css:.price
|
|
64
|
+
FOR ${price} IN @{prices}
|
|
65
|
+
Element Should Be Visible ${price}
|
|
66
|
+
END
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Custom strategies
|
|
70
|
+
|
|
71
|
+
`Add Location Strategy` registers a keyword that returns a WebElement; the strategy is then used as a prefix:
|
|
72
|
+
|
|
73
|
+
```robotframework
|
|
74
|
+
*** Test Cases ***
|
|
75
|
+
Use Test Id Strategy
|
|
76
|
+
Add Location Strategy testid Find By Test Id
|
|
77
|
+
Click Element testid:checkout
|
|
78
|
+
|
|
79
|
+
*** Keywords ***
|
|
80
|
+
Find By Test Id
|
|
81
|
+
[Arguments] ${browser} ${locator} ${tag} ${constraints}
|
|
82
|
+
${element}= Execute Javascript return document.querySelector('[data-testid="${locator}"]');
|
|
83
|
+
RETURN ${element}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
The built-in `data:testid:checkout` does the same lookup; a custom strategy pays off for lookups that need logic.
|