Currently, I am working with intern framework and selenium. My goal is to create a loop that can search for elements within a table. This loop will identify each element and store them in an array so that operations can be performed on them later.
The basic concept is as follows:
browser.wait(2000)
.then(function () {
while (true) {
ifHasElements=browser.isDisplayed("/html/body/div[1]/div[5]/div[3]/div/div[3]/div[1]/table[2]/tbody/tr["+contRowsTable+"]").end()
if (ifHasElements) {
console.log("into if")
browser.elementByXPath("/html/body/div[1]/div[5]/div[3]/div/div[3]/div[1]/table[2]/tbody/tr["+contRowsTable+"]/td[1]")
.clickElement()
.end()
rows[contRowsTab]=browser.elementByXPath("/html/body/div[1]/div[5]/div[3]/div/div[3]/div[1]/table[2]/tbody/tr["+contRowsTable+"]")
} else {
break
}
contRowsTab++;
contRowsTable++;
}
})
I am unsure whether it is possible to run a loop and simultaneously fetch elements within the 'then' block. Any assistance on this matter would be greatly appreciated. Thank you.