Change command name to WillSendKeys

Signed-off-by: PotatoCP <kenzieradityatirtarahardja18@gmail.com>
This commit is contained in:
PotatoCP 2025-06-03 17:31:33 +08:00
parent c12e21bf3a
commit b0fba0f110
4 changed files with 7 additions and 6 deletions

View file

@ -2371,12 +2371,12 @@ impl ScriptThread {
WebDriverScriptCommand::GetTitle(reply) => { WebDriverScriptCommand::GetTitle(reply) => {
webdriver_handlers::handle_get_title(&documents, pipeline_id, reply) webdriver_handlers::handle_get_title(&documents, pipeline_id, reply)
}, },
WebDriverScriptCommand::SendKeysSetup( WebDriverScriptCommand::WillSendKeys(
strict_file_interactability, strict_file_interactability,
text, text,
element_id, element_id,
reply, reply,
) => webdriver_handlers::handle_send_keys_setup( ) => webdriver_handlers::handle_will_send_keys(
&documents, &documents,
pipeline_id, pipeline_id,
element_id, element_id,

View file

@ -834,7 +834,7 @@ pub(crate) fn handle_find_element_elements_tag_name(
.unwrap(); .unwrap();
} }
pub(crate) fn handle_send_keys_setup( pub(crate) fn handle_will_send_keys(
documents: &DocumentCollection, documents: &DocumentCollection,
pipeline: PipelineId, pipeline: PipelineId,
element_id: String, element_id: String,

View file

@ -160,7 +160,8 @@ pub enum WebDriverScriptCommand {
IsEnabled(String, IpcSender<Result<bool, ErrorStatus>>), IsEnabled(String, IpcSender<Result<bool, ErrorStatus>>),
IsSelected(String, IpcSender<Result<bool, ErrorStatus>>), IsSelected(String, IpcSender<Result<bool, ErrorStatus>>),
GetTitle(IpcSender<String>), GetTitle(IpcSender<String>),
SendKeysSetup(bool, String, String, IpcSender<Result<bool, ErrorStatus>>), /// Match the element type before sending the event for webdriver `element send keys`.
WillSendKeys(bool, String, String, IpcSender<Result<bool, ErrorStatus>>),
} }
#[derive(Debug, Deserialize, Serialize)] #[derive(Debug, Deserialize, Serialize)]

View file

@ -1617,7 +1617,7 @@ impl Handler {
let (sender, receiver) = ipc::channel().unwrap(); let (sender, receiver) = ipc::channel().unwrap();
let cmd = WebDriverScriptCommand::SendKeysSetup( let cmd = WebDriverScriptCommand::WillSendKeys(
self.session()?.strict_file_interactability, self.session()?.strict_file_interactability,
keys.text.to_string(), keys.text.to_string(),
element.to_string(), element.to_string(),
@ -1630,7 +1630,7 @@ impl Handler {
// TODO: distinguish the not found and not focusable cases // TODO: distinguish the not found and not focusable cases
// File input and non-typeable form control should have // File input and non-typeable form control should have
// been handled in `webdriver_handler.rs` // been handled in `webdriver_handler.rs`.
if wait_for_script_response(receiver)?.map_err(|error| WebDriverError::new(error, ""))? { if wait_for_script_response(receiver)?.map_err(|error| WebDriverError::new(error, ""))? {
return Ok(WebDriverResponse::Void); return Ok(WebDriverResponse::Void);
} }