How to perform the Pressing of Enter Action in QTP. I'm selecting a cell and able to set a value , Now i want to press enter key and get the list from that Java Edit box. Which are the different ways i can achieve this?
A:
You can either send key (micEnter) through .Type() method of the object or use FireEvent to invoke an event handler directly.
Albert Gareev
2010-08-26 13:19:45
+2
A:
Use mentioned above Type method:
YourObject.Type micReturn
Use SendKeys method:
Function SendKeys(sKey)
Set WshShell = CreateObject("WScript.Shell")
WshShell.AppActivate "Your browser" ' You may need to activate your browser first
WshShell.SendKeys sKey
wait(1) ' You may need to add some Wait statements around
End Function
In your case it will be
SendKeys "{ENTER}"
See MSDN SendKeys and MSDN AppActivate for more details.
katmoon
2010-08-29 08:41:32
I tried with by using mercury.devicereplay, It didnt worked earlier, That was becous of Constants being defined in the Functions. So only i used Wshell.shell , it worked for me.... Thank u all...
TestGeeK
2010-08-30 08:10:42
@TestGeek, if the answer solved your problem why don't you accept it? (or at least vote it up).
Motti
2010-08-31 08:56:34