Send Text to field after GetAttribute value of field

I have a field titled PRO that is a number. I want to get the value in that field, change the value in that field to something else, check for an error, and then resend the original value back to the PRO field. I’m stuck on the last line of code to send the original value back…any suggestions?

(We use react so I’m having to use getAttribute to get the value of the field.)

Get the original value in the TestObject titled input_PRO
String value = WebUI.getAttribute(findTestObject('PreAudit/Page_/input_PRO'), 'value')    

'Display the original value in the console'
println('The value is: ' + value)    

Set the value of the input_PRO field to a new value of 1234567891
WebUI.setText(findTestObject('PreAudit/Page_/input_PRO'), '1234567891')    
WebUI.sendKeys(findTestObject('PreAudit/Page_/input_PRO'), Keys.chord(Keys.ENTER))    

Verify the error is displayed
WebUI.verifyElementPresent(findTestObject('PreAudit/Page_/div_PRO number does not match format  for SCAC'), 0)

Here I want to set the value in the PRO field back to the original value, but I'm not sure how to do this.
value = WebUI.setText(findTestObject('PreAudit/Page_/input_PRO'), + value)

I figured it out, sorry for the wast of time. I used:

WebUI.setText(findTestObject(‘PreAudit/Page_/input_PRO’), value)

1 Like