Sobhit Sharma
Sobhit Sharma

Reputation: 713

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();
}

Upvotes: 1

Views: 788

Answers (1)

Minh
Minh

Reputation: 83

Please use

element = input tag

  return !element.getAttribute("value")

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

Upvotes: 1

Related Questions