【发布时间】:2016-08-10 04:26:31
【问题描述】:
我正在尝试滚动一个 div,每次到达滚动条底部时都会加载行。现在我通过使用 PgUp 和 PgDn“滚动”div 的滚动条来做到这一点,但我遇到了一个问题,即特定 div 不接受 pgup/pgdown/home/end。如何使用 C# 和 Selenium 拖放滚动条?
这是我的 pgup 和 pgdn 代码:
private void ScrollTable(int scrollcount, string pageDirection, string delay)
{
Actions actions = new Actions(DlkEnvironment.AutoDriver);
actions.MoveToElement(mTableElement);
for (int i = 1; i <= scrollcount; i++)
{
//if loading is not displayed/visible,
IsLoadingScreenIsDisplayed(delay);
//execute after waiting
switch (pageDirection.ToLower())
{
case "up":
actions.Click().SendKeys(Keys.PageUp).Perform();
break;
case "down":
actions.Click().SendKeys(Keys.PageDown).Perform();
break;
default:
throw new Exception("Invalid direction");
}
}
Thread.Sleep(1000);
}
【问题讨论】:
标签: c# jquery html css selenium