Forum Discussion

udhayas's avatar
udhayas
Occasional Contributor
13 years ago

Key board Inputs.

How can I write a VB Script to automate the find process by using the keyboard inputs like "Ctrl + F". How can I get this once a web page is loaded.

Please help me with this.

4 Replies

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3
    Hi Udhay,



    a) I would recommend to record the actions (select script recording but not keyword test recording (http://smartbear.com/support/viewarticle/11287/)) and look at the result;



    b) Do you really need to use the Ctrl-F functionality? Are you testing the Find dialog? If not, then why not to get the contents of the target page as a text (use the Object Browser to find the property that contains the contents of the tested page as a text) and then use the string functions like StrContains() to check if the page contains the text you are looking for.
  • udhayas's avatar
    udhayas
    Occasional Contributor
    Hai Alexei,



    Thank You for your suggestion. The link was helpful. But I have also found the way for getting the keyboard inputs in VB Script using the Windows Scripting send key methods which is explained in the blog http://mercuryquicktestprofessional.blogspot.com/2007/11/ways-to-send-keyboard-input-to.html and  the input characters for keyboard inputs like SHIFT, CTRL, ALT can be done with the help of the msdn library http://msdn.microsoft.com/en-us/library/8c6yea83.aspx.
  • Hello Udhay,



    Here is the code that demonstrates a possible approach:


    Call Sys.Process("iexplore").ToUrl("http://smartbear.com/")
     

    Set Page = Sys.Process("iexplore").Page("http://smartbear.com/")


    Call Page.Keys("^f")

     
  • udhayas's avatar
    udhayas
    Occasional Contributor
    Hi Allen,



    Thanks for reply. This is exactly what I was looking for.



    Regards,

    Udhay.