Sha256: 35c9e109ec43cb2f939d45814014947485cfc87b59215636e5c808dcaf2bcb4e
Contents?: true
Size: 1.21 KB
Versions: 2
Compression:
Stored size: 1.21 KB
Contents
# frozen_string_literal: true require 'selenium-webdriver' module Aranha module Selenium class Session < ::SimpleDelegator module Scroll NULL_SCROLL = 0 DEFAULT_SCROLL = 100 # @param delta_x [Integer] Number of pixels. # @param delta_y [Integer] Number of pixels. # @return [self] def scroll_by(delta_x, delta_y) execute_script("window.scrollBy(#{delta_x.to_i}, #{delta_y.to_i})") self end # @param delta_x [Integer] Number of pixels. # @return [self] def scroll_left_by(delta_x = DEFAULT_SCROLL) scroll_right_by(-delta_x) end # @param delta_y [Integer] Number of pixels. # @return [self] def scroll_down_by(delta_y = DEFAULT_SCROLL) scroll_by(NULL_SCROLL, delta_y) end # @param delta_x [Integer] Number of pixels. # @return [self] def scroll_right_by(delta_x = DEFAULT_SCROLL) scroll_by(delta_x, NULL_SCROLL) end # @param delta_y [Integer] Number of pixels. # @return [self] def scroll_up_by(delta_y = DEFAULT_SCROLL) scroll_down_by(-delta_y) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
aranha-selenium-0.11.1 | lib/aranha/selenium/session/scroll.rb |
aranha-selenium-0.11.0 | lib/aranha/selenium/session/scroll.rb |