commit 2394151328cdae0642e026db4a9ab53d2f7b7720
parent 84192adaeef49cd98651b34b011d46e9d26273cd
Author: Jonathan Lee <jonathan-j-lee@users.noreply.github.com>
Date: Mon, 15 Dec 2025 18:07:59 +0000
Bug 2004354 [wpt PR 56508] - [wptrunner] Restore initial test window focus for WebDriver, a=testonly
Automatic update from web-platform-tests
[wptrunner] Restore initial test window focus for WebDriver (#56508)
This short-term workaround restores the WebDriver testharness executor
behavior prior to web-platform-tests/wpt@bef892c489 to fix broken tests.
https://github.com/web-platform-tests/rfcs/issues/231 is open to codify
the desired behavior.
--
wpt-commits: 062b75a6567fb77a70e20d1abb4def7cc95ea05c
wpt-pr: 56508
Diffstat:
1 file changed, 10 insertions(+), 0 deletions(-)
diff --git a/testing/web-platform/tests/tools/wptrunner/wptrunner/executors/executorwebdriver.py b/testing/web-platform/tests/tools/wptrunner/wptrunner/executors/executorwebdriver.py
@@ -1274,6 +1274,16 @@ class WebDriverTestharnessExecutor(TestharnessExecutor):
protocol.base.set_window(test_window)
# Wait until about:blank has been loaded
protocol.base.execute_script(self.window_loaded_script, asynchronous=True)
+
+ # Move focus to the test window. This should not be fallible because the
+ # document will always be the initial about:blank, and thus there is no
+ # content in the page to obscure the centre point of the root element.
+ #
+ # TODO(web-platform-tests/rfcs#231): This is only a de facto assumption.
+ # Finalize what the desired behavior should be.
+ selector = protocol.base.execute_script('return document.documentElement;')
+ protocol.click.element(selector)
+
return test_window