WebEdit doesn’t always populate correctly in UFT
Question ID: 107204

I’m trying to work with a WebEdit field, and sometimes when I play back my script, the set operation doesn’t fill out the field completely. I try and type a phone number, for instance, and it only types part of it sometimes, like 55-1212 or 888-555-1 or something like that. Any ideas to make it more consistent?

Marked as spam
Posted by (Questions: 227, Answers: 22)
Asked on October 26, 2016 3:35 pm
Answers (1)
Private answer

Take a look at the simple routine I have below I expect it may need some tweaking to work in your situation as your object probably behaves slightly different, but it gives you a general idea of a simple approach you can take.

Basically, I created a loop that clears the field by clicking on it, sets the value, and then does a GetROProperty to get the text of the field. We can then use a conditional to see if it is correct or not. If it's not, the loop repeats until it is input correctly and then exits the loop and continues on.

match = 0 'Set the loop flag
Do Until match = 1 'Set exit condition for loop
Browser(''Test Site'').Page(''Object Page'').WebEdit(''Phone number:'').Click
Browser(''Test Site'').Page(''Object Page'').WebEdit(''Phone number:'').Set ''888-555-1212''
Wait 1
field_val = Browser(''Test Site'').Page(''Object Page'').WebEdit(''Phone number:'').GetROProperty(''value'') 'Get the value of the web edit object and store in field_val variable
If field_val = ''888-555-1212'' Then 'Compare the field_val variable against expected
match = 1 'Set the exit flag to 1 to exit loop
End If
Wait 1
Loop 'Continue looping

The format of the set value and the value used in the if may need to be modified depending on what the value can be input as and what it is displayed as. You could insert a MsgBox field_val line after the GetROProperty if you would like to see the way the value is returned. If you get a blank value back, you may need to change the GetROProperty from 'value' to 'text'and see if that helps.

Don't forget that you can use the object spy to hone in on which property you need to work with

Marked as spam
Posted by (Questions: 2, Answers: 477)
Answered on October 26, 2016 3:37 pm

Welcome back to "EyeOnTesting" brought to you by Orasi Software, Inc.

Scroll to Top