1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 11:37:45 +00:00

Browser+WebContent+WebDriver: Move Get Element Attribute to WebContent

In doing so, this also implements a FIXME to handle boolean attributes.
This commit is contained in:
Timothy Flynn 2022-11-10 08:57:37 -05:00 committed by Linus Groh
parent 7b1f3b7253
commit 1bc94e135f
16 changed files with 37 additions and 67 deletions

View file

@ -611,10 +611,6 @@ void BrowserWindow::create_new_tab(URL url, bool activate)
active_tab().view().scroll_element_into_view(element_id);
};
new_tab.webdriver_endpoints().on_get_element_attribute = [this](i32 element_id, String const& name) {
return active_tab().view().get_element_attribute(element_id, name);
};
new_tab.webdriver_endpoints().on_get_element_property = [this](i32 element_id, String const& name) {
return active_tab().view().get_element_property(element_id, name);
};

View file

@ -146,17 +146,6 @@ void WebDriverConnection::scroll_element_into_view(i32 element_id)
}
}
Messages::WebDriverSessionClient::GetElementAttributeResponse WebDriverConnection::get_element_attribute(i32 element_id, String const& name)
{
dbgln_if(WEBDRIVER_DEBUG, "WebDriverConnection: get_element_attribute");
if (auto browser_window = m_browser_window.strong_ref()) {
auto& tab = browser_window->active_tab();
if (tab.webdriver_endpoints().on_get_element_attribute)
return { tab.webdriver_endpoints().on_get_element_attribute(element_id, name) };
}
return { {} };
}
Messages::WebDriverSessionClient::GetElementPropertyResponse WebDriverConnection::get_element_property(i32 element_id, String const& name)
{
dbgln_if(WEBDRIVER_DEBUG, "WebDriverConnection: get_element_property");

View file

@ -49,7 +49,6 @@ public:
virtual void add_cookie(Web::Cookie::ParsedCookie const&) override;
virtual void update_cookie(Web::Cookie::Cookie const&) override;
virtual void scroll_element_into_view(i32 element_id) override;
virtual Messages::WebDriverSessionClient::GetElementAttributeResponse get_element_attribute(i32 element_id, String const& name) override;
virtual Messages::WebDriverSessionClient::GetElementPropertyResponse get_element_property(i32 element_id, String const& name) override;
virtual Messages::WebDriverSessionClient::GetActiveDocumentsTypeResponse get_active_documents_type() override;
virtual Messages::WebDriverSessionClient::GetComputedValueForElementResponse get_computed_value_for_element(i32 element_id, String const& property_name) override;

View file

@ -24,7 +24,6 @@ public:
~WebDriverEndpoints() = default;
Function<void(i32 element_id)> on_scroll_element_into_view;
Function<Optional<String>(i32 element_id, String const&)> on_get_element_attribute;
Function<Optional<String>(i32 element_id, String const&)> on_get_element_property;
Function<String()> on_get_active_documents_type;
Function<String(i32 element_id, String const&)> on_get_computed_value_for_element;

View file

@ -25,7 +25,6 @@ endpoint WebDriverSessionClient {
add_cookie(Web::Cookie::ParsedCookie cookie) =|
update_cookie(Web::Cookie::Cookie cookie) =|
scroll_element_into_view(i32 element_id) => ()
get_element_attribute(i32 element_id, String name) => (Optional<String> atttibute)
get_element_property(i32 element_id, String name) => (Optional<String> property)
get_active_documents_type() => (String type)
get_computed_value_for_element(i32 element_id, String property_name) => (String computed_value)