Method: Selenium::WebDriver::WheelActions#scroll_to

Defined in:
lib/selenium/webdriver/common/interactions/wheel_actions.rb

#scroll_to(element, device: nil) ⇒ Selenium::WebDriver::WheelActions

If the element is outside the viewport, scrolls the bottom of the element to the bottom of the viewport.

Examples:

Scroll to element

el = driver.find_element(id: "some_id")
driver.action.scroll_to(element).perform

Parameters:

  • element (Object)

    Which element to scroll into the viewport.

  • device (Object) (defaults to: nil)

    Which device to use to scroll

Returns:



44
45
46
# File 'lib/selenium/webdriver/common/interactions/wheel_actions.rb', line 44

def scroll_to(element, device: nil)
  scroll(origin: element, device: device)
end