Class: Selenium::WebDriver::Interactions::Scroll Private
- Inherits:
-
Interaction
- Object
- Interaction
- Selenium::WebDriver::Interactions::Scroll
- Defined in:
- lib/selenium/webdriver/common/interactions/scroll.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Action related to scrolling a wheel.
Instance Attribute Summary
Attributes inherited from Interaction
Instance Method Summary collapse
- #assert_source(source) ⇒ Object private
- #encode ⇒ Object private
-
#initialize(source:, origin: :viewport, duration: 0.25, **opts) ⇒ Scroll
constructor
private
A new instance of Scroll.
Constructor Details
#initialize(source:, origin: :viewport, duration: 0.25, **opts) ⇒ Scroll
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Scroll.
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/selenium/webdriver/common/interactions/scroll.rb', line 30 def initialize(source:, origin: :viewport, duration: 0.25, **opts) super(source) @type = :scroll @duration = duration * 1000 @origin = origin @x_offset = opts.delete(:x) || 0 @y_offset = opts.delete(:y) || 0 @delta_x = opts.delete(:delta_x) || 0 @delta_y = opts.delete(:delta_y) || 0 raise ArgumentError, "Invalid arguments: #{opts.keys}" unless opts.empty? end |
Instance Method Details
#assert_source(source) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
43 44 45 |
# File 'lib/selenium/webdriver/common/interactions/scroll.rb', line 43 def assert_source(source) raise TypeError, "#{source.type} is not a valid input type" unless source.is_a? WheelInput end |
#encode ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
47 48 49 50 51 52 53 54 55 |
# File 'lib/selenium/webdriver/common/interactions/scroll.rb', line 47 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 |