您可以使用
SendKeys
而不将其发送到特定元素
private void ScrollTable(int scrollcount, string pageDirection, string delay)
{
Actions actions = new Actions(DlkEnvironment.AutoDriver);
for (int i = 1; i <= scrollcount; i++)
{
//if loading is not displayed/visible,
IsLoadingScreenIsDisplayed(delay);
//execute after waiting
switch (pageDirection.ToLower())
{
case "up":
actions.SendKeys(Keys.PageUp).Perform();
break;
case "down":
actions.SendKeys(Keys.PageDown).Perform();
break;
default:
throw new Exception("Invalid direction");
}
}
Thread.Sleep(1000);
}