How can I get total count of objects in a page?

This is a line of JavaScript using DOM interface code you can try and prove to yourself it works by placing it in the browser console in DevTools.

document.querySelectorAll(".box-more").length

To use that code in your Test Case…

String js = 'return document.querySelectorAll(".box-more").length;'
int boxMoreCount = WebUI.executeJavaScript(js, null)
println("Count is: " + boxMoreCount)
1 Like