I want to scroll to and element that is in the middle of the screen but not visible on the screen after navigating to the page. My tests are written with Selenium using C# language. Any advice is appreciated. Thanks!
I have tried to scroll to the element using class Actions but that doesn't work, probably because the element is not visible on the screen without scrolling.
Is a good approach to scroll using JavaScriptExecutor like this?
> IJavaScriptExecutor js = (IJavaScriptExecutor)driver;
> js.ExecuteScript("arguments[0].scrollIntoView();", element);
And after this should I use the normal way of scrolling using Actions class?
> Actions actions = new Actions(driver);
> actions.MoveToElement(element);
> actions.Perform();