Currently, I have a scroll into view function that is working fine, but now I am looking to enhance its functionality.
This is the code I'm using:
((IJavaScriptExecutor)driver).ExecuteScript("arguments[0].scrollIntoView(true);", element);
This code is integrated with my OnClicking event listener - ensuring that before clicking on an element, it scrolls into view first.
While this setup works well and achieves what I need, during testing I noticed that the page is scrolling unnecessarily even when the element is already visible on the screen. This brings up the question of how to set a parameter that would trigger the scroll only if the element is below 3/4 of the visible screen.