Webdriver: Forward ErrorStatus for take element screenshot (#38134)

Based on
[spec](tests/wpt/meta/webdriver/tests/classic/take_element_screenshot/screenshot.py.ini),
we should not expect the error to only be
`ErrorStatus::StaleElementReference`.

Testing:
`tests/wpt/meta/webdriver/tests/classic/take_element_screenshot/screenshot.py.ini`

Signed-off-by: PotatoCP <Kenzie.Raditya.Tirtarahardja@huawei.com>
This commit is contained in:
Kenzie Raditya Tirtarahardja 2025-07-18 14:42:51 +08:00 committed by GitHub
parent 39144bb013
commit b4b9e2c515
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 1 additions and 22 deletions

View file

@ -2324,10 +2324,7 @@ impl Handler {
serde_json::to_value(encoded)?, serde_json::to_value(encoded)?,
))) )))
}, },
Err(_) => Err(WebDriverError::new( Err(error) => Err(WebDriverError::new(error, "Element not found")),
ErrorStatus::StaleElementReference,
"Element not found",
)),
} }
} }

View file

@ -1,18 +0,0 @@
[screenshot.py]
[test_no_such_element_with_invalid_value]
expected: FAIL
[test_no_such_element_with_shadow_root]
expected: FAIL
[test_no_such_element_from_other_window_handle[open\]]
expected: FAIL
[test_no_such_element_from_other_window_handle[closed\]]
expected: FAIL
[test_no_such_element_from_other_frame[open\]]
expected: FAIL
[test_no_such_element_from_other_frame[closed\]]
expected: FAIL