pub struct InputSim { /* private fields */ }Expand description
Synthesises OS-level pointer and keyboard events.
InputSim is a thin façade over an InputProvider backend. Methods are
organised by input device: InputSim::mouse returns a Mouse handle
with pointer operations, InputSim::keyboard returns a Keyboard
handle with key operations. This structure matches Playwright and
Puppeteer’s page.mouse.* / page.keyboard.* layout and keeps the combo
verbs (click, press) unambiguous even though Element::press exists
at the a11y layer.
Use this only when the accessibility action layer cannot express the interaction you need — see the module docs for the rationale.
InputSim is cheap to clone (it shares the backend via Arc).
§Example
ⓘ
sim.mouse().click(&button)?;
sim.keyboard().chord(Key::Char('a'), &[Key::Meta])?; // Cmd/Ctrl+A
sim.keyboard().type_text("hello")?;Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for InputSim
impl !RefUnwindSafe for InputSim
impl Send for InputSim
impl Sync for InputSim
impl Unpin for InputSim
impl UnsafeUnpin for InputSim
impl !UnwindSafe for InputSim
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more