简体   繁体   English

量角器:从标准Angular GRID获取数据,该数据在向左或向右滚动时会重新绘制

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

I have standard angular Grid which has around 45+ columns. 我有大约45列以上的标准角度网格。 AT a time only 10 are visible on GRID. 一次,只有10个在GRID上可见。

to fetch data for remaining 35 columns, you need to scroll right and then only you can fetch data for the same. 要获取剩余35列的数据,您需要向右滚动,然后才可以获取相同的数据。

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. 甚至在尝试使有角度的ui-grid表自动化时,我们也面临同样的问题。 The solution is to use Jquery scrollLeft() and scrollRight() methods to automatically scroll the table. 解决方案是使用Jquery scrollLeft()scrollRight()方法自动滚动表。

 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. 上面的代码将ui-grid表向左滚动500px,并且列将自动添加到右侧。 But the caveat here is, Columns on the left side will be removed when the table is scrolled. 但是需要注意的是,滚动表时,左侧的列将被删除。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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