webdriver: Implement element send keys command for non-typeable form control (#38189)

Implement Step 8 of remote end steps of [Element Send
keys](https://w3c.github.io/webdriver/#element-send-keys), specifically
for non-typeable form control.

---------

Signed-off-by: PotatoCP <Kenzie.Raditya.Tirtarahardja@huawei.com>
This commit is contained in:
Kenzie Raditya Tirtarahardja 2025-07-23 17:11:44 +08:00 committed by GitHub
parent 3cb16eb864
commit 0970a99b7c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 65 additions and 5 deletions

View file

@ -520,6 +520,24 @@ impl HTMLInputElement {
self.input_type.get()
}
#[inline]
/// <https://w3c.github.io/webdriver/#dfn-non-typeable-form-control>
pub(crate) fn is_nontypeable(&self) -> bool {
matches!(
self.input_type(),
InputType::Button |
InputType::Checkbox |
InputType::Color |
InputType::File |
InputType::Hidden |
InputType::Image |
InputType::Radio |
InputType::Range |
InputType::Reset |
InputType::Submit
)
}
#[inline]
pub(crate) fn is_submit_button(&self) -> bool {
let input_type = self.input_type.get();
@ -2154,7 +2172,7 @@ impl HTMLInputElement {
}
// https://html.spec.whatwg.org/multipage/#concept-fe-mutable
fn is_mutable(&self) -> bool {
pub(crate) fn is_mutable(&self) -> bool {
// https://html.spec.whatwg.org/multipage/#the-input-element:concept-fe-mutable
// https://html.spec.whatwg.org/multipage/#the-readonly-attribute:concept-fe-mutable
!(self.upcast::<Element>().disabled_state() || self.ReadOnly())