pub struct CdpKeyboard<OT: ConnectionTransport> {
pub modifiers: Arc<Mutex<i64>>,
/* private fields */
}Fields§
§modifiers: Arc<Mutex<i64>>Modifier bitmask (Alt=1, Ctrl=2, Meta=4, Shift=8) — shared with CdpMouse.
Implementations§
Source§impl<OT: ConnectionTransport> CdpKeyboard<OT>
impl<OT: ConnectionTransport> CdpKeyboard<OT>
pub fn new( session: Arc<TokioMutex<CdpSession<OT>>>, modifiers: Arc<Mutex<i64>>, ) -> Self
Sourcepub async fn down(&self, key: &str) -> Result<(), InputError>
pub async fn down(&self, key: &str) -> Result<(), InputError>
Press a key down. Uses the keymap for non-printable keys; falls back gracefully.
Sourcepub async fn press(&self, key: &str, delay_ms: u64) -> Result<(), InputError>
pub async fn press(&self, key: &str, delay_ms: u64) -> Result<(), InputError>
Press and release a key (optionally holding for delay_ms between down and up).
Sourcepub async fn hold_press(
&self,
key: &str,
hold_for: u64,
step_range: DelayRange,
) -> Result<(), InputError>
pub async fn hold_press( &self, key: &str, hold_for: u64, step_range: DelayRange, ) -> Result<(), InputError>
Hold a key down for hold_for milliseconds, firing autoRepeat keydown events
at random intervals sampled from step_range, then release.
The first repeat is delayed 3–5× longer than normal to mirror OS initial-repeat latency.
Sourcepub async fn send_character(&self, ch: &str) -> Result<(), InputError>
pub async fn send_character(&self, ch: &str) -> Result<(), InputError>
Send a raw character via Input.insertText (bypasses key definitions).
Trait Implementations§
Source§impl<OT: Clone + ConnectionTransport> Clone for CdpKeyboard<OT>
impl<OT: Clone + ConnectionTransport> Clone for CdpKeyboard<OT>
Source§fn clone(&self) -> CdpKeyboard<OT>
fn clone(&self) -> CdpKeyboard<OT>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<OT: ConnectionTransport> Keyboard for CdpKeyboard<OT>
impl<OT: ConnectionTransport> Keyboard for CdpKeyboard<OT>
async fn down( &self, key: &str, _context: &BrowsingContext, ) -> Result<(), BidiInputError>
async fn up( &self, key: &str, _context: &BrowsingContext, ) -> Result<(), BidiInputError>
async fn press( &self, key: &str, _context: &BrowsingContext, options: Option<KeyPressOptions>, ) -> Result<(), BidiInputError>
async fn type_text( &self, text: &str, _context: &BrowsingContext, options: Option<KeyboardTypeOptions>, ) -> Result<(), BidiInputError>
Auto Trait Implementations§
impl<OT> Freeze for CdpKeyboard<OT>
impl<OT> !RefUnwindSafe for CdpKeyboard<OT>
impl<OT> Send for CdpKeyboard<OT>where
OT: Send,
impl<OT> Sync for CdpKeyboard<OT>where
OT: Send,
impl<OT> Unpin for CdpKeyboard<OT>
impl<OT> UnsafeUnpin for CdpKeyboard<OT>
impl<OT> !UnwindSafe for CdpKeyboard<OT>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more