webdriver: Implement send alert text (#38140)

Implement webdriver `SendAlertText` command

Tests:
https://github.com/longvatrong111/servo/actions/runs/16342669929
https://github.com/longvatrong111/servo/actions/runs/16342671477

cc: @xiaochengh

---------

Signed-off-by: batu_hoang <hoang.binh.trong@huawei.com>
Signed-off-by: batu_hoang <longvatrong111@gmail.com>
This commit is contained in:
batu_hoang 2025-07-18 05:24:50 +08:00 committed by GitHub
parent 3ce95b2ba5
commit f0e10e63e2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 91 additions and 46 deletions

View file

@ -827,10 +827,13 @@ impl Handler {
recv(self.load_status_receiver) -> res => {
match res {
Ok(WebDriverLoadStatus::Blocked) => {
Err(WebDriverError::new(
ErrorStatus::UnexpectedAlertOpen,
"Load is blocked",
))
// TODO: evaluate the correctness later
// Load status is block means an user prompt is shown.
// Alot of tests expect this to return success
// then the user prompt is handled in the next command.
// If user prompt can't be handler, next command returns
// an error anyway.
Ok(WebDriverResponse::Void)
}
_ => {
Ok(WebDriverResponse::Void)
@ -2519,6 +2522,7 @@ impl WebDriverHandler<ServoExtensionRoute> for Handler {
WebDriverCommand::DismissAlert => self.handle_dismiss_alert(),
WebDriverCommand::AcceptAlert => self.handle_accept_alert(),
WebDriverCommand::GetAlertText => self.handle_get_alert_text(),
WebDriverCommand::SendAlertText(text) => self.handle_send_alert_text(text.text),
WebDriverCommand::DeleteCookies => self.handle_delete_cookies(),
WebDriverCommand::DeleteCookie(name) => self.handle_delete_cookie(name),
WebDriverCommand::GetTimeouts => self.handle_get_timeouts(),