0

Issue: I'm trying to scroll in Selenium using moveByOffset(x,y), however, the cursor is not shifting focus to the provided co-ordinates -

    JavascriptExecutor js = (JavascriptExecutor) driver;
    //Find page height
    int pageHeight = ((Number) js.executeScript("return window.innerHeight")).intValue();

    //moveByOffset not working
    Actions a = new Actions(driver);
    a.moveByOffset(500, 300).click().build().perform();

Objective: Find the length of the page and scroll taking screenshots until the end of page is reached. (I've made a separate method for handling screenshots)

This has been discussed in thread - Selenium moveByOffset doesn't do anything, but unsure if it has been resolved. Any help would be appreciated.

gutsyfella
  • 11
  • 1
  • 5
  • Possible duplicate of [Page scroll up or down in Selenium WebDriver (Selenium 2) using java](https://stackoverflow.com/questions/12293158/page-scroll-up-or-down-in-selenium-webdriver-selenium-2-using-java) – JeffC Feb 12 '19 at 18:29
  • In the link you provided, there is an answer that links to a bug in that method. I would instead use one of the methods listed in the answer I linked above. – JeffC Feb 12 '19 at 18:30
  • @JeffC - Thank you. Your linked post answered my question - I was curious as following the bug (in my attached link) seems to have been closed long ago. Ideally, moveByOffset should be working now OR did I make a mistake in my code? - just wanted to be sure in either case – gutsyfella Feb 13 '19 at 05:56
  • I didn't read it that carefully. From what I remember, they closed the bug but people were still reporting the same bug after the fixed version. I didn't look any further than that. There may be a new bug in their list? – JeffC Feb 13 '19 at 16:21

0 Answers0