'Element.getText() returns empty string

The below image shown that we have a field which is pre-populated from the api, and trying to automate that with that I am using the below command where once its available checking if not null.

enter image description here

<div class="MuiInputBase-root MuiInput-root MuiInput-underline Mui-disabled Mui-disabled MuiInputBase-fullWidth MuiInput-fullWidth MuiInputBase-formControl MuiInput-formControl" xpath="1"><input aria-invalid="false" disabled="" required="" type="text" class="MuiInputBase-input MuiInput-input Mui-disabled Mui-disabled" value="America First Credit Union"></div>

But getText() is returning empty string, I have checked its the right element and right amount of wait.

        return !element.getText().isEmpty();
}


Solution 1:[1]

Please use

element = input tag

  return !element.getAttribute("value")

More detail here: getText() on input is not returning text

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Minh