0

I'm automating some manual work of finding a list of elements matching to the given string. The whole webpage doesn't have a scrollbar but only the left pane where operations are done has a scroll bar. Have tried using javascript executor, but couldn't scroll that particular element.

I've tried:

js.executeScript("driver.findElement(By.xpath(\"//div[@class='jss215 jss213 ']\")).scrollIntoView()");

also tried by sending page_down keys

driver.findElement(By.xpath("//div[@class='jss215 jss213 ']")).sendKeys(Keys.PAGE_DOWN);

I get ElementClickInterceptedException and I'm trying to handle it by scrolling down till I get my element.

Dushyant Tankariya
  • 1,432
  • 3
  • 11
  • 17

1 Answers1

0

For scroll to a element please try this bellow code

WebElement element = driver.findElement(By.xpath("//div[@class='jss215 jss213 ']");
((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", element);
frianH
  • 7,295
  • 6
  • 20
  • 45