Micro Focus QTP (UFT) Forums
handling Autocomplete field using QTP11 - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: handling Autocomplete field using QTP11 (/Thread-handling-Autocomplete-field-using-QTP11)



handling Autocomplete field using QTP11 - sandler - 06-06-2012

Hello!

I'm trying to automate an Automcomplete field. I'm suppose to write 2-3 letters and it will give a list and from within the list I've to pick one and click on "Submit" button.

I tried various ways to do so but had no luck Sad
A small intro of application
Applocation is developed in ADF (J2EE technology) and I'm automating the same using QTP11 and the application on IE9.


Appreciate all your help.


RE: handling Autocomplete field using QTP11 - supputuri - 06-06-2012

There are many ways to do this, below is one of them which i will recommend & was using.

Step1:Add the list object to OR and then add listitem object under list object. Make sure that you are able to identify the objects when it is displayed. Use innertext/Name property for the list item.
Step2: Now in the script use the settoproperty and set the value which you have to select.
Step3: Now check whether that listitem object exist or not. If the listitem object exist then select the item else write an error message.
please find the attached screenshot for OR related info, below is the code snippet

Code:
Browser("Combo Boxes").Page("Combo Boxes").WebEdit("CmbEditBox").Click
Browser("Combo Boxes").Page("Combo Boxes").WebEdit("CmbEditBox").Set "o"
Wait (5)
Browser("Combo Boxes").Page("Combo Boxes").WebElement("cmbList").WebElement("ListItem").SetTOProperty "innertext","ohio"
msgbox Browser("Combo Boxes").Page("Combo Boxes").WebElement("cmbList").WebElement("ListItem").Exist(0)