I want to get a specific property of this Element

I want to get the value of this aria-checked = ‘true’ as shown in the screenshot below. I am able to get this value easily by using below code:

WebElement searchTextBox= driver.findElement(By.className(“ui-igcheckbox-container”));
// retrieving html attribute value using getAttribute() method
String typeValue=searchTextBox.getAttribute(“aria-checked”);
System.out.println("Value of type attribute: "+typeValue);

But the problem here is i want to get this value Dynamically above code only returns only first value of the table row. Can anyone help me how to get this value dynamically?

Do you want to find all WebElements with class="ui-igcheckbox-container" ?

Then you can write :

List<WebElement> searchTextBoxes = driver.findElements(
1 Like

Yes this solved my problem i did this:

List<WebElement> searchTextBoxes= driver.findElements(By.cssSelector(“span[role='checkbox']”));
for(WebElement searchTextBox : searchTextBoxes){
    String typeValue = searchTextBox.getAttribute(“aria-checked”);
    System.out.println("Value of type attribute: "+typeValue);