0

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.

1
  • 2
    Please clarify your question better. See how to ask on Stack Overflow, thank you! Commented Dec 12, 2017 at 8:08

3 Answers 3

1

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();
Sign up to request clarification or add additional context in comments.

Comments

0

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(...);

Comments

0

Try this one

  var scrolldown = by.css(' keep your class here');
    browser.controlFlow().execute(function() {
        browser.executeScript('arguments[0].scrollIntoView(true)', scrolldown.getWebElement());
    });

1 Comment

I tried the above code and got message" Failed: scrolldown.getWebElement" is not a function, Please advice as I am new to protractor.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.