Reputation: 1
I need to scroll the page on AngularJS application using protractor
browser.executeScript('window.scrollTo(0,200);').then(function () {
The above code is not getting executed.
Upvotes: 0
Views: 92
Reputation: 169
Try this one
var scrolldown = by.css(' keep your class here');
browser.controlFlow().execute(function() {
browser.executeScript('arguments[0].scrollIntoView(true)', scrolldown.getWebElement());
});
Upvotes: 0
Reputation: 899
What do you need to scroll to? The way I handle this is like so:
var lastElement = element.all(by.css('td')).last();
browser.actions().mouseMove(lastElement).perform();
Upvotes: 1
Reputation: 1110
You can use this library: https://www.npmjs.com/package/sg-protractor-tools
You can use the library's functions by referencing the sgpt object, e.g. for scrolling:
sgpt.scroll.scrollTo(...);
Upvotes: 0