How to get the default value of input field


I would like to ask for help because I want to verify that the default value of the input text field is correct. I used this syntax WebUI.getAttribute(findTestObject(‘Shopping_Cart/Quantity_Textbox’), 1), and I got an error below.

This is the actual UI

JPetStore Demo 2021-10-16 at 12.32.45 PM

=============== ROOT CAUSE =====================

For trouble shooting, please visit:


10-16-2021 12:27:09 PM getAttribute(findTestObject(“Shopping_Cart/Quantity_Textbox”), 1)

Elapsed time: 0.208s

Test Cases/TC-002 FAILED.


groovy.lang.MissingMethodException: No signature of method: static com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.getAttribute() is applicable for argument types: (com.kms.katalon.core.testobject.TestObject, java.lang.Integer) values: [TestObject - ‘Object Repository/Shopping_Cart/Quantity_Textbox’, …]

Possible solutions: getAttribute(com.kms.katalon.core.testobject.TestObject, java.lang.String), getAttribute(com.kms.katalon.core.testobject.TestObject, java.lang.String, com.kms.katalon.core.model.FailureHandling)



at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(

at com.kms.katalon.core.main.TestCaseExecutor.runScript(

at com.kms.katalon.core.main.TestCaseExecutor.doExecute(

at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(

at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(

at com.kms.katalon.core.main.TestCaseExecutor.execute(

at com.kms.katalon.core.main.TestCaseMain.runTestCase(

at com.kms.katalon.core.main.TestCaseMain.runTestCase(

at com.kms.katalon.core.main.TestCaseMain$runTestCase$ Source)


Read the document carefully to find out how to call the keyword appropriately:

You need to read the HTML source of your web page. In order to see the HTML source, you need to use Chrome DevTools. Read the following post,


8. Learn to Use DevTools.
Finally, many of the points above rely on YOU understanding how to use the Browser Developer Tools (aka DevTools ).

The default value of an <input> element is possibly contained as a value attribute.

Thanks @kazurayam, It works now. I used this syntax WebUI.getAttribute(findTestObject(‘Shopping_Cart/Quantity_Textbox’), ‘value’). But I’m not sure if I used correct syntax. Just to add a context, My goal is I want to ensure that the default value of the input field (the default quantity value in the actual UI is “2”) is correct. Is there another web keyword should I use? Thank you!

def v = WebUI.getAttribute(findTestObject(‘Shopping_Cart/Quantity_Textbox’), ‘value’)
assert v == "2"

Hi @kazurayam Thanks for you response! I tried but I have an error :frowning:

Your code is not the same as mine.
You made a mistake.
Review your code carefully.

Sorry @kazurayam. It’s working now. Thank you for always helping me! :slight_smile: