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

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

This commit is contained in:
Timothy Flynn 2022-11-10 10:21:03 -05:00 committed by Linus Groh
parent 06f1b8825c
commit 5d32fd7026
16 changed files with 22 additions and 62 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_text = [this](i32 element_id) {
return active_tab().view().get_element_text(element_id);
};
new_tab.webdriver_endpoints().on_get_element_tag_name = [this](i32 element_id) {
return active_tab().view().get_element_tag_name(element_id);
};

View file

@ -146,17 +146,6 @@ void WebDriverConnection::scroll_element_into_view(i32 element_id)
}
}
Messages::WebDriverSessionClient::GetElementTextResponse WebDriverConnection::get_element_text(i32 element_id)
{
dbgln_if(WEBDRIVER_DEBUG, "WebDriverConnection: get_element_text");
if (auto browser_window = m_browser_window.strong_ref()) {
auto& tab = browser_window->active_tab();
if (tab.webdriver_endpoints().on_get_element_text)
return { tab.webdriver_endpoints().on_get_element_text(element_id) };
}
return { "" };
}
Messages::WebDriverSessionClient::GetElementTagNameResponse WebDriverConnection::get_element_tag_name(i32 element_id)
{
dbgln("WebDriverConnection: get_computed_value_for_element");

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::GetElementTextResponse get_element_text(i32 element_id) override;
virtual Messages::WebDriverSessionClient::GetElementTagNameResponse get_element_tag_name(i32 element_id) override;
virtual Messages::WebDriverSessionClient::GetElementRectResponse get_element_rect(i32 element_id) override;
virtual Messages::WebDriverSessionClient::IsElementEnabledResponse is_element_enabled(i32 element_id) override;

View file

@ -24,7 +24,6 @@ public:
~WebDriverEndpoints() = default;
Function<void(i32 element_id)> on_scroll_element_into_view;
Function<String(i32 element_id)> on_get_element_text;
Function<String(i32 element_id)> on_get_element_tag_name;
Function<Gfx::IntRect(i32 element_id)> on_get_element_rect;
Function<bool(i32 element_id)> on_is_element_enabled;

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_text(i32 element_id) => (String text)
get_element_tag_name(i32 element_id) => (String tag_name)
get_element_rect(i32 element_id) => (Gfx::IntRect rect)
is_element_enabled(i32 element_id) => (bool enabled)