mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
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:
parent
165ac32f18
commit
d66e4fc459
6 changed files with 78 additions and 55 deletions
|
@ -1619,14 +1619,23 @@ impl Handler {
|
|||
|
||||
let (sender, receiver) = ipc::channel().unwrap();
|
||||
|
||||
let cmd = WebDriverScriptCommand::FocusElement(element.to_string(), sender);
|
||||
let cmd = WebDriverScriptCommand::WillSendKeys(
|
||||
element.to_string(),
|
||||
keys.text.to_string(),
|
||||
self.session()?.strict_file_interactability,
|
||||
sender,
|
||||
);
|
||||
let cmd_msg = WebDriverCommandMsg::ScriptCommand(browsing_context_id, cmd);
|
||||
self.constellation_chan
|
||||
.send(EmbedderToConstellationMessage::WebDriverCommand(cmd_msg))
|
||||
.unwrap();
|
||||
|
||||
// TODO: distinguish the not found and not focusable cases
|
||||
wait_for_script_response(receiver)?.map_err(|error| WebDriverError::new(error, ""))?;
|
||||
// File input and non-typeable form control should have
|
||||
// been handled in `webdriver_handler.rs`.
|
||||
if wait_for_script_response(receiver)?.map_err(|error| WebDriverError::new(error, ""))? {
|
||||
return Ok(WebDriverResponse::Void);
|
||||
}
|
||||
|
||||
let input_events = send_keys(&keys.text);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue