Introduction
Most of the solutions will tell you to inject a JavaScript to do this. However, trick is to use keyboard buttons.
Here’s an example in ruby:
# Lets grab the body on which will be sending keys
bodyElement = @driver.find_element(css: "body")
(1..5).each do
# method sample is defined in rails, you can try :page_up only if not on rails
bodyElement.send_keys([:page_up,:page_down].sample)
sleep 2.seconds
end
Scrolling in Selenium
Short and smart 😉