Module: OnlyofficeWebdriverWrapper::ScrollMethods

Included in:
WebDriver
Defined in:
lib/onlyoffice_webdriver_wrapper/webdriver/scroll_methods.rb

Overview

Methods for scrolling page

Instance Method Summary collapse

Instance Method Details

#current_scroll_position(xpath) ⇒ Float

Get current element scroll position

Parameters:

  • list_xpath (String)

    how to detect this list

Returns:

  • (Float)

    position in pixels



18
19
20
# File 'lib/onlyoffice_webdriver_wrapper/webdriver/scroll_methods.rb', line 18

def current_scroll_position(xpath)
  execute_javascript("return $(#{dom_element_by_xpath(xpath)}).scrollTop()")
end

#scroll_list_by_pixels(list_xpath, pixels) ⇒ void

This method returns an undefined value.

Scroll list by pixel count

Parameters:

  • list_xpath (String)

    how to detect this list

  • pixels (Integer)

    how much to scroll



10
11
12
13
# File 'lib/onlyoffice_webdriver_wrapper/webdriver/scroll_methods.rb', line 10

def scroll_list_by_pixels(list_xpath, pixels)
  element = dom_element_by_xpath(list_xpath)
  execute_javascript("$(#{element}).scrollTop(#{pixels})")
end