tags:

views:

43

answers:

2

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
+2  A: 
  1. Use mentioned above Type method: YourObject.Type micReturn

  2. 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
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
@TestGeek, if the answer solved your problem why don't you accept it? (or at least vote it up).
Motti