In the Protractor test snippet below, I am attempting to calculate the quantity of div elements using the CSS locator:
let list = element.all(by.css('div[class="ag-header-cell ag-header-cell-sortable"]'));
expect(list.count()).toBe(11);
Although there are visibly 11 divs with this specific class, my test is inexplicably only registering 10. Consequently, the test fails with the following error message:
Expected 10 to be 11
https://i.stack.imgur.com/SNyGJ.png
To identify the unacknowledged div, I printed out the text content of each one:
element.all(by.css('div[class="ag-header-cell ag-header-cell-sortable"]')).each((it) => {
it.getText().then((text) => {
console.log('Text', text);
})
})
The div with col-id='Ni'
does not seem to be recognized, despite meeting the specified CSS class criteria in the test.
If anyone can shed light on why this discrepancy is occurring, I would greatly appreciate it.