mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-29 00:24:42 +01:00
Update click in NavigationViewItem
This commit is contained in:
@@ -24,22 +24,26 @@ namespace Microsoft.PowerToys.UITest
|
||||
/// Click the ListItem element.
|
||||
/// </summary>
|
||||
/// <param name="rightClick">If true, performs a right-click; otherwise, performs a left-click. Default value is false</param>
|
||||
public override void Click(bool rightClick = false)
|
||||
/// <param name="clickHoldMS">Mouse click hold time. Default value is 300 ms</param>
|
||||
public override void Click(bool rightClick = false, int clickHoldMS = 300)
|
||||
{
|
||||
PerformAction((actions, windowElement) =>
|
||||
{
|
||||
actions.MoveToElement(windowElement, 10, 10);
|
||||
actions.MoveToElement(windowElement);
|
||||
|
||||
// Move 2by2 offset to make click more stable instead of click on the border of the element
|
||||
actions.MoveByOffset(10, 10);
|
||||
|
||||
if (rightClick)
|
||||
{
|
||||
actions.ContextClick();
|
||||
actions.ContextClick().Build().Perform();
|
||||
}
|
||||
else
|
||||
{
|
||||
actions.Click();
|
||||
actions.ClickAndHold().Build().Perform();
|
||||
Task.Delay(clickHoldMS).Wait();
|
||||
actions.Release().Build().Perform();
|
||||
}
|
||||
|
||||
actions.Build().Perform();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user