Module: Selenium::WebDriver::WheelActions
- Included in:
- ActionBuilder
- Defined in:
- rb/lib/selenium/webdriver/common/interactions/scroll_origin.rb,
rb/lib/selenium/webdriver/common/interactions/wheel_actions.rb
Defined Under Namespace
Classes: ScrollOrigin
Instance Attribute Summary collapse
-
#default_scroll_duration ⇒ Object
By default this is set to 250ms in the ActionBuilder constructor It can be overridden with default_scroll_duration=.
Instance Method Summary collapse
-
#scroll_by(delta_x, delta_y, device: nil) ⇒ Selenium::WebDriver::WheelActions
Scrolls by provided amounts with the origin in the top left corner of the viewport.
-
#scroll_from(scroll_origin, delta_x, delta_y, device: nil) ⇒ Selenium::WebDriver::WheelActions
Scrolls by provided amount based on a provided origin.
-
#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.
Instance Attribute Details
#default_scroll_duration ⇒ Object
By default this is set to 250ms in the ActionBuilder constructor It can be overridden with default_scroll_duration=
30 31 32 |
# File 'rb/lib/selenium/webdriver/common/interactions/wheel_actions.rb', line 30 def default_scroll_duration @default_scroll_duration ||= @duration / 1000.0 # convert ms to seconds end |
Instance Method Details
#scroll_by(delta_x, delta_y, device: nil) ⇒ Selenium::WebDriver::WheelActions
Scrolls by provided amounts with the origin in the top left corner of the viewport.
58 59 60 |
# File 'rb/lib/selenium/webdriver/common/interactions/wheel_actions.rb', line 58 def scroll_by(delta_x, delta_y, device: nil) scroll(delta_x: delta_x, delta_y: delta_y, device: device) end |
#scroll_from(scroll_origin, delta_x, delta_y, device: nil) ⇒ Selenium::WebDriver::WheelActions
Scrolls by provided amount based on a provided origin.
The scroll origin is either the center of an element or the upper left of the viewport plus any offsets. If the origin is an element, and the element is not in the viewport, the bottom of the element will first
be scrolled to the bottom of the viewport.
88 89 90 91 92 93 94 95 96 97 |
# File 'rb/lib/selenium/webdriver/common/interactions/wheel_actions.rb', line 88 def scroll_from(scroll_origin, delta_x, delta_y, device: nil) raise TypeError, "#{scroll_origin.inspect} isn't a valid ScrollOrigin" unless scroll_origin.is_a?(ScrollOrigin) scroll(x: scroll_origin.x_offset, y: scroll_origin.y_offset, delta_x: delta_x, delta_y: delta_y, origin: scroll_origin.origin, device: device) end |
#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.
44 45 46 |
# File 'rb/lib/selenium/webdriver/common/interactions/wheel_actions.rb', line 44 def scroll_to(element, device: nil) scroll(origin: element, device: device) end |