getText for "readonly" text from <input> box

Hello all,
I looking for some help in reading value from an input box that actually has a “readonly” value pushed from the api.
When i inspect it, there is no text seen anywhere but i could see it under Network log >> Preview
Please refer to the element below.
<input type=“text” class=“v-textfield v-widget v-readonly v-has-width v-textfield-readonly” id=“EventId:” aria-labelledby=“gwt-uid-120” tabindex="-1" readonly="" style=“width: 100%;” xpath=“1”>

In the attached image, i am trying to get the readonly text value which is “5,913”.
I tried WebUI.getText(findTestObject(‘test_object’)), but it didn’t work as it gets only the visible inner text.

Please let me know if there is any solution for this.
Thank you in advance.

You want WebUI.getAttribute and specify the value attribute. Like many people (including me), you expect getText to be the mirror of setText - not so.

1 Like

Cool… that worked… thank you so much :slight_smile:

String text = WebUI.getAttribute(findTestObject(‘test_object’), ‘value’)

Can any one help me to get the value for this element

image

I have tried this but I am getting null value

String value1= WebUI.getAttribute(findTestObject(‘Object Repository/EditPage/input_Package_packageName’), value)

println(‘The value is:’ + value1)

Result in console:

2022-04-06 15:55:49.414 DEBUG testcase.TC_Filter_Packages - 13: println(“The value is:” + value1)
The value is:null

In your screenshot, see it says $0 at the end?

Repeat those steps so you see that $0 again, then, in the browser console, type this and hit return:

$0.value

That will show you the current value of the value PROPERTY at the time you hit return.

What’s clear from your screenshot is, the element does not have a value ATTRIBUTE, but Katalon should squish the attribute and give you the value PROPERTY instead.

Let me know what happens when you try $0.value in the browser console. If you capture it as a screenshot, that would be good.

Thanks for your suggestion It worked.