Skip to content

Commit

Permalink
Added documentation for Duration/Delay on action chains
Browse files Browse the repository at this point in the history
  • Loading branch information
0xlunar committed Oct 12, 2024
1 parent a67220a commit 8d4a0cb
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions thirtyfour/src/action_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ impl ActionChain {

/// Create a new ActionChain struct with custom action delays.
///
/// The delay `Option<u64>` is the amount of time in milliseconds
/// before the action is executed in the chain.
///
/// `key_delay` defaults to 0ms, `pointer_delay` defaults to 250ms
///
/// See [WebDriver::action_chain()](../struct.WebDriver.html#method.action_chain)
/// for more details.
pub fn new_with_delay(
Expand Down
6 changes: 6 additions & 0 deletions thirtyfour/src/common/action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ where

impl ActionSource<KeyAction> {
/// Create a new Key action source.
///
/// Duration `Option<u64>` represents the time in milliseconds before an action is executed.
/// Defaults to 0ms
pub fn new(name: &str, duration: Option<u64>) -> Self {
let duration = duration.unwrap_or(0);
ActionSource {
Expand Down Expand Up @@ -228,6 +231,9 @@ pub enum PointerActionType {

impl ActionSource<PointerAction> {
/// Create a new Pointer action source.
///
/// Duration represents the time in milliseconds before an action is executed.
/// Defaults to 250ms
pub fn new(name: &str, action_type: PointerActionType, duration: Option<u64>) -> Self {
let duration = duration.unwrap_or(250);
ActionSource {
Expand Down
5 changes: 5 additions & 0 deletions thirtyfour/src/session/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -910,6 +910,11 @@ impl SessionHandle {

/// Create a new action chain for this session.
/// Set custom delays for key and pointer actions
///
/// The delay `Option<u64>` is the amount of time in milliseconds
/// before the action is executed in the chain.
///
/// `key_delay` defaults to 0ms, `pointer_delay` defaults to 250ms
pub fn action_chain_with_delay(
self: &Arc<SessionHandle>,
key_delay: Option<u64>,
Expand Down

0 comments on commit 8d4a0cb

Please sign in to comment.