当需要使用滚动条才能使页面元素显示在视野范围内时,必须用代码处理下,才能对其进行操作。

处理其实也很简单,就是调用JS函数.

driver.executeScript("arguments[0].scrollIntoView(false);", e);

参数e 为WebElement 类型,方法executeScript是WebDriver中定义的方法。

相关文章:

  • 2022-01-13
  • 2022-03-02
  • 2022-01-11
  • 2021-12-18
  • 2021-08-04
  • 2021-08-02
  • 2021-09-10
猜你喜欢
  • 2021-11-21
  • 2021-04-08
  • 2021-09-12
  • 2022-12-23
  • 2021-05-02
  • 2021-10-30
相关资源
相似解决方案