Is there a way to loop through 2D List of WebElements?

I was trying to figure out how to click on a div specified by the text of one
of it’s child’s inner text.

public class GetChildNodeFromList {
@Keyword
def GetChildNode(TestObject to, int i) {
ListWebElements users = WebUiBuiltInKeywords.findWebElements(to, 30)
//println users
for (user in users) {
println user
ListWebElements children = WebUiBuiltInKeywords.findWebElements(TestObject user, 30)
//println children
}

}

}

the problem is that you I couldn’t get the children of user in users. is there a way to do that?

Thanks

Hi Mark,
The root caused is a user is a WebElement, not a Katalon TestObject
To get children of a user, please try
import com.kms.katalon.core.webui.common.WebUiCommonHelper List<WebElement> children = user.findElements(WebUiCommonHelper.buildLocator(put your children testobject here));

I’ve figured out how to do that

`public class GetChildNodeFromList {
@Keyword
def GetChildNode(TestObject to, String role) {
List<WebElement> users = WebUiBuiltInKeywords.findWebElements(to, 30)

	//print users[0].getProperties()["text"]
	
	for (user in users) {
		if (user.getProperties()["text"].split()[1] == role) {
			user.click()
			break
		}
	}
	
}

}`

Can you show a sample code for looping through a list of web elements?