1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 03:27:44 +00:00

WebDriver: Add computedlabel endpoint

This commit is contained in:
Jonah 2023-02-19 11:36:08 -06:00 committed by Tim Flynn
parent 307cd4a1da
commit 30ec59f163
7 changed files with 33 additions and 0 deletions

View file

@ -1258,6 +1258,25 @@ Messages::WebDriverClient::GetComputedRoleResponse WebDriverConnection::get_comp
return ""sv;
}
// 12.4.10 Get Computed Label, https://w3c.github.io/webdriver/#get-computed-label
Messages::WebDriverClient::GetComputedLabelResponse WebDriverConnection::get_computed_label(DeprecatedString const& element_id)
{
// 1. If the current browsing context is no longer open, return error with error code no such window.
TRY(ensure_open_top_level_browsing_context());
// 2. Handle any user prompts and return its value if it is an error.
TRY(handle_any_user_prompts());
// 3. Let element be the result of trying to get a known element with url variable element id.
auto* element = TRY(get_known_connected_element(element_id));
// 4. Let label be the result of a Accessible Name and Description Computation for the Accessible Name of the element.
auto label = element->accessible_name(element->document()).release_value_but_fixme_should_propagate_errors();
// 5. Return success with data label.
return label.to_deprecated_string();
}
// 12.5.1 Element Click, https://w3c.github.io/webdriver/#element-click
Messages::WebDriverClient::ElementClickResponse WebDriverConnection::element_click(DeprecatedString const& element_id)
{