Search for multiple items

I canโ€™t find the best way to find multiple items on the page.

He always finds one, but what if I test to see how many specific elements are present after some action?

findElement() // always returns 1 element findElements(By.className('someClass')) // always returns 1 element 
+7
javascript selenium testing selenium-webdriver integration
source share
1 answer

In case someone is looking for this in the future, I got it to work:

 findElements(By.className("someclass")).then(function(elements_arr){ console.log(elements_arr.length); }); 

According to their source code, findElements returns a promise

Webdriverjs API

+18
source share

All Articles