I have been able to get the value of a React field using the get.attribute code listed below. I can’t seem to get the value from a disabled field. It is returning as null. I have googled for a while and actually read some topics on this forum, but nothing just yet seems to be working for me.
I am trying to get the value of the Description field (which is disabled) and verify that it matches an expected text.
2019-10-24 14:02:36.868 ERROR c.k.k.core.keyword.internal.KeywordMain - Unable to verify match between actual text ‘null’ and expected text ‘HAZARDOUS MATERIALS’ (Root cause: com.kms.katalon.core.exception.StepFailedException: Actual text ‘null’ and expected text ‘HAZARDOUS MATERIALS’ are not matched.
That’s not an HTML <input> element so it does not have a value attribute. It is a div-element where the content is stored inside it - it’s called its innerText.
You can retrieve innerText using WebUI.getText()
If you’d shown enough of the HTML, I could have written the CSS selector for you. (I see the parent div has an id, but it looks to be dynamic in which case it would cause you even more problems).