4

I have a Angular grid (ag-grid) that will, based on scrolling/view, create div in the DOM to display data. I am writing a Selenium WebDriver test that would read the data from the grid and compare it to the data returned from the API.

Since some of the div's are not yet created (hidden behind Angular virtualization) WebDriver is not able to effectively capture the data.

Is there a way to force the grid to display all data?

user3063502
  • 51
  • 1
  • 5

3 Answers3

4

there is a setting, gridOptions.rowBuffer, that tells the grid how many extra rows to render above / below the viewport. set this to a number greater than the number of rows you have and then all rows will be rendered. or if unsure, set it to 9999999.

ps you mention 'Angular Grid' and 'Angular Virtualisation'. to be correct, it is called 'Agnostic Grid' - the ag stands for AGnostic - and also the virtualisation is not Angular, grid grid has it's own implementation of row virtualisation.

Niall Crosby
  • 2,383
  • 15
  • 16
  • Can you please share the steps to do this in Selenium? – Purus Mar 19 '18 at 09:10
  • Exactly, `suppressRowVisualisation` property is not included and ag-Grid explains why: https://www.ag-grid.com/javascript-grid-properties/#scrolling – Tonatio Apr 26 '19 at 07:00
0

Try explicitly clicking the scrollbar or panning the scrolled area in order to bring the desired div(s) into view to force Angular to instantiate the divs. You could try scroll-into-view on a known instantiated object on the edge of the instantiated div set, which would, I imagine, kick Angular into instantiating the ones just outside the view, in anticipation of continued scrolling. Wash, rinse, repeat if desired.

Here's a possibly helpful page about scroll to element in Selenium: Scroll Element into View with Selenium

Community
  • 1
  • 1
Keith Tyler
  • 719
  • 4
  • 18
0

Try setting domLayout to domLayout = 'autoHeight'

Ajay2707
  • 5,690
  • 6
  • 40
  • 58
techStud
  • 140
  • 2
  • 12
  • 1
    If you could add some more detail about why this solution works, and/or some documentation about that function, it would make your answer much better! – nvioli Oct 25 '18 at 14:32