wtrobot / wtrobot-v2

WTRobot-v2 web testing framework
MIT License
5 stars 4 forks source link

[RFE] Implement page scroll (before locating the element) #16

Closed sshedmake closed 5 years ago

sshedmake commented 5 years ago

Description Implement page scroll action, making possible to take screenshot(s) of page involving one page scroll

Steps to Reproduce Cannot take screenshot of a page involving one page scroll

Actual Results Lacks one page scroll

Expected Results One page scroll happens

sshedmake commented 5 years ago

With google-chrome, one can get desired screenshot via page scroll (by element). However, same doesn't happen with firefox.

Get following error (with traceback) with firefox:

ERROR - 2019-05-21 13:03:22,044 - action.py - 134 - Message: (1604, 948.1166687011719) is out of bounds of viewport width (1920) and height (942)
Traceback (most recent call last):
  File "/home/test/z.y.x.com/ansible-test-automation/src/action.py", line 132, in hover
    ActionChains(self.driver).move_to_element(test_data["element_obj"]).perform()
  File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/common/action_chains.py", line 80, in perform
    self.w3c_actions.perform()
  File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/common/actions/action_builder.py", line 76, in perform
    self.driver.execute(Command.W3C_ACTIONS, enc)
  File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.MoveTargetOutOfBoundsException: Message: (1604, 948.1166687011719) is out of bounds of viewport width (1920) and height (942)
vishalvvr commented 5 years ago

RFE implemented[1] , please do test and report bug if needed.

[1] https://github.com/vishalvijayraghavan/WTRobot-v2/commit/7c98b9780fe6da8e60c5ef457beb766d39d9b2fc

sshedmake commented 5 years ago

Tested scroll functionality with firefox.

(A) action: scroll name: page scroll target: //*[@id="something"]/at-some-template/div/button/span

doesn't scroll up-to the target (requires inspection), however it does offer a page scroll (Keys.PAGE_DOWN)

(B) action: scroll wait after action: 4 y: 100 x: 0 name: page scroll

works as expected & scrolls by 'y' units

sshedmake commented 5 years ago

Tested scroll functionality with firefox. ... ... ... (B) action: scroll wait after action: 4 y: 100 x: 0 name: page scroll

works as expected & scrolls by 'y' units

@vishalvijayraghavan, Thanks for the fix.