WebDriverIO: scrollIntoView action scrolls element outside Viewport?

susanml 测试交流1 124字数 392阅读模式
摘要I am using WebDriverIO ("webdriverio": "^7.14.1"). Usually the action ...

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

玩技站长微信
添加好友自动发送入群邀请
weinxin
rainbow-shownow
玩技官方公众号
官方微信公众号
weinxin
PLAYEZU
 
  • 版权提示:本站仅供存储任何法律责任由作者承担▷诈骗举报◁▷新闻不符◁▷我要投稿◁
    风险通知:非原创文章均为网络投稿真实性无法判断,侵权联系2523030730
    免责声明:内容来自用户上传发布或新闻客户端自媒体,切勿!切勿!切勿!添加联系方式以免受骗。
  • 原创转载:https://www.playezu.com/179277.html
    转载说明: 点我前往阅读>>>
    • Ragnarsson
      Ragnarsson 9

      我可以通过使用 滚动浏览选项,如下所示:
      await $(‘#licenseName’).scrollIntoView({block:’center’});

      元素滚动到屏幕中心,因此始终在视口中。

    匿名

    发表评论

    匿名网友
    确定