WORKING WITH QTP

TestEveryThinG

Use Send Key Method QTP VB

Posted by rajivkumarnandvani on June 15, 2009

Hi All,

Some time we requre keyboard event in Automation so we can use Send key method

rem **********************************************

rem create shell object

set WshShell = CreateObject(“WScript.Shell”)

SystemUtil.Run “C:\Program Files\HP\QuickTest xcxProfessional\samples\flight\app\flight4a.exe”,”C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe”,””,””

rem first click in the text box then use send key method

Dialog(“text:=Login”).WinEdit(“attached text:=Agent Name:”).Click

rem enter rajiv in agent name text box

WshShell.SendKeys “rajiv”

rem click Password Edit box

Dialog(“text:=Login”).WinEdit(“attached text:=Password:”).Click

rem enter check in Password text box

WshShell.SendKeys “check ”

Dialog(“text:=Login”).WinButton(“text:=OK”).Click

rem press escape using send key method

WshShell.SendKeys “{ESC}”

WshShell.SendKeys “{ESC}”

rem **********************************************************

Use the SendKeys method to send keystrokes to applications that have no automation interface. Most keyboard characters are represented by a single keystroke. Some keyboard characters are made up of combinations of keystrokes (CTRL+SHIFT+HOME, for example). To send a single keyboard character, send the character itself as the string argument. For example, to send the letter x, send the string argument “x”.

Note To send a space, send the string ” “.

You can use SendKeys to send more than one keystroke at a time. To do this, create a compound string argument that represents a sequence of keystrokes by appending each keystroke in the sequence to the one before it. For example, to send the keystrokes a, b, and c, you would send the string argument “abc”. The SendKeys method uses some characters as modifiers of characters (instead of using their face-values). This set of special characters consists of parentheses, brackets, braces, and the:

  • plus sign       “+”,
  • caret             “^”,
  • percent sign “%”,
  • and tilde       “~”

Send these characters by enclosing them within braces “{}”. For example, to send the plus sign, send the string argument “{+}”. Brackets “[ ]” have no special meaning when used with SendKeys, but you must enclose them within braces to accommodate applications that do give them a special meaning (for dynamic data exchange (DDE) for example).

  • To send bracket characters, send the string argument “{[}” for the left bracket and “{]}” for the right one.
  • To send brace characters, send the string argument “{{}” for the left brace and “{}}” for the right one.

Some keystrokes do not generate characters (such as ENTER and TAB). Some keystrokes represent actions (such as BACKSPACE and BREAK). To send these kinds of keystrokes, send the arguments shown in the following table:

Key Argument
BACKSPACE {BACKSPACE}, {BS}, or {BKSP}
BREAK {BREAK}
CAPS LOCK {CAPSLOCK}
DEL or DELETE {DELETE} or {DEL}
DOWN ARROW {DOWN}
END {END}
ENTER {ENTER} or ~
ESC {ESC}
HELP {HELP}
HOME {HOME}
INS or INSERT {INSERT} or {INS}
LEFT ARROW {LEFT}
NUM LOCK {NUMLOCK}
PAGE DOWN {PGDN}
PAGE UP {PGUP}
PRINT SCREEN {PRTSC}
RIGHT ARROW {RIGHT}
SCROLL LOCK {SCROLLLOCK}
TAB {TAB}
UP ARROW {UP}
F1 {F1}
F2 {F2}
F3 {F3}
F4 {F4}
F5 {F5}
F6 {F6}
F7 {F7}
F8 {F8}
F9 {F9}
F10 {F10}
F11 {F11}
F12 {F12}
F13 {F13}
F14 {F14}
F15 {F15}
F16 {F16}

To send keyboard characters that are comprised of a regular keystroke in combination with a SHIFT, CTRL, or ALT, create a compound string argument that represents the keystroke combination. You do this by preceding the regular keystroke with one or more of the following special characters:

Key Special Character
SHIFT +
CTRL ^
ALT %

Note When used this way, these special characters are not enclosed within a set of braces.

To specify that a combination of SHIFT, CTRL, and ALT should be held down while several other keys are pressed, create a compound string argument with the modified keystrokes enclosed in parentheses. For example, to send the keystroke combination that specifies that the SHIFT key is held down while:

  • 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”.

You can use the SendKeys method to send a pattern of keystrokes that consists of a single keystroke pressed several times in a row. To do this, create a compound string argument that specifies the keystroke you want to repeat, followed by the number of times you want it repeated. You do this using a compound string argument of the form {keystroke number}. For example, to send the letter “x” ten times, you would send the string argument “{x 10}”. Be sure to include a space between keystroke and number.

Note The only keystroke pattern you can send is the kind that is comprised of a single keystroke pressed several times. For example, you can send “x” ten times, but you cannot do the same for “Ctrl+x”.

Note You cannot send the PRINT SCREEN key {PRTSC} to an application.

Mobile

Advertisements

105 Responses to “Use Send Key Method QTP VB”

  1. Matt said

    Hi,

    Thanks for info above.

    How do you send braces to the screen using .sendkeys? as soon as i put ” within “..” it fails.

    Matt

  2. Hi Matt,

    Thanks for your input. becos u want to put/enter Double Quote for double u have to type four time double quate like this
    quate = “”””
    WshShell.SendKeys quate

    OR u can use like this

    WshShell.SendKeys “”””

  3. Mark said

    How about for ALT + TAB?
    Is it

    Set ALT_TAB CreateObject(“WScript.Shell”)
    ALT_TAB.Sendkeys “{{%+TAB}”

    or
    Set ALT_TAB CreateObject(“WScript.Shell”)
    ALT_TAB.Sendkeys “{{%+”TAB”}”

    It doesn’t work on me…

  4. Mark said

    Sorry.. I mean the syntax below.

    Set ALT_TAB CreateObject(”WScript.Shell”)
    ALT_TAB.Sendkeys “{%+TAB}”

    or
    Set ALT_TAB CreateObject(”WScript.Shell”)
    ALT_TAB.Sendkeys “{%+”TAB”}”

  5. Hi use this

    set ALT_TAB = CreateObject(“WScript.Shell”)
    ALT_TAB.SendKeys “%{TAB}”

  6. Mark said

    Wow this is great! Thanks for the syntax.. =)

  7. michael pedersen said

    How can I get QTP v9.5 to click the “Continue” button from the UAC popup window in Vista?

  8. Hi,
    I did not work with vista using QTP.Try to use recovery scenario..
    may be it will help
    let me know the status..

  9. Ratan said

    Hi,

    Thanks for the good article.
    I am required to do a control click on a radio button in a web page.
    Please let me know how can I proceed.

    Regards,
    Ratan

  10. Thanks.
    Just mention your query/with page details
    I will try my best

  11. Nath said

    How do i send the “space” ?

  12. Hi Nath,

    Please read this carefully and u can use ” ” this instead of passing text just pass blank it will add space menas blank like this

    Dialog(“text:=Login”).WinEdit(“attached text:=Agent Name:”).Click

    rem enter rajiv in agent name text box

    WshShell.SendKeys “rajiv”
    now u have to pass space u can use this way

    WshShell.SendKeys ” ”
    OR
    WshShell.SendKeys “r j v”
    OR
    WshShell.SendKeys ” raj iv ”

    I think it more clear to you.
    let me know if u facing any problem in that

  13. Opicakuz said

    Hi rajivkumarnandvani,
    I have a problem. I would like to send spacebar, but not as space. I dont know how i am able to describe this…

    Shortly: I would like to send alt + spacebar

    Can you help me, please?

  14. means u have to use with key combination. As per my knowledge spacebar stroke u can pass with ” ” as earlier i mentioned but here you have to with alt key plus spacebar that u can use in this way..
    set WshShell = CreateObject(“WScript.Shell”)

    Window(“Notepad”).Activate
    Window(“Notepad”).WinEditor(“Edit”).Type “guo”
    WshShell.SendKeys “%{ }”
    Set WshShell = nothing

    let me know it work or not
    best of luck

  15. Soumya said

    Hi,
    I would love to know if there s a way to use spacebar.
    My prolem is that I have to automate a checkbox “select/deselect” operation.
    I wont be knowing the properties of the object in run time and hence would need to use sendkeys to reach the checkbox object.
    Keyboard has spacebar as shortcut key for selecting a checkbox, but i dont see any such command for spacebar in QTP help.
    Could you please help me?

  16. Hi Soumya,

    is that web application Or windows. incase web application can u send me the HTM of that page so that i can figure out what exactely you can do

  17. Naveen said

    Hi Rajiv,

    How can we pass or send keys of WindowKey+r for opening a Run Pop-up Box.

    Still you need any info, please let me know.

    Gratitude,
    Naveen

  18. Mukesh said

    Hey Rajiv,

    Thanks a lot buddy. This was very useful information.Just wanted to leave a note of thank.

    Thanks
    Mukesh Sharma

  19. Thanks a lot 😉

  20. Amit said

    Hi,

    I am in the process of Automating AS400 Application thru QTP and I want to use Ctrl key.

    I tried using below code but its not working. I mean no purpose of using ctrl key is not achieved.

    Dim WshShell
    set WshShell = CreateObject(“WScript.Shell”)
    WshShell.SendKeys “^”
    set WshShell=nothing

    Please suggest.

  21. murugan said

    Hi,

    Can you please help – how to send (control + *) keystroke.

    I tried with

    set WshShell= CreateObject(WScript.Shell)
    WshShell.Sendkeys “^*”

    but it didn’t work for me..

    Thanks
    Murugan

  22. murugan said

    Hi,

    Can you please help – how to send (control + *) keystroke.

    I also tried with

    set WshShell= CreateObject(WScript.Shell)
    WshShell.Sendkeys “^(*)”
    WshShell.Sendkeys “^{*}”
    Wshell.Sendkeys “Ctrl(*)”
    Wshell.Sendkeys “Ctrl{*}”

    but it didn’t work for me..

    Thanks
    Murugan

  23. hi murugan

    but WshShell.Sendkeys “^{*}” this should work.
    make sure during that time you do not use any keyboard type manualy

  24. hi Amit,

    this should work. make sure during that time you do not use any keyboard type manually

  25. Hi murugan

    check your create object syntax you missed double quote set WshShell= CreateObject(“WScript.Shell”)

  26. Amit said

    Hi Ravi,

    I am not using keyboard type manually. is it the case that for AS/400 screen i.e. via Terminal Emulator the syntax mentioned above doesnt work?
    still stuck up 😦

  27. Hi Amit,

    its Rajiv not ravi. yes it is the issue of Terminal Emulator

  28. testinglearner said

    Hi this helped me a lot.. thanks for the info.

  29. thanks 🙂

  30. Sumedha said

    Hi,

    How do I create 2 tab strokes using SendKeys method in QTP? Can you please assist?

    Thanks!
    -Sumedha

  31. Rashmi said

    Thanks Rajiv!
    Helped me a lot..

  32. Most welcome 😉

  33. Hi Sumedha,

    Sorry for late reply.
    You can use 2 tab strokes in this way
    set WshShell = CreateObject(“WScript.Shell”)
    WshShell.SendKeys “{TAB 2}”

    OR you can write the single stroke two times 🙂
    WshShell.SendKeys “{TAB}”
    WshShell.SendKeys “{TAB}”

  34. Pankaj Charwad said

    Hi,

    i am automating using QTP 9.2 for AS400 based application.
    i want to press Alt+F1 key (to get help screen). Please suggest how to do this in QTP.

    Thanks,
    Pankaj

  35. Hi use this

    set ALT_F1 = CreateObject(“WScript.Shell”)
    ALT_F1.SendKeys “%{F1}”

  36. Sue said

    Thanks…very nice article..I was looking for a way to clear cache and I ended up reading a lot here..

  37. Thanks sue for reading 🙂

  38. neeta said

    My problem is that I have to send Spacebar and End key stokes together to my CICS application.
    We are using terminal emulator.

    I tried folllwoing but didn’t work

    set WshShell = CreateObject(“WScript.Shell”)
    WshShell.SendKeys “””TE_END ”
    set WshShell=nothing

    and

    set WshShell = CreateObject(“WScript.Shell”)
    WshShell.SendKeys “{ } {END} ”
    set WshShell=nothing

    Please advice

  39. Hi Neeta,

    As you said you are using terminal emulator first you check are you able to do manually?
    OR you can use on screen keyboard exe

  40. neeta said

    Hi Ravi,

    I can do it manually.
    I didn’t get ur 2’nd suggestion. Please elaborate.

  41. on run window type osk and press enter.
    osk = on screen keyboard try to record that with qtp

  42. Ann said

    Hi Rajiv
    I try to send Ctrl-F5 to IE8 but it keeps sending only F5. I use WshShell.Sendkeys “^{F5}”. Is there any other way to do it? Thanks.

  43. Hi,

    another way in which context do you need that is your application menu option?
    Or you can record (QTP)low level recording which will record keyboard event.

  44. Ann said

    Low level recording does my job. Thanks 🙂

  45. Ann You are most welcome 🙂

  46. suresh said

    Rajiv,

    Can you please let me know how to send “Ctrl” and “L” through sendkyes method.
    ( Control + letter L)

    In Oracle apps we need to send this combination. There is no other way except this.

    Regards,
    Suresh

  47. Hi Suresh,

    try this:

    set CTRL_L = CreateObject(“WScript.Shell”)
    CTRL_L.SendKeys “^{L}”

    OR

    CTRL_L.SendKeys “^(L)”

    OR
    CTRL_L.SendKeys “^L”

    Thanks

  48. suresh said

    Thank you very much for your time and quick reply.
    Will try this and let you know.

    Regards,
    Suresh

  49. Lakshmi Sanagala said

    Hi,

    I am trying to automate an application in QTP. when I enter user id and hit enter in the application some data pops up and how can I record this? pls help

    Lakshmi

  50. Hi lakshmi,

    what do you mean data pops up Is it autocomplete hint data Or popup window? if popup window comes QTP records or you can try recovery scenario.

  51. yogi said

    hi..
    I am working in VM. when i close the VM the sendkeys doesnt work, script fails… any solution????

  52. hi yogi,

    i did not get chance to work with VM. no idea 😦

  53. Abbey said

    How do you get QTP tp recognize the enter button on the keyboard

  54. Hi abbey,

    I did not get your point. Please explain.. what do you means QTP to recognize the enter button..?

  55. Abbey said

    When you are recording in QTP and you press the enter button on the keyboard during the recordig QTP does not record the enter button actions

  56. Hi Abbey,

    Switch to low level recording mode when you want to record keyboard event

  57. Prasad said

    Requirement : In gmail page enter the user name then press TAB key then verify the cursor is in password field or not. The cursor should be in the password field. Though i am using Object.GetRoProperty(“focus”) and Sendkeys {TAB} to check whether cursor is present or not …it is not working pls help me

    Set QuillHome=Browser(“name:=.**”).Page(“title:=..*”)
    Set UserNameEdit=QuillHome.Webedit(“html id:=ctl00_MainContent_txt.*UserName.*”)
    Set PasswordEdit=QuillHome.Webedit(“html id:=ctl00_MainContent_txt.*Password.*”)

    val = UserNameEdit.GetROProperty(“focus”)
    If val =1 Then
    Print “PASS: By defaulf the cursor is in user name field”
    else
    Print “The cursor is not in the user name field”
    End If

    wait(2)
    UserNameEdit.Set “lookup”

    Set WshShell = CreateObject(“WScript.Shell”)
    WshShell.SendKeys “{TAB}”
    Set WshShell = Nothing

    val1 = PasswordEdit.GetROProperty(“focus”)
    wait 10
    If val1 = 1 Then
    Print “The cursor should be in Password field”
    else
    Print “The cursor is not in the Password field”
    End If

    i am getting output as
    The cursor is not in the Password field

    But AFTER PRESIING TAB KEY FROM USER NAME FIELD THE CURSOR SHOULD BE PASSWORD FIELD….THIS IS THE REQUIREMENT…….

    PLS HELP ME IN THIS ISSUE

    tHANKS
    pRASAD

  58. Chandra said

    Hi,
    How can i perform below scenario using sendkeys?

    Select multiple rows in application. Each row is identified as a web table.

    1. Select a web table in web application
    2. Press Control button from keyboard
    3. While pressing control button, select another web table.

    Appreciate your help!!!

  59. Hi Chandra,
    Thanks for reading the blog.
    please clarify your third step (While pressing control button, select another web table.)
    how do you want to select another web table While pressing control button by mouse OR or using keyboard??

    For pressing the ctrl button and combination with other key you can use in following way

    set CTRL_DOWNARROW = CreateObject(“WScript.Shell”)
    CTRL_DOWNARROW.SendKeys “^{DOWN}”

    OR you can try this after pressing CTRL key using this method

    PressCTRKey = CreateObject(“WScript.Shell”)
    PressCTRKey.SendKeys “^”
    then write your script to select another table.

    Thanks

  60. Claytybabe said

    hello, im looking to send shift keys as themselves not in a combination, i’m trying to create sticky keys, however there is no luck, as the script reads them as a chain, meaning it goes to send it with a key stroke that isnt there, hence ruining what ive done so far, also, is there anyway of doing the same with ctrl???

  61. You can use the SendKeys method to send a pattern of keystrokes that consists of a single keystroke pressed several times in a row. To do this, create a compound string argument that specifies the keystroke you want to repeat, followed by the number of times you want it repeated. You do this using a compound string argument of the form {keystroke number}. For example, to send the letter “x” ten times, you would send the string argument “{x 10}”. Be sure to include a space between keystroke and number.

    PressCTRKey = CreateObject(“WScript.Shell”)
    PressCTRKey.SendKeys “+{5}”

    I am not sure it will work or not just try at your end.

  62. Claytybabe said

    ahh it did not work, it doesnt support the “pressCTRKey” function, I also tried it with SHIFT and the same thing happened, perhaps if it was coupled with a charcter how it is meant to be it might work? but is here a charcter with a nill value?

  63. Try this
    PressShiftKey = CreateObject(“WScript.Shell”)
    PressShiftKey.SendKeys “+”
    PressShiftKey.SendKeys “+”
    PressShiftKey.SendKeys “+”
    PressShiftKey.SendKeys “+”
    PressShiftKey.SendKeys “+”

  64. Claytybabe said

    once again it did not support the function, I tried a code extremely similar to this earlier however to no avail, even with WshShell.SendKeys it hasn’t worked, only either sending +’s themselves, spaces, or not making a difference at all, maybe a keyboard shortcut is exactly that, only activated by the keyboard? have any of these codes worked for you??

  65. hmm.. bad luck i will try from my end when i get QTP on my system. & let u know.

    Thanks

  66. Claytybabe said

    thankyou for your efforts too, ever need anything and i’ll be glad to do what I can

  67. Thanks a lot. 🙂

  68. Anonymous said

    Hi, Thank you very much for such nice information.

    I would like to know if there is any way to click on ‘windows’ button in the keyboard by using sendkey

  69. Hi you can use Autoit,
    http://www.autoitscript.com/autoit3/docs/appendix/SendKeys.htm
    Send(“{LWIN}”)

    Try this in QTP as well please let me know if it works with qtp or not.. else use Autoit..

    {LWIN} Left Windows key
    {RWIN} Right Windows key

  70. Amod Chhetri said

    hello Guys,

    How do I send CTRL – (key board command next to Star of Ten-Key pad) from QTP?

    thanks for your help.

  71. hi try this:

    set CTRL_Minus = CreateObject(“WScript.Shell”)
    CTRL_Minus.SendKeys “^{-}”

  72. chirkoot said

    Hi,

    I want to select text from HTML page copy it and paste in Text file.

    click on Page
    WshShell.SendKeys “^{a}”
    WshShell.SendKeys “^{c}”

    How to get data that copied with last command into a variable?

    Thanks in advance

  73. Chris said

    I tried the following:

    Set WshShell = CreateObject(WScript.Shell)
    WshShell.SendKeys”{CAPSLOCK}”

    But when I run it, I get an error saying:

    Object required: ‘WScript’
    Line (3): “Set WshShell = CreateObject(WScript.Shell)”.

    Has anyone seen this before?

  74. Hi chirkoot,

    use mercury clipboard.
    Set cb = CreateObject(“Mercury.Clipboard”)
    Rem Clear the clipboard
    cb.Clear
    click on Page
    WshShell.SendKeys “^{a}”
    WshShell.SendKeys “^{c}”
    Get the clipboard value into your variable
    myvariable = cb.GetText

    Hope this will help.
    best of luck…
    Thanks for reading the blog
    http://testeverythingqtp.blogspot.com/

  75. Hi,

    Your object is not creating that’s y your are getting this error . You missed the double quote
    Please create the object like this.. Set WshShell = CreateObject(“WScript.Shell”)

    thanks

  76. Uma said

    Hi,
    I am working on Webapplication using QTP.
    I have to slect the multiple webelements by clicking on either the CTRL or Shilft nad the webelement.
    i tried by sendkey method but unable to select multiple

    I have used this function .

    Set WshShell = CreateObject(“WScript.Shell”)
    Set web1=description.Create()
    web1(“micclass”).value=”WebElement”
    web1(“html tag”).value=”NOBR”
    Set web2= Browser(“xxxx”).Page(“xxxx”).Frame(“xxxx”).ChildObjects(web1)
    For i=0 to web2.count-1
    If web2(i).getroproperty(“innerhtml”)=”History Summary” Then
    WshShell.SendKeys “+^”
    web2(i).click
    End If

    If web2(i).getroproperty(“innerhtml”)=”Times” Then
    WshShell.SendKeys “+^”
    web2(i).click
    End If

    If web2(i).getroproperty(“innerhtml”) = “Distances” Then
    WshShell.SendKeys “+^”
    web2(i).click
    End If
    Next

    can any one pls help me on this

    Thanks
    un advance

  77. Anonymous said

    How to select multiple Webelements , when Ctrl or shift button is used to selecct multiple webelemnts manually.

    this is the function i used but not unable to select the multiple items.

    Set WshShell = CreateObject(“WScript.Shell”)
    Set web1=description.Create()
    web1(“micclass”).value=”WebElement”
    web1(“html tag”).value=”NOBR”
    Set web2= Browser(“xxxxx”).Page(“xxxx”).Frame(“xxxx”).ChildObjects(web1)
    For i=0 to web2.count-1
    If web2(i).getroproperty(“innerhtml”)=”History Summary” Then
    WshShell.SendKeys “+^”
    web2(i).click
    End If

    If web2(i).getroproperty(“innerhtml”)=”Times” Then
    WshShell.SendKeys “+^”
    web2(i).click
    End If

    If web2(i).getroproperty(“innerhtml”) = “Distances” Then
    WshShell.SendKeys “+^”
    web2(i).click
    End If
    Next

    can any one Help me on this

    Thanks in advance
    Uma

  78. scjpite said

    Hi Rajiv,

    Is there any way to perform the key board event as follows:
    press rightmost control key + scrollLock+ScrollLock

    Please Help…

  79. Sumeet said

    Can any one give solution to above mentioned question.
    Or Can we use sendkey function with combination of control key and function which is use to click row in table.

  80. yes, you can use sendkey function with combination of control key and function. Did you try this after focusing on that object. because send key method on object will work only if focus present on object.

  81. satwiki said

    hi,
    Plese help me How to use sendkeys for mouse rightclick

  82. Hi refer to this:

    http://testeverythingqtp.blogspot.com/2011/06/qtp-mercury-devicereplay-vs-sendkeys.html

  83. Anonymous said

    Hi Rajiv
    I want to press “Enter” key present on Numpad… Is there any way I can do the same using send keys? please guide..

  84. Abhishek said

    Hi, Please help me How to use sendkeys for “Enter key” present on Numpad

  85. Reena said

    Hi,
    Please help me how to use sendkeys for insert+F7 in QTP. I have used below syntax but it is not working.

    Set WshShell = CreateObject(“WScript.Shell”)
    WshShell.SendKeys “INS{F7}”

  86. Reena said

    any updates …..

  87. Set WshShell = CreateObject(“WScript.Shell”)
    WshShell.SendKeys “{INSERT}{F7}”

  88. Reena said

    its not working. I have already tried this as well. It is taking Insert as string and F7 as command. When i performed the same in QTP, it opened step generator and write “Insert” in qtp.

  89. Set WshShell = CreateObject(WScript.Shell) WshShell.SendKeys {INSERT} WshShell.SendKeys “{F7}

  90. Reena said

    we have tried this also, but didn’t get success 😦
    Also can you plz help me to get the Ascii value of “Insert” key.

  91. maxcool13 said

    Hi,

    I think you want to send the combination of both key right..?? So what Rajiv said It wont work because WshShell.SendKeys “{INSERT}” and then WshShell.SendKeys “{F7}” will send these keys uniquely not the combination of both.

  92. Reena said

    yes .. I want to send the combination of “Insert” and “F7” Key.

  93. Try to record in analog/low level recording.

  94. maxcool13 said

    I think Low level recording will not work. It is itself a very interesting and difficult one. Reena i don’t think here anyone can provide you a solution for this.

  95. Reena said

    😦

  96. Sameer Malik said

    How Do i find a button on screen with WScript.Shell.??

    Please Help!!!

    Thanks in Advance !!

  97. Suresh said

    I am trying to automate a as400 application and want to capture shift+escape+enter in QTP. Please suggest how this can be done

  98. garfield said

    hi, how can I do automate alt and double click ?
    ı find alt ,and double click . How can combine this ?

  99. Penchal said

    Hi Rajeev,
    How to script for searching for word on any web page which is present in multiple place that should be highlighted/selected wherever it is present .Moreover i want count for word(howmany times it is present on the page)..kindly help me in these

  100. Anonymous said

    Hi Suresh

    Set wsh2 = CreateObject(“wscript.shell”)
    wsh2.SendKeys “{TAB}”
    Set wsh2 = Nothing
    while executing above code it takes too much time after 3/4 iterations on web ui.. Any idea..please reply
    Tejas

  101. Anonymous said

    How to open “run” or “window button + R” using sendkeys

  102. […] Use Send Key Method QTP VB « WORKING WITH QTP – Jun 15, 2009 · Hi All, Some time we requre keyboard event in Automation so we can use Send key method. rem ***** rem create shell object… […]

  103. Ricky said

    How to add a listerner for SendKey ” “

  104. harsha said

    Hi,

    How to use/press control+p keys in QTP using sendkeys methods?

  105. Maruthi Kumar N R said

    Hi, I am new learner to QTP. I am trying to automate a scenario as mentioned here “Click on Start button – Click on Outlook 2013 – Click on New Email – Click on To button – Then enter some text to search – Click on Go – ……”

    Below is the code i was using – I have 2 questions in this:

    1. Here, if the search results is 0 then i want to clear the text and enter some other text. Tried a lot but not getting any idea how to clear the text entered in the Search text box.
    2. In the second line of code, if the sequence of all items changes, then it won’t identify the item and the test case fails. How can we use the regular expression for this or is there any other way??

    “Window(“nativeclass:=Shell_TrayWnd”).window(“nativeclass:=Button”,”regexpwndtitle:=Start”).Click
    Window(“regexpwndtitle:=Start menu”).WinListView(“nativeclass:=SysListView32″,”regexpwndclass:=SysListView32″,”all items:=Outlook 2013\nPicPick Portable \(PortableApps\.com Launcher\)\nGoogle Chrome\nSkype for Business 2015\nExcel 2013\nWord 2013\nNotepad\nMobilePASS\nSticky Notes\nCalculator\nPaint\nOneNote 2013”).Select(“Outlook 2013”)
    Window(“nativeclass:=rctrl_renwnd32”).WinObject(“nativeclass:=window”,”acc_name:=Ribbon”).WinButton(“nativeclass:=push button”,”acc_name:=New Email”).click
    Window(“regexpwndtitle:= Message \(HTML\)”).WinButton(“nativeclass:=Button”,”regexpwndclass:=Button”,”text:=To&…”).click
    Window(“regexpwndtitle:= Message \(HTML\)”).Dialog(“regexpwndtitle:=Select Names: Global Address List”,”text:=Select Names: Global Address List”).WinRadioButton(“regexpwndtitle:=Mo&re columns”).Click
    Window(“regexpwndtitle:= Message \(HTML\)”).Dialog(“regexpwndtitle:=Select Names: Global Address List”,”text:=Select Names: Global Address List”).WinObject(“attached text:=&Search:”,”regexpwndclass:=RichEdit20W”).Type”Maruthi-kumar.n-r@hpe.com”
    Window(“regexpwndtitle:= Message \(HTML\)”).Dialog(“regexpwndtitle:=Select Names: Global Address List”,”text:=Select Names: Global Address List”).WinButton(“regexpwndtitle:=&Go”).Click
    Window(“regexpwndtitle:= Message \(HTML\)”).Dialog(“regexpwndtitle:=Select Names: Global Address List”,”text:=Select Names: Global Address List”).WinObject(“attached text:=&Search:”,”regexpwndclass:=RichEdit20W”).Click
    Window(“regexpwndtitle:= Message \(HTML\)”).Dialog(“regexpwndtitle:=Select Names: Global Address List”,”text:=Select Names: Global Address List”).WinObject(“attached text:=&Search:”,”regexpwndclass:=RichEdit20W”).SendKeys “{ctrl+A}”

    Thanks for the help in advance 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: