Set proper button value in WebDriver - ElementClick command (#36871)

Fix ElementClick: `ElementClick` should use `MouseButton::Left` to
create `action`.

Testing: No pass test now. Tests still fail because of other issues.
For: https://github.com/servo/servo/issues/36658

cc: @xiaochengh , @yezhizhen , @PotatoCP

Signed-off-by: batu_hoang <longvatrong111@gmail.com>
This commit is contained in:
batu_hoang 2025-05-07 16:58:01 +08:00 committed by GitHub
parent eaf9224799
commit b2e51820e4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 20 additions and 18 deletions

View file

@ -61,15 +61,16 @@ pub enum MouseButton {
Other(u16),
}
impl From<u16> for MouseButton {
fn from(value: u16) -> Self {
impl<T: Into<u64>> From<T> for MouseButton {
fn from(value: T) -> Self {
let value = value.into();
match value {
0 => MouseButton::Left,
1 => MouseButton::Middle,
2 => MouseButton::Right,
3 => MouseButton::Back,
4 => MouseButton::Forward,
_ => MouseButton::Other(value),
_ => MouseButton::Other(value as u16),
}
}
}