Search code examples
protractor

Protractor - automate the testing of horizontal scrollbar movement present in data grid


I am using protractor to automate the UI test cases of our developed angularJS application.

In my application we have a data grid with 20 columns, but on a screen user can see the 7 columns with data with the help of horizontal scroll bar user see rest of the columns and their data.

How can i automate the identification of horizontal scroll bar and their movement from left to right(till end of the data grid)?


Solution

  • Even i faced the same problem at the beginning when tried to automate the UI grid table.what i used is scrollLeft() and scrollRight() jquery functions to scroll the table based on any pixel values.

     var viewport = $('.ui-grid-viewport');
     browser.executeScript("$(arguments[0]).scrollLeft(arguments[0].scrollLeft + 20)",viewport.getWebElement())