QWeb 3.8.2__tar.gz → 3.9.0__tar.gz
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.
- qweb-3.9.0/PKG-INFO +465 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/__init__.py +212 -30
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/_version.py +4 -4
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/actions.py +32 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/checkbox.py +4 -3
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/download.py +43 -3
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/dropdown.py +3 -2
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/element.py +108 -13
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/exceptions.py +7 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/frame.py +87 -18
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/frame_checker.py +2 -1
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/input_.py +72 -16
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/javascript.py +87 -3
- qweb-3.9.0/QWeb/internal/js/filter_by_text.js +99 -0
- qweb-3.9.0/QWeb/internal/js/get_all_input_elements_from_shadow_dom.js +22 -0
- qweb-3.9.0/QWeb/internal/js/get_css_elements_from_shadow_dom.js +27 -0
- qweb-3.9.0/QWeb/internal/js/get_css_elements_synthetic.js +190 -0
- qweb-3.9.0/QWeb/internal/locator.py +252 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/keywords/element.py +84 -25
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/keywords/file.py +105 -12
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/keywords/icon.py +69 -18
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/keywords/input_.py +107 -19
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/keywords/text.py +66 -7
- qweb-3.9.0/QWeb.egg-info/PKG-INFO +465 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb.egg-info/SOURCES.txt +4 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb.egg-info/requires.txt +6 -1
- qweb-3.9.0/README.md +427 -0
- {qweb-3.8.2 → qweb-3.9.0}/pyproject.toml +3 -2
- qweb-3.8.2/PKG-INFO +0 -353
- qweb-3.8.2/QWeb/internal/js/get_all_input_elements_from_shadow_dom.js +0 -14
- qweb-3.8.2/QWeb.egg-info/PKG-INFO +0 -353
- qweb-3.8.2/README.md +0 -316
- {qweb-3.8.2 → qweb-3.9.0}/LICENSE +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/MANIFEST.in +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/__main__.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/custom_config.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/__init__.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/ajax.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/alert.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/bidi.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/blocks.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/browser/__init__.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/browser/android.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/browser/bs_desktop.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/browser/bs_mobile.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/browser/chrome.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/browser/edge.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/browser/firefox.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/browser/safari.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/config.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/config_defaults.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/cookies.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/decorators.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/dragdrop.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/file.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/icon.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/input_handler.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/js/find_text_from_textnodes.js +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/js/get_all_dropdown_elements_shadow_dom.js +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/js/get_all_frames_from_shadow_dom.js +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/js/get_by_attributes.js +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/js/get_by_label.js +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/js/get_childnodes.js +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/js/get_clickable.js +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/js/get_clickable_from_shadow_dom.js +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/js/get_item_elements_from_shadow_dom.js +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/js/get_parent_list.js +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/js/get_recursive_walk.js +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/js/get_text_elements_from_shadow_dom.js +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/js/get_visibility.js +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/js/highlight_element.js +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/js/install_monitor.js +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/js/spinner_busy.js +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/js/toast_notification.js +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/js/wait_status_lite.js +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/lists.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/meas.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/platform.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/screenshot.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/search_strategy.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/secrets.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/table.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/text.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/user.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/util.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/window.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/internal/xhr.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/keywords/__init__.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/keywords/ajax.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/keywords/alert.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/keywords/bidi.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/keywords/blocks.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/keywords/browser.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/keywords/checkbox.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/keywords/config.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/keywords/cookies.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/keywords/debug.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/keywords/download.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/keywords/dragdrop.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/keywords/dropdown.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/keywords/frame.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/keywords/javascript.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/keywords/lists.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/keywords/mouse.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/keywords/screenshot.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/keywords/table.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb/keywords/window.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb.egg-info/dependency_links.txt +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/QWeb.egg-info/top_level.txt +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/example/CustomerLibrary/CustomerLib.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/example/CustomerLibrary/decorators.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/setup.cfg +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/setup.py +0 -0
- {qweb-3.8.2 → qweb-3.9.0}/versioneer.py +0 -0
qweb-3.9.0/PKG-INFO
ADDED
|
@@ -0,0 +1,465 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: qweb
|
|
3
|
+
Version: 3.9.0
|
|
4
|
+
Summary: Keyword driven automation for the web
|
|
5
|
+
Author-email: "Copado Inc." <copadorobotictesting@copado.com>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/qentinelqi/qweb/
|
|
8
|
+
Keywords: test,automation,robot,framework
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
13
|
+
Classifier: Framework :: Robot Framework
|
|
14
|
+
Classifier: Framework :: Robot Framework :: Library
|
|
15
|
+
Requires-Python: <4.0,>3.7
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Requires-Dist: setuptools>=78.1.1
|
|
19
|
+
Requires-Dist: pyscreeze==0.1.28
|
|
20
|
+
Requires-Dist: pyautogui>=0.9.53
|
|
21
|
+
Requires-Dist: pynput>=1.8.0
|
|
22
|
+
Requires-Dist: pypdf>=6.15.0
|
|
23
|
+
Requires-Dist: pyperclip==1.9.0
|
|
24
|
+
Requires-Dist: requests>=2.33.0
|
|
25
|
+
Requires-Dist: robotframework<8,>=7.0
|
|
26
|
+
Requires-Dist: robotframework-debuglibrary==2.5.0
|
|
27
|
+
Requires-Dist: selenium<5,>=4.27.0
|
|
28
|
+
Requires-Dist: Pillow>=12.2.0
|
|
29
|
+
Requires-Dist: scipy>=1.10.0
|
|
30
|
+
Requires-Dist: scikit-image==0.25.2; python_version < "3.14"
|
|
31
|
+
Requires-Dist: scikit-image>=0.26.0; python_version >= "3.14"
|
|
32
|
+
Requires-Dist: numpy>=2.0.0
|
|
33
|
+
Requires-Dist: opencv-python==4.11.0.86
|
|
34
|
+
Requires-Dist: xlib; sys_platform == "linux"
|
|
35
|
+
Requires-Dist: pyobjc>=9.2; sys_platform == "darwin"
|
|
36
|
+
Requires-Dist: pyobjc-core>=9.2; sys_platform == "darwin"
|
|
37
|
+
Dynamic: license-file
|
|
38
|
+
|
|
39
|
+
<img id="qweb" src="https://github.com/qentinelqi/qweb/raw/master/images/qweb_logo_256.png" alt="QWeb">
|
|
40
|
+
|
|
41
|
+
> Keyword based test automation for the web.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
![License][license-badge]
|
|
45
|
+
![Python versions][python-versions-badge]
|
|
46
|
+
![Release][pypi-badge]
|
|
47
|
+
![Windows Acceptance][win_ci_badge]
|
|
48
|
+
![Linux Acceptance][linux_ci_badge]
|
|
49
|
+
![macOS Acceptance][macos_ci_badge]
|
|
50
|
+
[![Tested with][pace-badge]][pace-url]
|
|
51
|
+
[![Slack][slack-badge]][slack-url]
|
|
52
|
+
|
|
53
|
+
### Table of Contents
|
|
54
|
+
|
|
55
|
+
- [Introduction](#introduction)
|
|
56
|
+
- [Quick Example](#quick-example)
|
|
57
|
+
- [Requirements](#requirements)
|
|
58
|
+
- [Installation](#installation)
|
|
59
|
+
- [Windows](#windows)
|
|
60
|
+
- [Linux/Mac](#linuxmac)
|
|
61
|
+
- [Automatic browser \& driver management](#automatic-browser--driver-management)
|
|
62
|
+
- [Manual driver management](#manual-driver-management)
|
|
63
|
+
- [Usage](#usage)
|
|
64
|
+
- [Documentation](#documentation)
|
|
65
|
+
- [Examples](#examples)
|
|
66
|
+
- [Basic usage](#basic-usage)
|
|
67
|
+
- [Locator strategies](#locator-strategies)
|
|
68
|
+
- [Timeouts and anchors](#timeouts-and-anchors)
|
|
69
|
+
- [Shadow DOM and visibility](#shadow-dom-and-visibility)
|
|
70
|
+
- [Working with tables](#working-with-tables)
|
|
71
|
+
- [Changing configuration](#changing-configuration)
|
|
72
|
+
- [Running with Python](#running-with-python)
|
|
73
|
+
- [Extending QWeb with custom keywords](#extending-qweb-with-custom-keywords)
|
|
74
|
+
- [Changelog](#changelog)
|
|
75
|
+
- [Contribute](#contribute)
|
|
76
|
+
- [Community](#community)
|
|
77
|
+
- [License](#license)
|
|
78
|
+
- [Resources](#resources)
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Introduction
|
|
83
|
+
|
|
84
|
+
QWeb is an open-source library for web testing and automation that can be used with [Robot Framework](https://robotframework.org/) or directly from Python. Its core strength lies in an intuitive, human-readable API that makes automated tests easy to write, understand and maintain.
|
|
85
|
+
|
|
86
|
+
QWeb follows a **text-first approach**, encouraging test cases that describe user interactions rather than the underlying implementation of a web application. It also provides attribute-based locators, CSS selectors, XPath and image-based recognition for situations where more precise or specialized element identification is needed.
|
|
87
|
+
|
|
88
|
+
**Prefer the simplest locator that uniquely and reliably identifies the intended element.**
|
|
89
|
+
|
|
90
|
+
Higher abstraction reduces unnecessary dependencies on implementation details. Explicit selectors provide greater precision when those details matter.
|
|
91
|
+
|
|
92
|
+
QWeb aims to make web automation easy and maintainable through:
|
|
93
|
+
|
|
94
|
+
* **Human-readable syntax:** intuitive keywords and simple locator arguments.
|
|
95
|
+
* **Text-based locators:** interact with elements using visible text, labels and nearby text as anchors.
|
|
96
|
+
* **Attribute-based locators:** identify elements by descriptive attribute values without depending on specific attribute names or DOM structures.
|
|
97
|
+
* **CSS and XPath selectors:** precisely identify elements using explicit matching conditions and structural relationships.
|
|
98
|
+
* **CSS text filters:** combine CSS selectors with partial or exact visible text matching.
|
|
99
|
+
* **Automatic waits:** built-in retry logic in most keywords reduces the need for explicit waits.
|
|
100
|
+
* **Automatic frame handling:** search across frames without manual frame switching.
|
|
101
|
+
* **Automatic alert handling:** manage unexpected browser alerts.
|
|
102
|
+
* **Shadow DOM support:** locate and interact with elements inside open shadow roots when enabled.
|
|
103
|
+
* **Built-in bitmap comparison:** identify and verify elements by their visual appearance.
|
|
104
|
+
* **Python API and extensibility:** use QWeb directly from Python or build custom keywords that reuse its search and interaction functionality.
|
|
105
|
+
* **Technology agnostic:** works across a wide range of web technologies and frameworks.
|
|
106
|
+
|
|
107
|
+
### Quick Example
|
|
108
|
+
|
|
109
|
+
```RobotFramework
|
|
110
|
+
*** Settings ***
|
|
111
|
+
Library QWeb
|
|
112
|
+
|
|
113
|
+
*** Test Cases ***
|
|
114
|
+
User Can Log In
|
|
115
|
+
OpenBrowser https://example.com chrome
|
|
116
|
+
TypeText Email demo@example.com
|
|
117
|
+
TypeSecret Password ${PASSWORD}
|
|
118
|
+
ClickText Sign in
|
|
119
|
+
VerifyText Dashboard
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Supply `${PASSWORD}` externally, for example through a Robot Framework variable.
|
|
124
|
+
|
|
125
|
+
See more [examples](#examples), including [direct Python usage](#running-with-python).
|
|
126
|
+
|
|
127
|
+
[Back To The Top](#qweb)
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
## Requirements
|
|
131
|
+
Python **3.11-3.14** and Robot Framework 7.0 or above.
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
## Installation
|
|
135
|
+
|
|
136
|
+
### Windows
|
|
137
|
+
```bash
|
|
138
|
+
python -m pip install QWeb
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Linux/Mac
|
|
142
|
+
|
|
143
|
+
Some Linux distributions (Ubuntu) use snap to install browsers, which can cause problems with non-default binary paths,
|
|
144
|
+
user data directories and profile locations. We suggest installing the browser via terminal, for example:
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
|
|
148
|
+
sudo apt-get install -y ./google-chrome-stable_current_amd64.deb
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Make sure the following dependencies are installed:
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
sudo apt-get install python3-tk python3-dev scrot
|
|
155
|
+
python3 -m pip install python-xlib
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Then install QWeb:
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
python3 -m pip install -U pip
|
|
162
|
+
python3 -m pip install QWeb
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
The above command also installs supported versions of Selenium and Robot Framework, along with other dependencies.
|
|
166
|
+
|
|
167
|
+
### Automatic browser & driver management
|
|
168
|
+
Since Selenium 4.10.0, browser drivers can be automatically downloaded and installed using Selenium Manager, provided that the driver is not found in PATH.
|
|
169
|
+
|
|
170
|
+
For Chrome, `browser_version` can also be given; if your locally installed Chrome matches this version,
|
|
171
|
+
it will be used. If not, a suitable version of `Chrome for Testing` will be automatically downloaded.
|
|
172
|
+
|
|
173
|
+
See examples in the [OpenBrowser keyword documentation](https://qentinelqi.github.io/qweb/QWeb.html#Open%20Browser)
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
### Manual driver management
|
|
177
|
+
For manual installation of drivers, see the [Selenium documentation](https://www.selenium.dev/selenium/docs/api/py/index.html#drivers).
|
|
178
|
+
|
|
179
|
+
NOTE: Manual driver management should only be used in exceptional cases. Letting Selenium Manager handle
|
|
180
|
+
drivers is the preferred, less error-prone option.
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
[Back To The Top](#qweb)
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
## Usage
|
|
190
|
+
|
|
191
|
+
### Documentation
|
|
192
|
+
|
|
193
|
+
* [QWeb documentation](https://qentinelqi.github.io/qweb/index.html) – guides for installation, locators, frames, Shadow DOM and common tasks.
|
|
194
|
+
* [Locator Strategies](https://qentinelqi.github.io/qweb/concepts/locators.html) – choosing and using text, attribute, CSS, XPath and image-based locators.
|
|
195
|
+
* [Shadow DOM](https://qentinelqi.github.io/qweb/concepts/shadow_dom.html) – working with elements inside shadow roots.
|
|
196
|
+
* [Keyword Reference](https://qentinelqi.github.io/qweb/QWeb.html) – available keywords, arguments and usage examples.
|
|
197
|
+
* [Copado Robotic Testing documentation](https://docs.copado.com/articles/#!copado-robotic-testing-publication/all-qwords)
|
|
198
|
+
* [QWeb tutorial](https://github.com/qentinelqi/qweb_workshop) – practical examples and exercises.
|
|
199
|
+
|
|
200
|
+
[Back To The Top](#qweb)
|
|
201
|
+
|
|
202
|
+
### Examples
|
|
203
|
+
|
|
204
|
+
#### Basic usage
|
|
205
|
+
|
|
206
|
+
The simplest way to interact with web elements is often by their **visible text**. Elements such as input fields and dropdowns can also be found by their nearest label.
|
|
207
|
+
|
|
208
|
+
```RobotFramework
|
|
209
|
+
*** Settings ***
|
|
210
|
+
Library QWeb # Import library
|
|
211
|
+
|
|
212
|
+
*** Test Cases ***
|
|
213
|
+
Basic interaction
|
|
214
|
+
OpenBrowser https://qentinelqi.github.io/shop chrome # Open Chrome and go to the given URL
|
|
215
|
+
VerifyText The animal friendly clothing company # Assert heading text
|
|
216
|
+
ClickText Scar the Lion # Click link text
|
|
217
|
+
ClickText Add to cart # Click button with specific text
|
|
218
|
+
DropDown Size Large # Select value (Large) from dropdown (Size)
|
|
219
|
+
|
|
220
|
+
```
|
|
221
|
+
#### Locator strategies
|
|
222
|
+
|
|
223
|
+
QWeb provides several complementary locator strategies with different levels of abstraction. The locator strategy is typically expressed through the keyword name itself, making the intent of each interaction clear.
|
|
224
|
+
|
|
225
|
+
| Strategy | Example |
|
|
226
|
+
|---|---|
|
|
227
|
+
| Visible text | `ClickText Save` |
|
|
228
|
+
| Attribute value | `ClickItem save-button` |
|
|
229
|
+
| CSS selector | `ClickElement css\=button#save` |
|
|
230
|
+
| XPath | `ClickElement //button[@id\="save"]` |
|
|
231
|
+
| Reference image | `ClickIcon save.png` |
|
|
232
|
+
|
|
233
|
+
Text and Item locators reduce dependencies on the underlying implementation, while CSS and XPath provide greater control when more precise element identification is needed.
|
|
234
|
+
|
|
235
|
+
QWeb also supports custom CSS text filters (QWeb extensions, not standard CSS), allowing structural and attribute-based selectors to be combined with visible text matching.
|
|
236
|
+
|
|
237
|
+
```RobotFramework
|
|
238
|
+
# Partial text matching
|
|
239
|
+
ClickElement css\=div.card:has-text("Products")
|
|
240
|
+
|
|
241
|
+
# Exact text matching
|
|
242
|
+
ClickElement css\=button.primary:text-is("Save")
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
Some keywords, such as `TypeText` and `GetText`, support multiple locator strategies for added flexibility.
|
|
246
|
+
|
|
247
|
+
```RobotFramework
|
|
248
|
+
TypeText Email demo@example.com
|
|
249
|
+
TypeText css\=input[name\="email"] demo@example.com
|
|
250
|
+
|
|
251
|
+
${price}= GetText Total
|
|
252
|
+
${price}= GetText css\=#cart .total
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
In Robot Framework source, escape equals signs in literal XPath and CSS locators with a backslash (`\=`).
|
|
256
|
+
|
|
257
|
+
See the [Locator Strategies guide](https://qentinelqi.github.io/qweb/concepts/locators.html) for detailed explanations, supported keywords, Shadow DOM compatibility and usage examples.
|
|
258
|
+
|
|
259
|
+
#### Timeouts and anchors
|
|
260
|
+
|
|
261
|
+
By default, QWeb tries to locate an element for 10 seconds. The default timeout is configurable, and a timeout can also be specified for individual keywords.
|
|
262
|
+
|
|
263
|
+
When text is not unique, use `anchor` to pick the instance closest to some nearby text, or `index` to pick it by position.
|
|
264
|
+
|
|
265
|
+
```RobotFramework
|
|
266
|
+
ClickText Sign in
|
|
267
|
+
ClickText Sign in timeout=30
|
|
268
|
+
|
|
269
|
+
ClickText Sign in anchor=Email # instance closest to the text "Email"
|
|
270
|
+
ClickText Sign in index=3 # third instance
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
For backward compatibility, a numeric `anchor` (for example `anchor=3`) is still treated as an index. New tests should use `index` instead.
|
|
274
|
+
|
|
275
|
+
#### Shadow DOM and visibility
|
|
276
|
+
|
|
277
|
+
Modern web applications often use Shadow DOM to encapsulate components. Shadow DOM searching is off by default, so searches stay in the light DOM and don't pick up unintended matches from inside components. When you enable it, QWeb automatically searches open shadow roots too, without you having to locate shadow hosts or traverse shadow boundaries yourself.
|
|
278
|
+
|
|
279
|
+
```RobotFramework
|
|
280
|
+
SetConfig ShadowDOM True # Search both light DOM and open shadow roots
|
|
281
|
+
SetConfig ShadowDOM False # Search light DOM only
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
When Shadow DOM searching is enabled, Text, Item and CSS locators can find elements inside open shadow roots, and so can the input keywords listed in the [Locator Strategies guide](https://qentinelqi.github.io/qweb/concepts/locators.html).
|
|
285
|
+
|
|
286
|
+
```RobotFramework
|
|
287
|
+
ClickText Save
|
|
288
|
+
ClickItem save-button
|
|
289
|
+
ClickElement css\=button#save
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
CSS locators find elements inside open shadow roots, including nested ones. However, the whole selector must match inside a single shadow root (or the light DOM). You cannot write a selector that starts outside a shadow root and continues inside it, and shadow-piercing syntax such as `>>` or `>>>` is not supported.
|
|
293
|
+
|
|
294
|
+
```RobotFramework
|
|
295
|
+
ClickElement css\=.actions button # Works: .actions and button are in the same shadow root
|
|
296
|
+
ClickElement css\=settings-panel .actions button # Fails: settings-panel is the shadow host, .actions is inside its shadow root
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
XPath cannot find elements inside shadow roots.
|
|
300
|
+
|
|
301
|
+
QWeb searches for visible elements by default. Visibility-related search behavior can be configured using `SetConfig` and the following settings:
|
|
302
|
+
|
|
303
|
+
* `Visibility`
|
|
304
|
+
* `Offsetcheck`
|
|
305
|
+
* `InViewport`
|
|
306
|
+
|
|
307
|
+
Example:
|
|
308
|
+
|
|
309
|
+
```RobotFramework
|
|
310
|
+
*** Settings ***
|
|
311
|
+
Library QWeb
|
|
312
|
+
|
|
313
|
+
*** Test Cases ***
|
|
314
|
+
Click Shadow DOM Element
|
|
315
|
+
SetConfig ShadowDOM True
|
|
316
|
+
OpenBrowser chrome://settings/content/popups chrome
|
|
317
|
+
ClickText Sites can send pop-ups
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
See the [Shadow DOM guide](https://qentinelqi.github.io/qweb/concepts/shadow_dom.html) and keyword documentation for more information.
|
|
321
|
+
|
|
322
|
+
#### Working with tables
|
|
323
|
+
|
|
324
|
+
QWeb includes keywords for easy interaction with table data.
|
|
325
|
+
|
|
326
|
+
Consider the following table as an example:
|
|
327
|
+
<img src="https://github.com/qentinelqi/qweb/raw/master/images/example_table.png" alt="Example table">
|
|
328
|
+
|
|
329
|
+
```RobotFramework
|
|
330
|
+
UseTable Firstname
|
|
331
|
+
|
|
332
|
+
${row}= GetTableRow //last # returns 5
|
|
333
|
+
${row}= GetTableRow //last skip_header=True # returns 4
|
|
334
|
+
...
|
|
335
|
+
${row}= GetTableRow Jim # returns 4
|
|
336
|
+
${row}= GetTableRow Jim skip_header=True # returns 3
|
|
337
|
+
|
|
338
|
+
${cell_value}= GetCellText r1c2 # Returns "John", first name is column 2.
|
|
339
|
+
|
|
340
|
+
${cell_value}= GetCellText r-1/c2 # Returns "Tina", -1 points to last row
|
|
341
|
+
${cell_value}= GetCellText r-2/c2 # Returns "Jim", -2 points to second last row
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
#### Changing configuration
|
|
345
|
+
QWeb's behavior can be changed with the `SetConfig` keyword.
|
|
346
|
+
|
|
347
|
+
```RobotFramework
|
|
348
|
+
|
|
349
|
+
SetConfig SearchMode Draw # Highlight all found elements with blue rectangle
|
|
350
|
+
|
|
351
|
+
SetConfig DefaultTimeout 60s # change default/automatic timeout for all keywords
|
|
352
|
+
VerifyText User account created # Retries for up to 60 seconds, then fails if the text is not visible
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
#### Running with Python
|
|
356
|
+
QWeb can be used directly from Python without running Robot Framework test cases. Its Python API provides the same high-level automation approach and can be integrated into Python scripts, applications and other test frameworks.
|
|
357
|
+
|
|
358
|
+
```Python
|
|
359
|
+
|
|
360
|
+
from QWeb import QWeb
|
|
361
|
+
|
|
362
|
+
qweb = QWeb()
|
|
363
|
+
|
|
364
|
+
qweb.open_browser("about:blank", "chrome")
|
|
365
|
+
qweb.go_to("https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_select")
|
|
366
|
+
title = qweb.get_title()
|
|
367
|
+
# returns 'W3Schools Tryit Editor'
|
|
368
|
+
qweb.verify_text("The select element")
|
|
369
|
+
qweb.drop_down("Choose a car", "Saab")
|
|
370
|
+
qweb.click_text("Submit")
|
|
371
|
+
qweb.verify_text("Your input was received as:")
|
|
372
|
+
qweb.verify_text("cars=saab")
|
|
373
|
+
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
CSS selectors can also be used directly from Python. Robot Framework's equals-sign escaping is not needed in Python strings:
|
|
377
|
+
|
|
378
|
+
```Python
|
|
379
|
+
qweb.click_element('css=button.primary:text-is("Save")')
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
#### Extending QWeb with custom keywords
|
|
383
|
+
|
|
384
|
+
QWeb can also serve as a foundation for application-specific automation libraries. Custom Python keywords can combine existing QWeb operations or reuse its element search functions to implement specialized interactions without duplicating the underlying search logic.
|
|
385
|
+
|
|
386
|
+
For example, a custom Robot Framework library can compose QWeb operations into a reusable business-level keyword:
|
|
387
|
+
|
|
388
|
+
```Python
|
|
389
|
+
# CustomKeywords.py
|
|
390
|
+
from robot.libraries.BuiltIn import BuiltIn
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
class CustomKeywords:
|
|
394
|
+
@property
|
|
395
|
+
def qweb(self):
|
|
396
|
+
# Reuse the QWeb instance imported by the test suite
|
|
397
|
+
return BuiltIn().get_library_instance("QWeb")
|
|
398
|
+
|
|
399
|
+
def save_changes(self):
|
|
400
|
+
self.qweb.click_text("Save")
|
|
401
|
+
self.qweb.verify_text("Changes saved")
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
```RobotFramework
|
|
405
|
+
*** Settings ***
|
|
406
|
+
Library QWeb
|
|
407
|
+
Library CustomKeywords.py
|
|
408
|
+
|
|
409
|
+
*** Test Cases ***
|
|
410
|
+
Save Settings
|
|
411
|
+
OpenBrowser https://example.com/settings chrome
|
|
412
|
+
Save Changes
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
When using internal modules rather than the public QWeb API, check compatibility with the QWeb version in use.
|
|
416
|
+
|
|
417
|
+
More examples in the [QWeb tutorial](https://github.com/qentinelqi/qweb_workshop).
|
|
418
|
+
|
|
419
|
+
[Back To The Top](#qweb)
|
|
420
|
+
|
|
421
|
+
---
|
|
422
|
+
|
|
423
|
+
## Changelog
|
|
424
|
+
|
|
425
|
+
See [RELEASE.md](https://github.com/qentinelqi/qweb/blob/master/RELEASE.md)
|
|
426
|
+
|
|
427
|
+
[Back To The Top](#qweb)
|
|
428
|
+
|
|
429
|
+
## Contribute
|
|
430
|
+
|
|
431
|
+
Found a bug? Want to propose a new feature or improve documentation? Please start by checking our [contribution guide](https://github.com/qentinelqi/qweb/blob/master/CONTRIBUTING.md)
|
|
432
|
+
|
|
433
|
+
[Back To The Top](#qweb)
|
|
434
|
+
|
|
435
|
+
## Community
|
|
436
|
+
|
|
437
|
+
Want to join the community on Slack? On the official Robot Framework workspace, there is a QWeb channel where you can discuss keywords, issues and improvements with others. [Join Now](https://robotframework.slack.com/archives/C029L0N3N81)
|
|
438
|
+
|
|
439
|
+
[Back To The Top](#qweb)
|
|
440
|
+
|
|
441
|
+
## License
|
|
442
|
+
|
|
443
|
+
Apache 2.0 License. See [LICENSE](https://github.com/qentinelqi/qweb/blob/master/LICENSE).
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
[Back To The Top](#qweb)
|
|
447
|
+
|
|
448
|
+
## Resources
|
|
449
|
+
* [QWeb home page](https://qentinel.com/qweb-open-source/)
|
|
450
|
+
* [QWeb tutorial](https://github.com/qentinelqi/qweb_workshop)
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
---
|
|
455
|
+
[license-badge]: https://img.shields.io/github/license/qentinelqi/qweb
|
|
456
|
+
[linux_ci_badge]: https://github.com/qentinelqi/qweb/actions/workflows/linux_acceptance.yml/badge.svg
|
|
457
|
+
[win_ci_badge]: https://github.com/qentinelqi/qweb/actions/workflows/win_acceptance.yml/badge.svg
|
|
458
|
+
[macos_ci_badge]: https://github.com/qentinelqi/qweb/actions/workflows/mac_acceptance.yml/badge.svg
|
|
459
|
+
[pace-url]: https://robotic.copado.com
|
|
460
|
+
[pace-badge]: https://img.shields.io/badge/Tested%20with-Copado%20Robotic%20Testing-blue
|
|
461
|
+
[python-versions-badge]: https://img.shields.io/pypi/pyversions/QWeb
|
|
462
|
+
[pypi-badge]: https://img.shields.io/pypi/v/QWeb?color=green
|
|
463
|
+
[slack-badge]: https://img.shields.io/badge/Slack-QWeb-blue?style=flat-square&logo=Slack
|
|
464
|
+
[slack-url]: https://robotframework.slack.com/archives/C029L0N3N81
|
|
465
|
+
|