2

I'm new to using Selenium so I would like to have some help regarding these questions.

1) How to automate scrolling and let it stop once it reaches the height of the desktop? As I want to screenshot a webpage based on its full screen, I want it to be able to autoscroll to a certain desktop height, take a screenshot, continue scrolling to the next same height, take a screenshot again till the end of page.

2) How do you determine the end of a page? By using JavaScript's scrollTo method or is there any other ways?

baao
  • 71,625
  • 17
  • 143
  • 203
dark_space
  • 179
  • 1
  • 2
  • 17

1 Answers1

0

You may try to scroll by defining x and y axis. Try this code for javascript

WebDriver driver = new FirefoxDriver(); JavascriptExecutor js = (JavascriptExecutor)driver; jse.executeScript("window.scrollBy(0,200)", "");

Let me know if this helps.

Sanchit
  • 315
  • 2
  • 20