Horje
selenium scroll to element c# Code Example
selenium scroll to element c#
var element = driver.FindElement(By.id("element-id"));
Actions actions = new Actions(driver);
actions.MoveToElement(element);
actions.Perform();
selenium scroll to element c#
public void ScrollTo(int xPosition = 0, int yPosition = 0)
{
    var js = String.Format("window.scrollTo({0}, {1})", xPosition, yPosition);
    JavaScriptExecutor.ExecuteScript(js);
}

public IWebElement ScrollToView(By selector)
{
    var element = WebDriver.FindElement(selector);
    ScrollToView(element);
    return element;
}

public void ScrollToView(IWebElement element)
{
    if (element.Location.Y > 200)
    {
        ScrollTo(0, element.Location.Y - 100); // Make sure element is in the view but below the top navigation pane
    }

}




Csharp

Related
parse strings into words C# Code Example parse strings into words C# Code Example
count number of properties on an object C# Code Example count number of properties on an object C# Code Example
unity how to create a prefab Code Example unity how to create a prefab Code Example
check c# date for 0001/01/01 Code Example check c# date for 0001/01/01 Code Example
c# get custom attribute from property Code Example c# get custom attribute from property Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
12