简体   繁体   中英

Protractor: Fetching data from standard Angular GRID which redraws when scroll left or right

I have standard angular Grid which has around 45+ columns. AT a time only 10 are visible on GRID.

to fetch data for remaining 35 columns, you need to scroll right and then only you can fetch data for the same.

Is there a way in protractor where we can extract data via auto scrolling.

Even we faced the same problem when tried to automate angular ui-grid tables. The solution is to use Jquery scrollLeft() and scrollRight() methods to automatically scroll the table.

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

The above piece of code will scroll the ui-grid table by 500px towards left and column will be automatically added to the right side. But the caveat here is, Columns on the left side will be removed when the table is scrolled.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM