Field data not committing when UFT script plays back
Question ID: 107418
0
0

I’m trying to work with a WebElement field that is populating fine when running, but when I check the value on the next page, it doesn’t show up. I see the script populate the field with the data, but it is not committing for some reason. Manually, I’m able to type in the data and it works. Any ideas?

Marked as spam
Posted by (Questions: 227, Answers: 22)
Asked on January 30, 2017 3:26 am
86 views
Answers (3)
1
Private answer

Normally, what I do in these situations is try to replicate keyboard entry. I have a feeling that you need to press the Tab key after populating the data field for it to 'commit' to the field. Try adding this code after the .Set or .Type line that you are using to type the data into the field. This will send a Tab keystroke just like you would navigate the field if you were doing this manually:

Set KeyPrs = WScript.CreateObject(''WScript.Shell'')
KeyPrs.SendKeys ''{TAB}''
Set KeyPrs = Nothing

Marked as spam
Posted by (Questions: 2, Answers: 477)
Answered on January 30, 2017 3:27 am
0
Private answer

Another thing you can also try if the Tab key doesn't work is to use the arrow keys. It depends on how you would normally navigate the fields manually.

For instance, just like the above, you can use the different arrow keys (LEFT,RIGHT,UP,DOWN) in place of a tab as such:

Set KeyPrs = WScript.CreateObject(''WScript.Shell'')
KeyPrs.SendKeys ''{DOWN}''
Set KeyPrs = Nothing

or

Set KeyPrs = WScript.CreateObject(''WScript.Shell'')
KeyPrs.SendKeys ''{RIGHT}''
Set KeyPrs = Nothing

You may need to do some trial and error to get it to work. There are many different key combinations you can try with SendKeys. For more information, check the following site:

http://ss64.com/vb/sendkeys.html

Marked as spam
Posted by (Questions: 2, Answers: 477)
Answered on January 30, 2017 3:31 am
0
Private answer

Thanks. The SendKeys TAB worked. I was using that key when I tested it manually.

Marked as spam
Posted by (Questions: 227, Answers: 22)
Answered on January 30, 2017 3:35 am
EyeOnTesting

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

X
Scroll to Top