WebDriverIO: scrollIntoView action scrolls element outside Viewport?

susanml
susanml
订阅者
448
文章
0
粉丝
测试交流1 203字数 78阅读0分15秒阅读模式
摘要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.

await $('#licenseName').scrollIntoView();

Any suggestion to overcome this? Thanks

 
  • 版权提示:非本站文章仅供存储任何法律责任由作者承担▷违法举报◁▷新闻不符◁▷我要投稿◁
    免责声明:部分内容来自用户上传发布或新闻客户端自媒体如有侵权请反馈站长处理
  • 原创转载:阅读转载说明>>> https://www.playezu.com/zixun/jiaoliu/webdriverio-scrollintoview-action-scrolls-element-outside-viewport.html
    • Ragnarsson
      Ragnarsson 9

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

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

    匿名

    发表评论

    匿名网友
    确定

    拖动滑块以完成验证