summaryrefslogtreecommitdiff
path: root/Userland/Applications
diff options
context:
space:
mode:
authormartinfalisse <martinmotteditfalisse@gmail.com>2022-11-01 10:12:50 +0100
committerLinus Groh <mail@linusgroh.de>2022-11-01 10:55:34 +0000
commit76da0c6c546a20bed1ff97b1c77a3e0ac7936680 (patch)
tree5323644984767838e66536ae8af1daa461f227fa /Userland/Applications
parent5ffff09e05043a6e3c831e863d3d6815fcef8462 (diff)
downloadserenity-76da0c6c546a20bed1ff97b1c77a3e0ac7936680.zip
WebDriver: Implement `GET /session/{id}/element/{id}/text` endpoint
Diffstat (limited to 'Userland/Applications')
-rw-r--r--Userland/Applications/Browser/WebDriverConnection.cpp11
-rw-r--r--Userland/Applications/Browser/WebDriverConnection.h1
-rw-r--r--Userland/Applications/Browser/WebDriverSessionClient.ipc1
3 files changed, 13 insertions, 0 deletions
diff --git a/Userland/Applications/Browser/WebDriverConnection.cpp b/Userland/Applications/Browser/WebDriverConnection.cpp
index 88a8609c98..71a4769b44 100644
--- a/Userland/Applications/Browser/WebDriverConnection.cpp
+++ b/Userland/Applications/Browser/WebDriverConnection.cpp
@@ -188,6 +188,17 @@ Messages::WebDriverSessionClient::GetComputedValueForElementResponse WebDriverCo
return { "" };
}
+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");
diff --git a/Userland/Applications/Browser/WebDriverConnection.h b/Userland/Applications/Browser/WebDriverConnection.h
index 8fef50a610..d6a47d4012 100644
--- a/Userland/Applications/Browser/WebDriverConnection.h
+++ b/Userland/Applications/Browser/WebDriverConnection.h
@@ -53,6 +53,7 @@ public:
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;
+ virtual Messages::WebDriverSessionClient::GetElementTextResponse get_element_text(i32 element_id) override;
virtual Messages::WebDriverSessionClient::GetElementTagNameResponse get_element_tag_name(i32 element_id) override;
private:
diff --git a/Userland/Applications/Browser/WebDriverSessionClient.ipc b/Userland/Applications/Browser/WebDriverSessionClient.ipc
index 4dcfbe22c6..16c27d6454 100644
--- a/Userland/Applications/Browser/WebDriverSessionClient.ipc
+++ b/Userland/Applications/Browser/WebDriverSessionClient.ipc
@@ -22,6 +22,7 @@ endpoint WebDriverSessionClient {
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)
+ get_element_text(i32 element_id) => (String text)
get_element_tag_name(i32 element_id) => (String tag_name)
}