QWeb 3.8.0__tar.gz → 3.8.2__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.8.0 → qweb-3.8.2}/PKG-INFO +4 -5
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/__init__.py +0 -2
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/_version.py +3 -3
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/bidi.py +2 -2
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/browser/chrome.py +5 -1
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/browser/edge.py +6 -1
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/element.py +2 -13
- qweb-3.8.2/QWeb/internal/js/install_monitor.js +133 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/js/wait_status_lite.js +2 -2
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/user.py +14 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/util.py +51 -3
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/keywords/browser.py +14 -6
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/keywords/element.py +8 -1
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/keywords/input_.py +4 -42
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/keywords/table.py +30 -4
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/keywords/window.py +2 -2
- {qweb-3.8.0 → qweb-3.8.2}/QWeb.egg-info/PKG-INFO +4 -5
- {qweb-3.8.0 → qweb-3.8.2}/QWeb.egg-info/SOURCES.txt +0 -1
- {qweb-3.8.0 → qweb-3.8.2}/QWeb.egg-info/requires.txt +2 -2
- {qweb-3.8.0 → qweb-3.8.2}/README.md +1 -2
- {qweb-3.8.0 → qweb-3.8.2}/pyproject.toml +2 -2
- qweb-3.8.0/QWeb/internal/js/install_monitor.js +0 -83
- qweb-3.8.0/QWeb/keywords/search_strategy.py +0 -264
- {qweb-3.8.0 → qweb-3.8.2}/LICENSE +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/MANIFEST.in +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/__main__.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/custom_config.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/__init__.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/actions.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/ajax.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/alert.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/blocks.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/browser/__init__.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/browser/android.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/browser/bs_desktop.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/browser/bs_mobile.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/browser/firefox.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/browser/safari.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/checkbox.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/config.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/config_defaults.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/cookies.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/decorators.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/download.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/dragdrop.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/dropdown.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/exceptions.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/file.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/frame.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/frame_checker.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/icon.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/input_.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/input_handler.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/javascript.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/js/find_text_from_textnodes.js +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/js/get_all_dropdown_elements_shadow_dom.js +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/js/get_all_frames_from_shadow_dom.js +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/js/get_all_input_elements_from_shadow_dom.js +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/js/get_by_attributes.js +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/js/get_by_label.js +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/js/get_childnodes.js +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/js/get_clickable.js +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/js/get_clickable_from_shadow_dom.js +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/js/get_item_elements_from_shadow_dom.js +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/js/get_parent_list.js +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/js/get_recursive_walk.js +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/js/get_text_elements_from_shadow_dom.js +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/js/get_visibility.js +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/js/highlight_element.js +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/js/spinner_busy.js +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/js/toast_notification.js +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/lists.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/meas.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/platform.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/screenshot.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/search_strategy.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/secrets.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/table.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/text.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/window.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/internal/xhr.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/keywords/__init__.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/keywords/ajax.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/keywords/alert.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/keywords/bidi.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/keywords/blocks.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/keywords/checkbox.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/keywords/config.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/keywords/cookies.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/keywords/debug.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/keywords/download.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/keywords/dragdrop.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/keywords/dropdown.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/keywords/file.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/keywords/frame.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/keywords/icon.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/keywords/javascript.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/keywords/lists.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/keywords/mouse.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/keywords/screenshot.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb/keywords/text.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb.egg-info/dependency_links.txt +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/QWeb.egg-info/top_level.txt +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/example/CustomerLibrary/CustomerLib.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/example/CustomerLibrary/decorators.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/setup.cfg +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/setup.py +0 -0
- {qweb-3.8.0 → qweb-3.8.2}/versioneer.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: qweb
|
|
3
|
-
Version: 3.8.
|
|
3
|
+
Version: 3.8.2
|
|
4
4
|
Summary: Keyword driven automation for the web
|
|
5
5
|
Author-email: "Copado Inc." <copadorobotictesting@copado.com>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -19,10 +19,10 @@ Requires-Dist: setuptools>=78.1.1
|
|
|
19
19
|
Requires-Dist: pyscreeze==0.1.28
|
|
20
20
|
Requires-Dist: pyautogui>=0.9.53
|
|
21
21
|
Requires-Dist: pynput>=1.8.0
|
|
22
|
-
Requires-Dist: pypdf>=6.
|
|
22
|
+
Requires-Dist: pypdf>=6.15.0
|
|
23
23
|
Requires-Dist: pyperclip==1.9.0
|
|
24
24
|
Requires-Dist: requests>=2.33.0
|
|
25
|
-
Requires-Dist: robotframework<8,>=
|
|
25
|
+
Requires-Dist: robotframework<8,>=7.0
|
|
26
26
|
Requires-Dist: robotframework-debuglibrary==2.5.0
|
|
27
27
|
Requires-Dist: selenium<5,>=4.27.0
|
|
28
28
|
Requires-Dist: Pillow>=12.2.0
|
|
@@ -115,9 +115,8 @@ See more [examples](#examples).
|
|
|
115
115
|
|
|
116
116
|
---
|
|
117
117
|
## Requirements
|
|
118
|
-
Python **3.10-3.13** and Robot Framework
|
|
118
|
+
Python **3.10-3.13** and Robot Framework 7.0 or above.
|
|
119
119
|
|
|
120
|
-
(Note that support on Macs with Apple based silicon (M1) requires MacOS version 12/Monterey or above or [custom installation](https://github.com/qentinelqi/qweb/blob/master/docs/qweb_mac_m1_installation.md).)
|
|
121
120
|
|
|
122
121
|
## Installation
|
|
123
122
|
|
|
@@ -8,11 +8,11 @@ import json
|
|
|
8
8
|
|
|
9
9
|
version_json = '''
|
|
10
10
|
{
|
|
11
|
-
"date": "2026-
|
|
11
|
+
"date": "2026-08-21T16:00:17+0300",
|
|
12
12
|
"dirty": false,
|
|
13
13
|
"error": null,
|
|
14
|
-
"full-revisionid": "
|
|
15
|
-
"version": "3.8.
|
|
14
|
+
"full-revisionid": "bba4cc6e80d6b4e8110f0805bd8d7c8528c9279e",
|
|
15
|
+
"version": "3.8.2"
|
|
16
16
|
}
|
|
17
17
|
''' # END VERSION_JSON
|
|
18
18
|
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
# See the License for the specific language governing permissions and
|
|
15
15
|
# limitations under the License.
|
|
16
16
|
# ---------------------------
|
|
17
|
-
|
|
17
|
+
import dataclasses
|
|
18
18
|
from collections import deque
|
|
19
19
|
from enum import Enum
|
|
20
20
|
# Name change in Selenium 4.44 nightly
|
|
@@ -75,7 +75,7 @@ level_aliases = {
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
|
|
78
|
-
@dataclass(frozen=True)
|
|
78
|
+
@dataclasses.dataclass(frozen=True)
|
|
79
79
|
class ConsoleMsg:
|
|
80
80
|
ts: float
|
|
81
81
|
level: LogLevel
|
|
@@ -131,7 +131,11 @@ def create_chrome_options(chrome_args: Optional[list[str]], **kwargs: Any) -> Op
|
|
|
131
131
|
if chrome_version:
|
|
132
132
|
options.browser_version = chrome_version
|
|
133
133
|
|
|
134
|
-
|
|
134
|
+
apparmor_restricted = user.apparmor_userns_restricted()
|
|
135
|
+
if apparmor_restricted:
|
|
136
|
+
logger.info("Linux Chrome detected with AppArmor user namespace restrictions enabled.")
|
|
137
|
+
logger.info("Adding --no-sandbox to work around Chromium sandbox initialization.")
|
|
138
|
+
if user.is_root() or apparmor_restricted:
|
|
135
139
|
options.add_argument("no-sandbox")
|
|
136
140
|
|
|
137
141
|
return options
|
|
@@ -77,7 +77,12 @@ def create_edge_options(edge_args: Optional[list[str]], **kwargs: Any) -> Option
|
|
|
77
77
|
options = Options()
|
|
78
78
|
options.add_experimental_option("excludeSwitches", ["enable-logging"]) # pylint: disable=no-member
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
apparmor_restricted = user.apparmor_userns_restricted()
|
|
81
|
+
# Handle AppArmor user namespace restrictions on Linux Chromium-based browsers (like Edge)
|
|
82
|
+
if apparmor_restricted:
|
|
83
|
+
logger.info("Linux Edge detected with AppArmor user namespace restrictions enabled.")
|
|
84
|
+
logger.info("Adding --no-sandbox to work around Chromium sandbox initialization.")
|
|
85
|
+
if user.is_root() or user.is_docker() or apparmor_restricted:
|
|
81
86
|
options.add_argument("no-sandbox") # pylint: disable=no-member
|
|
82
87
|
if edge_args:
|
|
83
88
|
if any("--headless" in _.lower() for _ in edge_args):
|
|
@@ -209,8 +209,8 @@ def get_webelements(xpath: str, **kwargs: Any) -> list[WebElement]:
|
|
|
209
209
|
|
|
210
210
|
|
|
211
211
|
@frame.all_frames
|
|
212
|
-
def
|
|
213
|
-
"""Get visible web
|
|
212
|
+
def get_webelements_by_css(css: str, **kwargs: Any) -> list[WebElement]:
|
|
213
|
+
"""Get visible web elements that correspond to given css selector.
|
|
214
214
|
|
|
215
215
|
To check that element is visible it is checked that it has width. This
|
|
216
216
|
does not handle all cases but it is fast so no need to modify if it
|
|
@@ -227,21 +227,10 @@ def get_webelement_by_css(css: str, **kwargs: Any) -> Union[WebElement, list[Web
|
|
|
227
227
|
:obj:`list` of :obj:`WebElement`
|
|
228
228
|
List of visible WebElements.
|
|
229
229
|
"""
|
|
230
|
-
index = kwargs.get("index", 1)
|
|
231
230
|
driver = browser.get_current_browser()
|
|
232
231
|
web_elements = driver.find_elements(By.CSS_SELECTOR, css)
|
|
233
232
|
logger.debug("CSS selector {} matched {} WebElements".format(css, len(web_elements)))
|
|
234
233
|
web_elements = get_visible_elements_from_elements(web_elements, **kwargs)
|
|
235
|
-
|
|
236
|
-
index = int(index) - 1
|
|
237
|
-
if len(web_elements) >= 1:
|
|
238
|
-
try:
|
|
239
|
-
return web_elements[index]
|
|
240
|
-
except IndexError as ie:
|
|
241
|
-
raise QWebValueError(
|
|
242
|
-
f"Used index {index} was greater than amount of found elements."
|
|
243
|
-
) from ie
|
|
244
|
-
|
|
245
234
|
return web_elements
|
|
246
235
|
|
|
247
236
|
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
// JS_INSTALL_MONITOR
|
|
2
|
+
// Installs network/DOM activity monitors into the page (fetch, XHR, MutationObserver).
|
|
3
|
+
// Always returns true on success (even if some patches are skipped).
|
|
4
|
+
// The optional `debug` flag (default: false) is used only for troubleshooting.
|
|
5
|
+
// ...full code below...
|
|
6
|
+
return (function (debug = false) {
|
|
7
|
+
if (window.__xhrMon && window.__xhrMon.installed) return true;
|
|
8
|
+
|
|
9
|
+
window.__xhrMon = Object.assign(window.__xhrMon || {}, {
|
|
10
|
+
installed: true,
|
|
11
|
+
pending: (window.__xhrMon && typeof window.__xhrMon.pending === "number") ? window.__xhrMon.pending : 0,
|
|
12
|
+
fetchPatched: false,
|
|
13
|
+
xhrPatched: false,
|
|
14
|
+
lastMutationTs: performance.now(),
|
|
15
|
+
observerStarted: false
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
try {
|
|
19
|
+
if (!window.__xhrMon.fetchPatched && typeof window.fetch === "function") {
|
|
20
|
+
const _fetch = window.fetch;
|
|
21
|
+
window.fetch = function() {
|
|
22
|
+
let p = _fetch.apply(this, arguments);
|
|
23
|
+
try {
|
|
24
|
+
const dec = function(){ try { window.__xhrMon.pending--; } catch(e) {} };
|
|
25
|
+
p = p && typeof p.finally === "function"
|
|
26
|
+
? p.finally(dec)
|
|
27
|
+
: p.then(function(r){ dec(); return r; }, function(e){ dec(); throw e; });
|
|
28
|
+
window.__xhrMon.pending++;
|
|
29
|
+
} catch(e) {
|
|
30
|
+
if (debug) console.error("XHR monitor: error in fetch", e);
|
|
31
|
+
}
|
|
32
|
+
return p;
|
|
33
|
+
};
|
|
34
|
+
window.__xhrMon.fetchPatched = true;
|
|
35
|
+
}
|
|
36
|
+
} catch(e){if (debug) console.warn("XHR monitor: fetch patch failed", e);}
|
|
37
|
+
|
|
38
|
+
try {
|
|
39
|
+
if (!window.__xhrMon.xhrPatched && window.XMLHttpRequest && window.XMLHttpRequest.prototype) {
|
|
40
|
+
const _open = XMLHttpRequest.prototype.open;
|
|
41
|
+
const _send = XMLHttpRequest.prototype.send;
|
|
42
|
+
const _addEventListener = XMLHttpRequest.prototype.addEventListener;
|
|
43
|
+
const _getReadyState = Object.getOwnPropertyDescriptor(XMLHttpRequest.prototype, "readyState").get;
|
|
44
|
+
XMLHttpRequest.prototype.open = function() {
|
|
45
|
+
const returnVal = _open.apply(this, arguments);
|
|
46
|
+
try {
|
|
47
|
+
if (!this.__xhrOpened) {
|
|
48
|
+
_addEventListener.call(this, "loadend", done);
|
|
49
|
+
_addEventListener.call(this, "abort", done);
|
|
50
|
+
_addEventListener.call(this, "error", done);
|
|
51
|
+
_addEventListener.call(this, "timeout", done);
|
|
52
|
+
_addEventListener.call(this, "readystatechange", readystatechange);
|
|
53
|
+
this.__xhrOpened = true;
|
|
54
|
+
} else {
|
|
55
|
+
// In case of re-opened XHR, consider the previous request done
|
|
56
|
+
done.apply(this); //automatically checks if this was actually pending before decrementing
|
|
57
|
+
this.__xhrSent = false;
|
|
58
|
+
this.__xhrDone = false;
|
|
59
|
+
}
|
|
60
|
+
} catch(e) {
|
|
61
|
+
if (debug) console.error("XHR monitor: error in open", e);
|
|
62
|
+
}
|
|
63
|
+
return returnVal;
|
|
64
|
+
};
|
|
65
|
+
XMLHttpRequest.prototype.send = function() {
|
|
66
|
+
const returnVal = _send.apply(this, arguments);
|
|
67
|
+
try {
|
|
68
|
+
// Check for long-polling in request body
|
|
69
|
+
let isLongPolling = false;
|
|
70
|
+
if (arguments[0]) {
|
|
71
|
+
try {
|
|
72
|
+
const body = typeof arguments[0] === "string" ? arguments[0] : JSON.stringify(arguments[0]);
|
|
73
|
+
if (body && body.indexOf('"connectionType":"long-polling"') !== -1) {
|
|
74
|
+
isLongPolling = true;
|
|
75
|
+
}
|
|
76
|
+
} catch(e) {}
|
|
77
|
+
}
|
|
78
|
+
if (this.__xhrOpened && !isLongPolling && !this.__xhrSent) {
|
|
79
|
+
try {
|
|
80
|
+
this.__xhrSent = true;
|
|
81
|
+
window.__xhrMon.pending++;
|
|
82
|
+
if (debug) {
|
|
83
|
+
console.log("XHR monitor: waiting for request, pending count:", window.__xhrMon.pending);
|
|
84
|
+
}
|
|
85
|
+
} catch(e) {
|
|
86
|
+
if (debug) console.error("XHR monitor: error in send", e);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
} catch(e) {
|
|
90
|
+
if (debug) console.error("XHR monitor: error in send", e);
|
|
91
|
+
}
|
|
92
|
+
return returnVal;
|
|
93
|
+
};
|
|
94
|
+
function done() {
|
|
95
|
+
try {
|
|
96
|
+
if (!(this.__xhrOpened && this.__xhrSent) || this.__xhrDone) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
this.__xhrDone = true;
|
|
100
|
+
window.__xhrMon.pending--;
|
|
101
|
+
if (debug) {
|
|
102
|
+
console.log("XHR monitor: request ended, pending count:", window.__xhrMon.pending);
|
|
103
|
+
}
|
|
104
|
+
} catch(e) {
|
|
105
|
+
if (debug) console.error("XHR monitor: error in done", e);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
function readystatechange() {
|
|
109
|
+
const readyState = _getReadyState.apply(this);
|
|
110
|
+
if (readyState === 4 || readyState === 0) {
|
|
111
|
+
// readyState === 4 means DONE
|
|
112
|
+
// readyState === 0 means UNSENT and can also mean aborted or failed
|
|
113
|
+
// In both cases we consider the request done
|
|
114
|
+
done.apply(this);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
window.__xhrMon.xhrPatched = true;
|
|
118
|
+
}
|
|
119
|
+
} catch(e){ if (debug) console.warn("XHR monitor: xhr patch failed", e);}
|
|
120
|
+
|
|
121
|
+
try {
|
|
122
|
+
if (!window.__xhrMon.observerStarted && window.MutationObserver) {
|
|
123
|
+
const obs = new MutationObserver(function(){ window.__xhrMon.lastMutationTs = performance.now(); });
|
|
124
|
+
obs.observe(document.documentElement || document.body || document, {
|
|
125
|
+
childList:true, subtree:true
|
|
126
|
+
});
|
|
127
|
+
window.__xhrMon.observerStarted = true;
|
|
128
|
+
}
|
|
129
|
+
} catch(e){if (debug) console.warn("XHR monitor: observer setup failed", e);}
|
|
130
|
+
|
|
131
|
+
if (debug) console.log("XHR monitor: setup complete");
|
|
132
|
+
return true;
|
|
133
|
+
})();
|
|
@@ -8,13 +8,13 @@ return (function (quietMs) {
|
|
|
8
8
|
if (typeof jQuery !== "undefined" && jQuery && typeof jQuery.active === "number") jqActive = jQuery.active;
|
|
9
9
|
} catch(e){}
|
|
10
10
|
|
|
11
|
-
var pending = 0, last =
|
|
11
|
+
var pending = 0, last = performance.now();
|
|
12
12
|
try {
|
|
13
13
|
pending = (window.__xhrMon && typeof window.__xhrMon.pending === "number") ? window.__xhrMon.pending : 0;
|
|
14
14
|
last = (window.__xhrMon && window.__xhrMon.lastMutationTs) ? window.__xhrMon.lastMutationTs : last;
|
|
15
15
|
} catch(e){}
|
|
16
16
|
|
|
17
|
-
var now =
|
|
17
|
+
var now = performance.now();
|
|
18
18
|
var domQuiet = (now - last) >= (quietMs || 400);
|
|
19
19
|
var networkIdle = (pending === 0) && (jqActive === null || jqActive === 0);
|
|
20
20
|
var idle = ready && networkIdle && domQuiet;
|
|
@@ -19,6 +19,7 @@ import os
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
def is_root() -> bool:
|
|
22
|
+
"""Check if running as root user."""
|
|
22
23
|
try:
|
|
23
24
|
# Windows doesn't have getuid. We just assume that user is not root. We
|
|
24
25
|
# most likely won't need proper Windows support here anyway.
|
|
@@ -32,9 +33,22 @@ def is_root() -> bool:
|
|
|
32
33
|
|
|
33
34
|
|
|
34
35
|
def is_docker() -> bool:
|
|
36
|
+
"""Check if running inside a Docker container."""
|
|
35
37
|
path = "/proc/self/cgroup"
|
|
36
38
|
return (
|
|
37
39
|
os.path.exists("/.dockerenv")
|
|
38
40
|
or os.path.isfile(path)
|
|
39
41
|
and any("docker" in line for line in open(path)) # noqa: W503,W1514
|
|
40
42
|
)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def apparmor_userns_restricted() -> bool:
|
|
46
|
+
"""Check if AppArmor user namespace restrictions are enabled on Linux."""
|
|
47
|
+
path = "/proc/sys/kernel/apparmor_restrict_unprivileged_userns"
|
|
48
|
+
# 0 - not restricted
|
|
49
|
+
# 1 - restricted
|
|
50
|
+
try:
|
|
51
|
+
with open(path) as f:
|
|
52
|
+
return f.read().strip() == "1"
|
|
53
|
+
except OSError:
|
|
54
|
+
return False
|
|
@@ -25,6 +25,7 @@ from robot.api import logger
|
|
|
25
25
|
from robot.libraries.BuiltIn import BuiltIn, RobotNotRunningError
|
|
26
26
|
from selenium.common.exceptions import StaleElementReferenceException, NoSuchElementException
|
|
27
27
|
from selenium.webdriver.remote.webelement import WebElement
|
|
28
|
+
import csv
|
|
28
29
|
import json
|
|
29
30
|
import platform
|
|
30
31
|
import re
|
|
@@ -339,14 +340,61 @@ def initial_logging(capabilities: dict[str, Any]) -> None:
|
|
|
339
340
|
def option_handler(options: Optional[str]) -> list[str]:
|
|
340
341
|
options2 = []
|
|
341
342
|
if options:
|
|
342
|
-
options2 += options
|
|
343
|
+
options2 += parse_option_list(options)
|
|
343
344
|
|
|
344
|
-
|
|
345
|
-
|
|
345
|
+
browser_options = get_rfw_variable_value("${BROWSER_OPTIONS}")
|
|
346
|
+
if browser_options:
|
|
347
|
+
options2 += parse_option_list(browser_options)
|
|
346
348
|
|
|
347
349
|
return options2
|
|
348
350
|
|
|
349
351
|
|
|
352
|
+
def parse_option_list(options: str) -> list[str]:
|
|
353
|
+
"""Parse comma-separated browser options while respecting quoted commas."""
|
|
354
|
+
parsed = next(csv.reader([options], skipinitialspace=True), [])
|
|
355
|
+
return [option.strip() for option in parsed if option.strip()]
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
def parse_env_option_list(options: str) -> list[str]:
|
|
359
|
+
"""Parse env-provided browser options using comma-space separators.
|
|
360
|
+
|
|
361
|
+
This preserves legacy CHROME_ARGS behavior where commas without a following
|
|
362
|
+
space are treated as part of a single option value.
|
|
363
|
+
"""
|
|
364
|
+
option_list = []
|
|
365
|
+
current_option = []
|
|
366
|
+
quote_char = None
|
|
367
|
+
|
|
368
|
+
for index, char in enumerate(options):
|
|
369
|
+
if char in {'"', "'"}:
|
|
370
|
+
if quote_char is None:
|
|
371
|
+
quote_char = char
|
|
372
|
+
elif quote_char == char:
|
|
373
|
+
quote_char = None
|
|
374
|
+
current_option.append(char)
|
|
375
|
+
continue
|
|
376
|
+
|
|
377
|
+
if (
|
|
378
|
+
char == ","
|
|
379
|
+
and quote_char is None
|
|
380
|
+
and index + 1 < len(options)
|
|
381
|
+
and options[index + 1].isspace()
|
|
382
|
+
):
|
|
383
|
+
option = "".join(current_option).strip().strip('"').strip("'")
|
|
384
|
+
if option:
|
|
385
|
+
option_list.append(option)
|
|
386
|
+
current_option = []
|
|
387
|
+
continue
|
|
388
|
+
|
|
389
|
+
current_option.append(char)
|
|
390
|
+
|
|
391
|
+
option = "".join(current_option).strip().strip('"').strip("'")
|
|
392
|
+
if option:
|
|
393
|
+
option_list.append(option)
|
|
394
|
+
|
|
395
|
+
return option_list
|
|
396
|
+
|
|
397
|
+
|
|
350
398
|
def get_rfw_variable_value(key: str, default_value=None) -> Any:
|
|
351
399
|
"""Return robot fw variable value if robot is running.
|
|
352
400
|
Returns default value if robot is not running."""
|
|
@@ -15,14 +15,14 @@
|
|
|
15
15
|
# limitations under the License.
|
|
16
16
|
# ---------------------------
|
|
17
17
|
from __future__ import annotations
|
|
18
|
-
|
|
18
|
+
import dataclasses
|
|
19
19
|
from typing import Union, Optional
|
|
20
20
|
from selenium.webdriver.remote.webdriver import WebDriver
|
|
21
21
|
from selenium.webdriver.common.by import By
|
|
22
22
|
|
|
23
23
|
import os
|
|
24
24
|
import requests
|
|
25
|
-
|
|
25
|
+
import importlib.metadata
|
|
26
26
|
from robot.api import logger
|
|
27
27
|
from robot.api.deco import keyword
|
|
28
28
|
from robot.libraries.BuiltIn import BuiltIn, RobotNotRunningError
|
|
@@ -42,7 +42,7 @@ from QWeb.internal.browser import (
|
|
|
42
42
|
from QWeb.internal.exceptions import QWebDriverError, QWebBrowserError
|
|
43
43
|
|
|
44
44
|
|
|
45
|
-
@dataclass
|
|
45
|
+
@dataclasses.dataclass
|
|
46
46
|
class BrowserInfo:
|
|
47
47
|
index: int
|
|
48
48
|
name: str
|
|
@@ -84,6 +84,11 @@ def open_browser(url: str,
|
|
|
84
84
|
Browser options can be set in with an environment variable CHROME_ARGS, for example:
|
|
85
85
|
export CHROME_ARGS="--kiosk, --disable-gpu"
|
|
86
86
|
|
|
87
|
+
If a single browser flag contains a comma, quote the whole flag so it stays as one option.
|
|
88
|
+
For example:
|
|
89
|
+
OpenBrowser about:blank chrome
|
|
90
|
+
... "--host-resolver-rules\=MAP * ~NOTFOUND , EXCLUDE client-proxy.local", --proxy-server\=socks5://client-proxy.local:54321
|
|
91
|
+
|
|
87
92
|
Examples
|
|
88
93
|
--------
|
|
89
94
|
.. code-block:: robotframework
|
|
@@ -123,6 +128,9 @@ def open_browser(url: str,
|
|
|
123
128
|
|
|
124
129
|
# Use proxy
|
|
125
130
|
OpenBrowser http://google.com chrome --proxy_server\=http://127.0.0.1:8080
|
|
131
|
+
# Quote the whole flag if the value contains a comma.
|
|
132
|
+
OpenBrowser about:blank chrome
|
|
133
|
+
... "--host-resolver-rules\=MAP * ~NOTFOUND , EXCLUDE client-proxy.local", --proxy-server\=socks5://client-proxy.local:54321
|
|
126
134
|
OpenBrowser http://google.com firefox
|
|
127
135
|
... prefs="network.proxy.type":"1","network.proxy.http":"localhost","network.proxy.http_port":"8080"
|
|
128
136
|
|
|
@@ -376,7 +384,7 @@ def open_browser(url: str,
|
|
|
376
384
|
if os.getenv("QWEB_HEADLESS"):
|
|
377
385
|
kwargs = {"headless": True}
|
|
378
386
|
if os.getenv("CHROME_ARGS") is not None:
|
|
379
|
-
option_list.extend(os.getenv("CHROME_ARGS", "")
|
|
387
|
+
option_list.extend(util.parse_env_option_list(os.getenv("CHROME_ARGS", "")))
|
|
380
388
|
logger.debug("Options: {}".format(option_list))
|
|
381
389
|
|
|
382
390
|
# Pass bidi to browser openers if True
|
|
@@ -710,9 +718,9 @@ def verify_links(
|
|
|
710
718
|
|
|
711
719
|
def _startup_logging() -> None:
|
|
712
720
|
try:
|
|
713
|
-
qweb_version = version("QWeb")
|
|
721
|
+
qweb_version = importlib.metadata.version("QWeb")
|
|
714
722
|
logger.info(f"QWeb version number: {qweb_version}", also_console=True)
|
|
715
|
-
except PackageNotFoundError:
|
|
723
|
+
except importlib.metadata.PackageNotFoundError:
|
|
716
724
|
logger.info("Could not find QWeb version number.")
|
|
717
725
|
number_of_open_sessions = _sessions_open()
|
|
718
726
|
if number_of_open_sessions > 0:
|
|
@@ -26,6 +26,8 @@ from QWeb.internal.exceptions import QWebValueError, QWebElementNotFoundError
|
|
|
26
26
|
from QWeb.internal import element, decorators, actions, text, input_, dropdown, checkbox
|
|
27
27
|
from QWeb.internal.config_defaults import CONFIG
|
|
28
28
|
|
|
29
|
+
import time
|
|
30
|
+
|
|
29
31
|
|
|
30
32
|
@keyword(tags=["Interaction"])
|
|
31
33
|
@decorators.timeout_decorator
|
|
@@ -517,7 +519,11 @@ def get_webelement(
|
|
|
517
519
|
locator, anchor, **kwargs
|
|
518
520
|
)[0]
|
|
519
521
|
elif element_type.lower() == "css":
|
|
520
|
-
|
|
522
|
+
web_element_list = element.get_webelements_by_css(locator, **kwargs)
|
|
523
|
+
if web_element_list:
|
|
524
|
+
web_elements = element.get_element_by_index(web_element_list, kwargs["index"])
|
|
525
|
+
else:
|
|
526
|
+
web_elements = web_element_list
|
|
521
527
|
else:
|
|
522
528
|
msg = (
|
|
523
529
|
f"Invalid 'element_type':'{element_type}'!\n"
|
|
@@ -887,6 +893,7 @@ def get_coordinates(
|
|
|
887
893
|
# scroll element into view and adjust scroll if needed
|
|
888
894
|
scrolled_position = webelement.location_once_scrolled_into_view
|
|
889
895
|
actions.scroll_overlay_adjustment(overlay_offset)
|
|
896
|
+
time.sleep(0.25) # wait for the scroll to complete and the page to stabilize
|
|
890
897
|
|
|
891
898
|
except Exception as e:
|
|
892
899
|
raise QWebValueError(f"Could not scroll element {locator} into view. Error: {e}") from e
|
|
@@ -42,46 +42,6 @@ from QWeb.keywords import browser
|
|
|
42
42
|
str_or_secret = Union[str, RFSecret]
|
|
43
43
|
|
|
44
44
|
|
|
45
|
-
@keyword(tags=("Config", "Input"))
|
|
46
|
-
def set_input_handler(input_method: str) -> None:
|
|
47
|
-
"""*DEPRECATED!!* Use keyword `SetConfig` instead.
|
|
48
|
-
|
|
49
|
-
Set input handler.
|
|
50
|
-
|
|
51
|
-
Default handler is "selenium" which uses Selenium librarys
|
|
52
|
-
methods clear() and send_keys(). These methods assume that
|
|
53
|
-
the web element is writable (enabled). Inserts tab character
|
|
54
|
-
at the end of text.
|
|
55
|
-
|
|
56
|
-
Alternative writer "raw" uses pyautogui to input text directly
|
|
57
|
-
without checking the web element state. This version is intended
|
|
58
|
-
to be used when the web page doesn't update input element status
|
|
59
|
-
Selenium compliant way.
|
|
60
|
-
|
|
61
|
-
Examples
|
|
62
|
-
--------
|
|
63
|
-
.. code-block:: robotframework
|
|
64
|
-
|
|
65
|
-
Set input handler raw
|
|
66
|
-
Set input handler selenium
|
|
67
|
-
|
|
68
|
-
Parameters
|
|
69
|
-
----------
|
|
70
|
-
input_method : str
|
|
71
|
-
Input method used by input handler, "selenium" or "raw".
|
|
72
|
-
|
|
73
|
-
"""
|
|
74
|
-
input_handler.input_method = input_method
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
@keyword(tags=("Config", "Input"))
|
|
78
|
-
def set_line_break(key: str) -> str:
|
|
79
|
-
r"""*DEPRECATED!!* Use keyword `SetConfig` instead."""
|
|
80
|
-
old_line_break_key = input_handler.line_break_key
|
|
81
|
-
input_handler.line_break_key = key
|
|
82
|
-
return old_line_break_key
|
|
83
|
-
|
|
84
|
-
|
|
85
45
|
secrets.add_filter("Type Secret3", 1, "hint")
|
|
86
46
|
|
|
87
47
|
|
|
@@ -699,7 +659,9 @@ def upload_file(
|
|
|
699
659
|
|
|
700
660
|
UploadFile Upload text.txt
|
|
701
661
|
UploadFile Foo C:/path/to/file/test.pdf
|
|
702
|
-
UploadFile 1 text.txt #Using index as locator
|
|
662
|
+
UploadFile 1 text.txt # Using index as locator, i.e first file input element
|
|
663
|
+
UploadFile Upload text.txt visibility=False # include invisible inputs in search
|
|
664
|
+
UploadFile //input[@type\="file"] text.txt # Upload file with xpath locator
|
|
703
665
|
|
|
704
666
|
With table(Pick table with use table keyword first):
|
|
705
667
|
|
|
@@ -710,7 +672,7 @@ def upload_file(
|
|
|
710
672
|
Parameters
|
|
711
673
|
----------
|
|
712
674
|
locator : str
|
|
713
|
-
|
|
675
|
+
Input label text, input's attribute value, xpath or index that locates the upload element.
|
|
714
676
|
filename : file to upload
|
|
715
677
|
Default folders = users/downloads, project_dir/files or ${EXECDIR}/\*\*/files
|
|
716
678
|
anchor : str
|
|
@@ -24,6 +24,7 @@ are usually refenced by coordinates or unique neighbouring values.
|
|
|
24
24
|
from typing import Union, List, Optional
|
|
25
25
|
|
|
26
26
|
from selenium.webdriver.remote.webelement import WebElement
|
|
27
|
+
from selenium.webdriver.common.by import By
|
|
27
28
|
from robot.api.deco import keyword
|
|
28
29
|
from QWeb.internal import decorators, actions, util
|
|
29
30
|
from QWeb.internal.exceptions import (
|
|
@@ -201,7 +202,11 @@ def verify_table(
|
|
|
201
202
|
@keyword(tags=("Tables", "Getters"))
|
|
202
203
|
@decorators.timeout_decorator
|
|
203
204
|
def get_cell_text(
|
|
204
|
-
coordinates: str,
|
|
205
|
+
coordinates: str,
|
|
206
|
+
anchor: str = "1",
|
|
207
|
+
tag: str | None = None,
|
|
208
|
+
timeout: Union[int, float, str] = 0,
|
|
209
|
+
**kwargs
|
|
205
210
|
) -> Union[str, int, float]:
|
|
206
211
|
r"""Get cell text to variable.
|
|
207
212
|
|
|
@@ -237,10 +242,21 @@ def get_cell_text(
|
|
|
237
242
|
.. code-block:: robotframework
|
|
238
243
|
|
|
239
244
|
UseTable MyTable
|
|
245
|
+
|
|
246
|
+
#Get value from row 2 / column 3
|
|
240
247
|
${value} GetCellText r2c3
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
${value} GetCellText r
|
|
248
|
+
|
|
249
|
+
#Row is second to last. Get value from column 5
|
|
250
|
+
${value} GetCellText r-2c5
|
|
251
|
+
|
|
252
|
+
#Row contains text Robot. Get value from column 5
|
|
253
|
+
${value} GetCellText r?Robot/c5
|
|
254
|
+
|
|
255
|
+
#Row contains text Robot. Get value from last column
|
|
256
|
+
${value} GetCellText r?Robot/c-1
|
|
257
|
+
|
|
258
|
+
#Get text from a child <a> element (column "Name"/row 3)
|
|
259
|
+
${value} GetCellText r3/c?Name tag=a
|
|
244
260
|
|
|
245
261
|
Parameters
|
|
246
262
|
----------
|
|
@@ -250,6 +266,10 @@ def get_cell_text(
|
|
|
250
266
|
anchor : str
|
|
251
267
|
If row is located by text which is not unique, use anchor to point correct one.
|
|
252
268
|
Anchor can be some other text in same row or index. Default = 1
|
|
269
|
+
tag : str
|
|
270
|
+
If cell contains multiple elements and you want to get text from specific one,
|
|
271
|
+
use tag to specify which child element you want to get text from.
|
|
272
|
+
For example tag=a gets text from a child element with tag a.
|
|
253
273
|
timeout : str | int
|
|
254
274
|
How long we search before failing. Default = Search Strategy default timeout (10s)
|
|
255
275
|
kwargs :
|
|
@@ -276,6 +296,12 @@ def get_cell_text(
|
|
|
276
296
|
table = Table.ACTIVE_TABLE.update_table()
|
|
277
297
|
|
|
278
298
|
table_cell = table.get_table_cell(coordinates, anchor)
|
|
299
|
+
if tag:
|
|
300
|
+
try:
|
|
301
|
+
table_cell = table_cell.find_element(By.XPATH, f".//{tag}")
|
|
302
|
+
except Exception as e:
|
|
303
|
+
raise QWebElementNotFoundError(
|
|
304
|
+
f"Could not find child element with tag {tag} from cell: {e}") from e
|
|
279
305
|
try:
|
|
280
306
|
text = actions.get_element_text(table_cell, timeout=timeout)
|
|
281
307
|
return util.get_substring(text, **kwargs)
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
# See the License for the specific language governing permissions and
|
|
15
15
|
# limitations under the License.
|
|
16
16
|
# ---------------------------
|
|
17
|
-
|
|
17
|
+
import dataclasses
|
|
18
18
|
from typing import Union, Optional
|
|
19
19
|
|
|
20
20
|
from robot.api import logger
|
|
@@ -27,7 +27,7 @@ from QWeb.internal.config_defaults import CONFIG
|
|
|
27
27
|
import platform
|
|
28
28
|
|
|
29
29
|
|
|
30
|
-
@dataclass
|
|
30
|
+
@dataclasses.dataclass
|
|
31
31
|
class TabInfo:
|
|
32
32
|
index: int
|
|
33
33
|
handle: str
|