MCPcopy
hub / github.com/codeceptjs/CodeceptJS / grabNumberOfVisibleElements

Method grabNumberOfVisibleElements

lib/helper/Puppeteer.js:1726–1733  ·  view source on GitHub ↗

* {{> grabNumberOfVisibleElements }}

(locator)

Source from the content-addressed store, hash-verified

1724 * {{> grabNumberOfVisibleElements }}
1725 */
1726 async grabNumberOfVisibleElements(locator) {
1727 let els = await this._locate(locator)
1728 els = (await Promise.all(els.map(el => el.boundingBox() && el))).filter(v => v)
1729 // Puppeteer visibility was ignored? | Remove when Puppeteer is fixed
1730 els = await Promise.all(els.map(async el => (await el.evaluate(node => window.getComputedStyle(node).visibility !== 'hidden' && window.getComputedStyle(node).display !== 'none')) && el))
1731
1732 return els.filter(v => v).length
1733 }
1734
1735 /**
1736 * {{> seeInCurrentUrl }}

Callers 1

Calls 3

_locateMethod · 0.95
filterMethod · 0.80
evaluateMethod · 0.80

Tested by

no test coverage detected