mirror of
https://github.com/CloakHQ/CloakBrowser.git
synced 2026-06-23 11:41:46 +02:00
fix(humanize): forward human_config in all chained methods, use evaluate args in handle pointer checks
- Add human_config=kwargs.get("human_config") to check/uncheck/select_option/press inner calls (sync+async+JS)
- Convert check_pointer_events_handle from f-string interpolation to evaluate args pattern (sync+async+JS)
This commit is contained in:
@@ -205,6 +205,15 @@ _POINTER_EVENTS_LOCATOR_JS = """(expected, coords) => {
|
||||
return { hit: false, reason: 'covered', covering: target.tagName || 'unknown' };
|
||||
}"""
|
||||
|
||||
_POINTER_EVENTS_HANDLE_JS = """(expected, coords) => {
|
||||
const target = document.elementFromPoint(coords.x, coords.y);
|
||||
if (!target) return { hit: false, reason: 'no_element_at_point', covering: 'none' };
|
||||
let node = target;
|
||||
while (node) { if (node === expected) return { hit: true }; node = node.parentNode; }
|
||||
if (expected.contains(target)) return { hit: true };
|
||||
return { hit: false, reason: 'covered', covering: target.tagName || 'unknown' };
|
||||
}"""
|
||||
|
||||
|
||||
def check_pointer_events(
|
||||
page: Any,
|
||||
@@ -313,18 +322,11 @@ def check_pointer_events_handle(
|
||||
deadline = time.monotonic() + timeout / 1000.0
|
||||
attempt = 0
|
||||
|
||||
js = f"""(expected) => {{
|
||||
const target = document.elementFromPoint({x}, {y});
|
||||
if (!target) return {{ hit: false, reason: 'no_element_at_point', covering: 'none' }};
|
||||
let node = target;
|
||||
while (node) {{ if (node === expected) return {{ hit: true }}; node = node.parentNode; }}
|
||||
if (expected.contains(target)) return {{ hit: true }};
|
||||
return {{ hit: false, reason: 'covered', covering: target.tagName || 'unknown' }};
|
||||
}}"""
|
||||
coords = {"x": x, "y": y}
|
||||
|
||||
while True:
|
||||
try:
|
||||
result = el.evaluate(js)
|
||||
result = el.evaluate(_POINTER_EVENTS_HANDLE_JS, coords)
|
||||
except Exception:
|
||||
result = None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user