Re: Script gets hung up on dropdowns (6902 Views)
Reply
Occasional Advisor
ANS_Tester
Posts: 13
Registered: ‎10-07-2013
Message 1 of 3 (6,913 Views)

Script gets hung up on dropdowns

Hello all,

 

So I have been using this bit of code below to get past textboxes that generate suggested items from our database as you type. This code/script has been working great the past few weeks, but I have had issue with it the past few days.

myx = Browser("Browser").Page("Page").WebEdit("WebEdit").GetROProperty("abs_x")
myy = Browser("Browser").Page("Page").WebEdit("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("Browser").Page("Page").WebEdit("WebEdit").Click
Browser("Browser").Page("Page").WebElement("WARMINSTER PA 18974 USA").Click

 Rather than suggesting dropdown items, it just gets hung up on searching. If I manually type in the digits for a zip code as shown above on the script, the program works fine which leads me to believe I need to make adjustments to the scipt. The webapp I have been using does not even search for suggestions from our database if I use the standard .Set to input the value. So I need a way to mimic keystrokes. If anyone has any suggestions, I would greatly appreciate it.

 

Regards,

Erik

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

Re: Script gets hung up on dropdowns

Hello 

 

     The post below has information related to press keys with devicereplay in order to emulate keyboard functionality.

     http://h30499.www3.hp.com/t5/Unified-Functional-Testing-QTP/QTP-UFT-support-tip-Sendkeys-method-is-n...

 

Best Regards.

 

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.

Occasional Advisor
ANS_Tester
Posts: 13
Registered: ‎10-07-2013
Message 3 of 3 (6,874 Views)

Re: Script gets hung up on dropdowns

Alright after a little messing around, I got most of our textboxes to work that used the previous code. All I did was comment the follow code out because I really didn't know what the purpose of it was.

set wshell = Createobject("wscript.shell")

 But it turns out that in some cases I did need the code that I commented out. Dont really know why. My knowledge of VB Scribt is very limited, so im assuming it does actually have a purpose.

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.