How to get text from input field ,store in a variable and use it in different test cases

Hi All,

Requirement :
1 ) Create an application with application : SampleApp + Random number Eg : SampleApp 123
2) Get Text from the input field of Application Name -
ApplicationName = WebUI.getAttribute(findTestObject(‘Object Repository/AppDef/input_Application Details_mat-input-0’), ‘value’)
ApplicationName = SampleApp 123
3) Set Text to a field to search the application by application name
Need to set text “SampleApp 123” to Search Application field

I have accomplished Step 1 and Step 2, when i tried Step 3 i get error No such property

What i have tried the below ( NONE of them worked for me)

  1. defined a global variable , assigned get attribute value , set text global variable to search application field
  2. defined a keyword , assigned value to static variable , set text to search application field
  3. defined a variable , get attribute value and then set text to search application field

Hi Srividhya1

Can you re-try with the first solutions #1: assigned global variable

1. Create the variable name at profile

2. Assuming that you can get the value ‘SampleApp 123’ at step 1 and step 2 on your test - assign the value to GlobalVariable

String ApplicationName = 'SampleApp 123'

GlobalVariable.AppName1 = ApplicationName

3. Use the global variable as below.

println(GlobalVariable.AppName1)

WebUI.setText(findTestObject('Object Repository/Page/input_username'), GlobalVariable.AppName1)

2 Likes

Thanks a lot :slight_smile: It worked!