How to Verify the Entered text of Multiple Text boxes?

Hi

I have set of Text boxes like Last Name , Country , State , City. I want to verify the text entered in each text boxes. I had used “WebUI.getAttribute(findTestObject(‘XYZ/Last Name field’),
‘value’)” for Last Name and it worked for me. And Same method i used in remaining text boxes but it’s not returning any Value entered. Here is my Script.

String L = WebUI.getAttribute(findTestObject(‘XYZ/Last Name field’),
‘value’)

WebUI.verifyEqual(M, L, FailureHandling.CONTINUE_ON_FAILURE)

String A = WebUI.getAttribute(findTestObject(‘XYZ/Country’),
‘value’)

WebUI.verifyEqual(A, ‘USA’, FailureHandling.CONTINUE_ON_FAILURE)

String B = WebUI.getAttribute(findTestObject(‘XYZ/City’))

WebUI.verifyEqual(B, ‘Sacramento’, FailureHandling.CONTINUE_ON_FAILURE)

String C = WebUI.getAttribute(findTestObject(‘XYZ/State’))

WebUI.verifyEqual(C, ‘Califrornia’, FailureHandling.CONTINUE_ON_FAILURE)

Any help?

Regards!!

WebUI.getText retrieves content from the text node(s) inside the element in question

WebUI.getAttribute retrieves content from the specified attribute of the element in question.

Is that where you problem lies?

Hi

Lemme correct it. it’s Get attribute in the script. Get text was mistake. I Used the Get attribute and it’s working for only one text box and remaining text boxe’s are failed to return the value.

It’s still wrong.

I can’t debug fake code.

I don’t know if the code itself is faulty or if your retyping of it contains typos.

You’re not being fair to us let alone yourself.

Please COPY AND PASTE.

HI

Here is the actual script which i used

String M=WebUI.getText(findTestObject(‘xyz/LastName’),FailureHandling.CONTINUE_ON_FAILURE)
String L = WebUI.getAttribute(findTestObject(‘XYZ/Last Name field’),
‘value’)

WebUI.verifyEqual(M, L, FailureHandling.CONTINUE_ON_FAILURE)
(This above code is working fine)

(Below Mentioned code is not working)
String A = WebUI.getAttribute(findTestObject(‘XYZ/Country’),
‘value’)

WebUI.verifyEqual(A, ‘USA’, FailureHandling.CONTINUE_ON_FAILURE)

String B = WebUI.getAttribute(findTestObject(‘XYZ/City’))

WebUI.verifyEqual(B, ‘Sacramento’, FailureHandling.CONTINUE_ON_FAILURE)

String C = WebUI.getAttribute(findTestObject(‘XYZ/State’))

WebUI.verifyEqual(C, ‘Califrornia’, FailureHandling.CONTINUE_ON_FAILURE)

String B = WebUI.getAttribute(findTestObject(‘XYZ/City’), "PUT-YOUR-ATTRIBUTE-HERE")

String C = WebUI.getAttribute(findTestObject(‘XYZ/State’), "PUT-YOUR-ATTRIBUTE-HERE")

Hey

It worked for me:)

Thank you

1 Like