Reputation: 17
I need to click
the element
located at bottom of page then I have to click
element
located at top of page.
i.e scroll up which is not visible to browser.
For scroll down I've used:
browser.actions().mouseMove(element).perform()`"
Kindly suggest solution to do this task
Upvotes: 0
Views: 1284
Reputation: 473853
There are multiple ways to scroll to the very top of the page:
Via window.scrollTo()
:
browser.executeScript("window.scrollTo(0, 0);");
Locate an element on top and scroll into it's view:
var header = element(by.tagName("header"));
browser.executeScript("arguments[0].scrollIntoView();", header.getWebElement());
Locate an element on top and move to it as you've demonstrated for the scroll down:
var header = element(by.tagName("header"));
browser.actions().mouseMove(header).perform();
Also see:
Upvotes: 2