I am using WebDriverIO ("webdriverio": "^7.14.1"
). Usually the action scrollIntoView()
works as expected. But sometimes, it scrolls the element outside of viewport, for example, it scrolls element to the top of the page hidden/out of view by one line (I hope you understand the point).
Right now, it happens to me like 50/50 all the time, so my tests are not stable because of this.文章源自玩技e族-https://www.playezu.com/179277.html
await $('#licenseName').scrollIntoView();
Any suggestion to overcome this? Thanks文章源自玩技e族-https://www.playezu.com/179277.html 文章源自玩技e族-https://www.playezu.com/179277.html
未知地区 1F
我可以通过使用 滚动浏览选项,如下所示:
await $(‘#licenseName’).scrollIntoView({block:’center’});
元素滚动到屏幕中心,因此始终在视口中。