在屏幕中间滚动元素的方法

Way to scroll element in the middle of the screen

滚动一直是 selenium 自动化的一个问题。

欢迎大家提出最佳可靠的元素滚动方式 在屏幕中间。

下面是 JavaScript 让我解决上述问题的方法。

((IJavaScriptExecutor)driver).ExecuteScript("arguments[0].scrollIntoView({block: 'center'});", PassIWebElementOverHere);