My Blog List

Monday, May 4, 2015

Handling auto populate, delayed masking and auto select fields

While doing automation, we could have come across the fields which will do the functionality like,
1. While entering some text, it will auto populate the matching values
2. While entering the text, it will mask the values i.e. convert to xxx.. or ....

To simulate the functionality many of us could have faced problems while entering the values on the field;

  • The value entered is not converting as masking text as it is doing while manual flow
  • The form not accepting the entered values
  • The entered/selected value not persists in the field after the simulation, etc.

How to handle such controls effectively. Here we go;
1. WScript.Sendkeys

Set shell = CreateObject("Script.Shell")
Window("hwnd:=" & Browser("myApp").GetROProperty("hwnd")).Activate  'if it's Browser
obj.Set ""
Wait 1
obj.FireEvent "OnFocus"
Wait 1   
shell.SendKeys "your value", 1000
Wait 1
shell.SendKeys "{TAB}"

The important thing here, always have focus on the current window before passing sendkeys.

2. BLUR
 You can call the blur event after entering the values in the field like;

Set shell = CreateObject("Script.Shell")
Window("hwnd:=" & Browser("myApp").GetROProperty("hwnd")).Activate  'if it's Browser
obj.Set ""
Wait 1
obj.FireEvent "OnFocus"
Wait 1   
shell.SendKeys "your value", 1000
Wait 1
obj.Object.blur 'OR obj.FireEvent "OnBlur"

May be both the approaches will fail or should be better approaches out there, please feel free to share with us.

2 comments:

  1. Thanks for sharing great information in your blog. Got to learn new things from your Blog . It was very nice blog to learn about Selenium

    ReplyDelete
  2. Hi I need a help with RESTAPI testing UFT 12.53, where I have to take a response json and make it as an input to another HttpRequest or store it in the file as a step output. Can you please give me what steps I might need to follow. I did go through this : https://community.hpe.com/t5/Unified-Functional-Testing/UFT-API-Test-REST-Assign-JSON-request-run-time/m-p/6785451#M16286 but somehow not able create the file.

    ReplyDelete