Already browsed on the existing discussion here related to my problem but none of them work.
I am trying to Get the value of a disabled field. Here’s the element and UI field
I already tried using the Get Text, Get Attribute, JavaScript DOM Read, using xpath and css, waitForElementVisible and I also added delay but none of them worked. All of cannot fetch the CN00001201
Thank you in advance
2 Likes
depapp
March 17, 2026, 2:15am
2
hi @Gwentri
i don’t think the problem is the field being disabled.
if you already tried:
getText()
getAttribute()
JS
and still can’t get CN00001201, then you’re most likely not pointing at the element that actually contains the value.
what i usually do in this situation:
Open DevTools
Press Ctrl + F
Search: CN00001201
don’t rely on the test object yet, just see where that value really lives in the DOM
common pattern I’ve seen a lot:
The <input> exists but value=""
The actual value is rendered somewhere else (span/div)
Example:
<input disabled value="">
<span>CN00001201</span>
1 Like
Can we see what is the XPath you are using? From what I can see, it should be as easy as:
id(‘customerIdString’)
After checking your pathway, I’d go back to putting in a delay, or wait, statement before you do your “getAttribute”, like:
WebUI.waitForElementVisible(findTestObject(‘your textbox’), 10)
"check that it is disabled"
WebUI.verifyElementHasAttribute(findTestObject('your textbox'),'disabled')
"verify the contents"
WebUI.verifyElementAttributeValue(findTestObject('your textbox'),'CN00001201',"value", 10)
"display the contents"
WebUI.comment("The value is ${WebUI.getAttribute(findTestObject(‘your textbox’), 'value')}")
1 Like
Ensure it is not under iframe or Shadow DOM. Use the below code and adjust the delays
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
WebUI.waitForElementPresent(findTestObject(‘Object Repository/Your_Object_Path’), 10)
String customerId = WebUI.executeJavaScript(“return document.getElementById(‘customerIdString’).value;”, null)
// Print
println(">>> THE EXTRACTED ID IS: " + customerId)
1 Like
Hi this is my locator
//input[@id=‘customerIdString’]
I’ve tried to use your script but still it does not work
1 Like
depapp:
CN00001201
Hi thank you for the suggestion. I’ve tried it but there is only one path where CN00001201 is located
Hi Thank you for your help. I’ve tried it but sadly it does not pick the Customer ID value And yes it is not under iframe or shadow bom.
Here’s the logs after the execution:
based on this image, first try to target webtable and then proceed with your element with any of locator strategy
Disabled input value="" often displays text via shadow DOM/label/adjacent span —inspect full DOM (Ctrl+F “CN00001201”) to find true container.
Get Value
String value = WebUI.executeJavaScript("return arguments[0].value || arguments[0].textContent || arguments[0].innerText", element)
WebUI.comment("Value: " + value)
Or getAttribute("value", 10) after waitForElementPresent(id='customerIdString', 10)—JS reads rendered text.
Thank you so much Monty, missed checking the Console. It is now working
3 Likes
Gwentri:
It is now working
What was the cause of your failure?
What did you do to get it working?
1 Like
Better to share actual root cause and fix to resolve
i was in same boat when i checked it was different iframe so i use nested dom object
1 Like
you had same issue like @Gwentri ’s