There are a dynamic number of div containers on the page with the class name 'sponge', I need to loop through these and then get details from each one, but I can't figure out how to do this. This is what I've tried so far...
const containers = await driver.findElements(By.className(`sponge`))
for(let t = 0; t < containers.length; t++){
let runner = await containers[t].findElement(By.xpath(`//div[2]/div[1]/div/p`)).getText()
console.log(runner)
}
When I do this I just get the 'runner' in the first 'sponge' class container x amount of times, with x being the length of 'contaniers'. It doesn't actually find the 'runner' that is in the contanier I want