Press Enter Key in qtp

0 votes
asked Aug 25, 2010 by testgeek

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?

3 Answers

0 votes
answered Aug 26, 2010 by albert-gareev

You can either send key (micEnter) through .Type() method of the object or use FireEvent to invoke an event handler directly.

0 votes
answered Aug 29, 2010 by katmoon
  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.

0 votes
answered Sep 15, 2017 by gopu-alakrishna

Set WshShell = CreateObject("WScript.Shell")


WshShell.SendKeys (ENTER) '--------parenthesis

Welcome to Q&A, where you can ask questions and receive answers from other members of the community.
Website Online Counter