Implement wb element send keys for file input (#37224)

We can now send keys to file input, which results in uploading file with
given filename. Needs
`pref=dom_testing_html_input_element_select_files_enabled` flag to work.

https://w3c.github.io/webdriver/#element-send-keys

Testing:
`tests/wpt/meta/webdriver/tests/classic/element_send_keys/{events,
file_upload}.py.`

Signed-off-by: PotatoCP <kenzieradityatirtarahardja18@gmail.com>
This commit is contained in:
Kenzie Raditya Tirtarahardja 2025-06-05 14:48:14 +08:00 committed by GitHub
parent 165ac32f18
commit d66e4fc459
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 78 additions and 55 deletions

View file

@ -2280,15 +2280,6 @@ impl ScriptThread {
can_gc,
)
},
WebDriverScriptCommand::FocusElement(element_id, reply) => {
webdriver_handlers::handle_focus_element(
&documents,
pipeline_id,
element_id,
reply,
can_gc,
)
},
WebDriverScriptCommand::ElementClick(element_id, reply) => {
webdriver_handlers::handle_element_click(
&documents,
@ -2394,6 +2385,20 @@ impl ScriptThread {
WebDriverScriptCommand::GetTitle(reply) => {
webdriver_handlers::handle_get_title(&documents, pipeline_id, reply)
},
WebDriverScriptCommand::WillSendKeys(
element_id,
text,
strict_file_interactability,
reply,
) => webdriver_handlers::handle_will_send_keys(
&documents,
pipeline_id,
element_id,
text,
strict_file_interactability,
reply,
can_gc,
),
_ => (),
}
}