class Selenium::WebDriver::Interactions::Scroll

Action related to scrolling a wheel.

@api private

Public Class Methods

new(source:, x: 0, y: 0, delta_x: 0, delta_y: 0, origin: :viewport, duration: 0.25) click to toggle source
# File lib/selenium/webdriver/common/interactions/scroll.rb, line 30
def initialize(source:, x: 0, y: 0, delta_x: 0, delta_y: 0, origin: :viewport, duration: 0.25)
  super(source)
  @type = :scroll
  @duration = duration * 1000
  @origin = origin
  @x_offset = x
  @y_offset = y
  @delta_x = delta_x
  @delta_y = delta_y
end

Public Instance Methods

assert_source(source) click to toggle source
# File lib/selenium/webdriver/common/interactions/scroll.rb, line 41
def assert_source(source)
  raise TypeError, "#{source.type} is not a valid input type" unless source.is_a? WheelInput
end
encode() click to toggle source
# File lib/selenium/webdriver/common/interactions/scroll.rb, line 45
def encode
  {'type' => type.to_s,
   'duration' => @duration.to_i,
   'x' => @x_offset,
   'y' => @y_offset,
   'deltaX' => @delta_x,
   'deltaY' => @delta_y,
   'origin' => @origin.is_a?(Element) ? @origin : @origin.to_s}
end