Fetching text from disabled field

I am trying to fetch the text value from the below disabled field. IT fetches null value.
Tried get text, getattribute as well


1 Like

Hi there,

Thank you very much for your topic. Please note that it may take a little while before a member of our community or from Katalon team responds to you.


Right click on the “disabled” field and choose “Inspect” from the pop-up. This will display the HTML. Do this a second time to display your specific object so you can see what “attribute” you may need to use to collect the text.

If there is no “Inspect” in the pop-up, then use the F12 key and click on “Open DevTools”. Then you can click on the first icon at the top, and then click on your “disabled” field to display the HTML of your object.

If you can’t figure out the HTML, then, if possible, you can show it here and someone may help.

Also note, do the normal WebUI.waitForPageLoad(10) for the page to form and WebUI.waitForElementVisible(findTestObject('...'), 10) to allow the object to become visible before trying to get your data.

Maybe like:

"review element has value and is disabled"
WebUI.waitForElementVisible(findTestObject('...'), 10)
WebUI.verifyElementHasAttribute(findTestObject('...'), "disabled")

WebUI.verifyElementAttributeValue(findTestObject('...'), "value", "2179", 10)

Thank you for reply…

We used get text, get attribute but it is fetching null…
I saw using java executor - we can fetch it… bu tI am no t sure…
Can u help us java executor with katalon ?

What do you use as the pathway to this object? Do you use “formcontrolname” or maybe a dynamic “id”? The “formcontrolname” looks like it would be stable, so try a pathway with it and then try your code again.
xpath = //input[@formcontrolname='annualHrsPerFteInputCtrl']

Also, within the HTML area, or DevTools, there should be a section which gives you the opportunity to review your object’s properties (see Properties tab in blue below). Scroll through the Properties and see which attribute you should use. Reviewing your <input> element above, “getText()” will not work as there is no “text”. Therefore, it will give you null. There is no magic here. “getText()” looks in a specific position/area and “getAttribute()” looks at text within your chosen attribute. Find a <label> in your application and see the difference (“getText()” should work on the label’s “text”).

Perhaps, like I did above, you can see if <value> attribute has your text, but it could be <innerText> or some other. Anyway, go through the list of properties and see.