Silk4NET provides the following ways to scroll controls in a browser into view during replay:
- ExecuteJavaScript method (DomElement)
- Use the
ScrollIntoView method to scroll a specific DOM element into the visible area of the browser window.
- ExecuteJavaScript method (BrowserWindow)
- Use the
ExecuteJavaScript method to scroll the entire page up or down by a specified range.
Examples
The following command scrolls one page down:
'VB .NET code
browserWindow.ExecuteJavaScript("window.scrollBy(0, window.innerHeight)")
// C# code
browserWindow.ExecuteJavaScript("window.scrollBy(0, window.innerHeight)");
The following command scrolls down 100 pixels:
'VB .NET code
browserWindow.ExecuteJavaScript("window.scrollBy(0, 100)")
// C# code
browserWindow.ExecuteJavaScript("window.scrollBy(0, 100)");
The following command scrolls up 100 pixels:
'VB .NET code
browserWindow.ExecuteJavaScript("window.scrollBy(0, -100)")
// C# code
browserWindow.ExecuteJavaScript("window.scrollBy(0, -100)");