DelayBeforePressingKey

This commit is contained in:
Haiping Chen 2024-11-18 18:52:59 +00:00
parent ebd2688564
commit afc880e1c0
2 changed files with 12 additions and 0 deletions

View file

@ -12,6 +12,10 @@ public class ElementActionArgs
public ElementPosition? Position { get; set; }
/// <summary>
/// Delay milliseconds before pressing key
/// </summary>
public int DelayBeforePressingKey { get; set; }
public string? PressKey { get; set; }
/// <summary>

View file

@ -56,6 +56,10 @@ public partial class PlaywrightWebDriver
if (action.PressKey != null)
{
if (action.DelayBeforePressingKey > 0)
{
await Task.Delay(action.DelayBeforePressingKey);
}
await locator.PressAsync(action.PressKey);
}
}
@ -64,6 +68,10 @@ public partial class PlaywrightWebDriver
await locator.PressSequentiallyAsync(action.Content);
if (action.PressKey != null)
{
if (action.DelayBeforePressingKey > 0)
{
await Task.Delay(action.DelayBeforePressingKey);
}
await locator.PressAsync(action.PressKey);
}
}