方法一:
WebElement element = driver.findElement(By.id("id_of_element")); ((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", element); Thread.sleep(500);


方法二:
WebElement element = driver.findElement(By.id("my-id"));
Actions actions = new Actions(driver);
actions.moveToElement(element);
actions.perform();


相关文章:

  • 2022-12-23
  • 2021-10-15
  • 2022-12-23
  • 2022-12-23
  • 2021-10-12
  • 2021-07-09
  • 2021-12-22
猜你喜欢
  • 2021-11-16
  • 2022-01-09
  • 2021-06-29
相关资源
相似解决方案