Function for Key board entries

I would like to know how can i create a function for the Key board entries like the F1, F2, F3....., ALT+TAB, Shift+Tab, etc. and can use it as a Business or Scripted Component in QC?

Questions by SravantiK

Showing Answers 1 - 9 of 9 Answers

akothuru

  • Jun 6th, 2008
 

Using SendKeys method, user can perform keyboard operations like Alf+F4 , Ctrl, Backspace etc in QTP... and it is a VB Script code

'Create Shell object to access Sendkeys method
Set objShell = CreateObject("WScript.Shell")
objShell.SendKeys "aaa" 'Enters the string "aaa" using keyboard
objShell.SendKeys "{F5}"  'Press F5 button Refresh
objShell.SendKeys "%{F4}"  'Close the currently activated window/browser

Note:
% represents Alt
+ represents Shift
^ represents Ctrl

  • e and c are pressed, send the string argument "+(ec)".
  • e is pressed, followed by a lone c (with no SHIFT), send the string argument "+ec".

  •   Was this answer useful?  Yes

    yuvaraj

    • Jun 18th, 2015
     

    I am writing a small utility to interact with mainframe using VBA. I am trying to use send key for shift(+) and its not working but able to enter other things like "enter", "function keys" etc..

      Was this answer useful?  Yes

    saurabh

    • Jul 4th, 2015
     

    Hi ,
    I used below in my script and it worked.
    Set WshShell = CreateObject("WScript.Shell")
    strLink1=Split(strTestDataValues(Iterator1),",")
    .WebEdit("edt_mainsearch_box").FireEvent "onclick"
    .WebEdit("edt_mainsearch_box").Set "prin"
    .WebEdit("edt_mainsearch_box").FireEvent "onclick"
    WshShell.SendKeys "{BACKSPACE}"
    wait 6

      Was this answer useful?  Yes

    Give your answer:

    If you think the above answer is not correct, Please select a reason and add your answer below.

     

    Related Answered Questions

     

    Related Open Questions