Re: Help with selecting auto generated objects from dropdown text box (441 Views)
Reply
Visitor
SomeIntern
Posts: 3
Registered: ‎10-03-2013
Message 1 of 6 (475 Views)
Accepted Solution

Help with selecting auto generated objects from dropdown text box

Hello,

 

So i have recently been using a trail version of QTP. I was having the problem show as my subject line and came across the following solution:

 

Browser("****************").Page("****************").WebEdit("************").Set "18974"

set wshell = Createobject("wscript.shell")
Browser("************").Page("****************").WebEdit("WebEdit").click
wshell.SendKeys "{DOWN}"
wshell.SendKeys "{DOWN}"
Browser("******************").Page("*****************-").WebElement("WARMINSTER PA 18974 USA").Click

 

This let me insert a value and select from a auto generated list of objects......

The problem i have now is that my company has decided to buy UFT and before we install the product key, we wanted to make sure the scripts we had still work. I have ran into the same error i had, and this code no longer seems to fix the problem.

 

My script puts the value 18974 into the textbox for zip codes, but no suggestions are listed. If there was a way to mimic keystrokes, I believe that would work to get the suggested values to at least be displayed.

HP Expert
vzamoraz
Posts: 502
Registered: ‎04-12-2012
Message 2 of 6 (463 Views)

Re: Help with selecting auto generated objects from dropdown text box

Hello,

 

 

   That should works on UFT.

   try .object

 

   

Browser("****************").Page("****************").WebEdit("************").Object.Set "18974"

set wshell = Createobject("wscript.shell")
Browser("************").Page("****************").WebEdit("WebEdit").click
wshell.SendKeys "{DOWN}"
wshell.SendKeys "{DOWN}"
Browser("******************").Page("*****************-").WebElement("WARMINSTER PA 18974 USA").Click

 

 

   Or You can try Device replay to set the value

 

   myx = Browser("****************").Page("****************").WebEdit("************").GetROProperty("abs_x")

   myy= Browser("****************").Page("****************").WebEdit("************").GetROProperty("abs_y")

   set DeviceReplay = CreateObject("Mercury.DeviceReplay")

   DeviceReplay,mouseclick myx+5,myy+5,0

   wait 1
   DeviceReplay.SendString("18974")

   set DeviceReplay = nothing    

   set wshell = Createobject("wscript.shell")
   Browser("************").Page("****************").WebEdit("WebEdit").click
   wshell.SendKeys "{DOWN}"
   wshell.SendKeys "{DOWN}"
   Browser("******************").Page("*****************-").WebElement("WARMINSTER PA 18974 USA").Click

 

 

Remember if you have a valid contract with HP feel free to visit our FT/QTP Support Customer Forums: http://h30499.www3.hp.com/t5/Functional-Testing-QTP/ct-p/sws-Fun_Test 

You can create an account with your HP credentials.

 

 

Note: The Opinions expressed in my post are mine alone, and do not reflect the opinions of my employer. No warranties express or implied for any answered posted.

 

Visitor
SomeIntern
Posts: 3
Registered: ‎10-03-2013
Message 3 of 6 (454 Views)

Re: Help with selecting auto generated objects from dropdown text box

Your first suggestion did not seem to work.

 

And I received a syntax error for the following line on your second suggestion:

   DeviceReplay,mouseclick myx+5,myy+5,0

 

I will take your advice and try using the FT/QTP Support Customer Forums

 

HP Expert
vzamoraz
Posts: 502
Registered: ‎04-12-2012
Message 4 of 6 (441 Views)

Re: Help with selecting auto generated objects from dropdown text box

the problems is because I set colon instead of dot after DeviceReplay

 

It should be

DeviceReplay.MouseClick myx+5,myy+5,0

Visitor
SomeIntern
Posts: 3
Registered: ‎10-03-2013
Message 5 of 6 (415 Views)

Re: Help with selecting auto generated objects from dropdown text box

This code seems to work. I was having an issue getting a error on the same line of code before when using this piece of code on the same page twice on my web app. I worked around it by setting one letter in the object box before the code you gave me. So everything seems to be working now. Thank you again for all your help.

HP Expert
vzamoraz
Posts: 502
Registered: ‎04-12-2012
Message 6 of 6 (411 Views)

Re: Help with selecting auto generated objects from dropdown text box

 

You'r welcome 

 

 

Note: The Opinions expressed in my post are mine alone, and do not reflect the opinions of my employer. No warranties express or implied for any answered posted.

 

Also remember if you have a valid contract with HP feel free to visit our FT/QTP Support Customer Forums: http://h30499.www3.hp.com/t5/Functional-Testing-QTP/ct-p/sws-Fun_Test
You can create an account with your HP credentials.

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.