'How to scroll down in a modal using selenium

enter image description here

I don't know how to scroll down the modal window. I tried the method below, but the scroll of the entire outer window goes down, not the modal window.

WebElement element = webDriver.findElement(By.xpath("//body/*[last()]"));
((JavascriptExecutor) webDriver).executeScript("arguments[0].scrollIntoView(true)", element);

I will attach the site, but you have to try to log in to check the list of authors in the modal window



Solution 1:[1]

If modal is in Iframe than, Switch to iFrame and then try to scroll down

or use the below

Method 1

Actions act = new Actions(driver)
act.sendKeys(Keys.PAGE_DOWN).build().perform() 

Method 2

EventFiringWebDriver eventfiringWebDriver = new EventFiringWebDriver(driver);

        eventfiringWebDriver.executeScript("document.querySelector('.scroll-wrapper').scrollTop=5000")

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Akzy