servo/components/webdriver_server
shuppy cfa9e711c5
webdriver: Use take_screenshot() API in Take (Element) Screenshot (#39587)
WPT tests require us to reliably take screenshots when test pages are
fully loaded and testing is complete, and the WPT runner uses
[test-wait.js](a2f551eb2d/tests/wpt/tests/tools/wptrunner/wptrunner/executors/test-wait.js)
to do this in userland. when testing Servo with [--product
servo](a2f551eb2d/tests/wpt/tests/tools/wptrunner/wptrunner/executors/executorservo.py),
we use servoshell’s --output option, which backs that up with more
reliable waiting in Servo. but when testing Servo with [--product
servodriver](a2f551eb2d/tests/wpt/tests/tools/wptrunner/wptrunner/executors/executorservodriver.py),
we use the WebDriver Take Screenshot action, which currently takes the
screenshot immediately. we think this might be a source of regressions.

this patch makes the WebDriver actions Take Screenshot and Take Element
Screenshot use the same new WebView::take_screenshot() API as
servoshell’s --output option, such that those actions now wait for [a
variety of
conditions](a2f551eb2d/components/servo/webview.rs (L596-L602))
that may affect test output. it’s not clear if this is
[conformant](https://w3c.github.io/webdriver/#screen-capture), so we may
want to refine this to only wait when running tests at some point. other
changes:

- we remove the retry loop where we try to take a screenshot every
second for up to 30 seconds
- we send the result as a image::RgbaImage over crossbeam without shared
memory (it’s not cross-process)
- we now handle the zero-sized element case directly in the WebDriver
server

Testing: This should fix some flaky tests.
Fixes: #36715.
Fixes: (partially) #39180.
Fixes: (partially) #34683.

Signed-off-by: Delan Azabani <dazabani@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2025-10-01 12:37:00 +00:00
..
actions.rs webdriver: Improve documentations for actions.rs and update TODOs (#39391) 2025-09-21 05:42:16 +00:00
capabilities.rs Rework webdriver session (#38225) 2025-07-28 10:14:14 +00:00
Cargo.toml Cargo.toml cleanup (#39403) 2025-09-20 03:09:37 +00:00
elements.rs Implement webdriver extract script arguments (#38357) 2025-08-12 06:57:19 +00:00
lib.rs webdriver: Use take_screenshot() API in Take (Element) Screenshot (#39587) 2025-10-01 12:37:00 +00:00
session.rs webdriver: Simplify webview related steps that are guaranteed to succeed (#38855) 2025-08-22 17:19:12 +00:00
timeout.rs webdriver: improve session commands (#38397) 2025-08-01 06:39:03 +00:00
user_prompt.rs webdriver: Refactor webdriver session and improve window handles (#38745) 2025-08-21 22:46:13 +00:00