Thursday, August 18, 2011

Function to "type" into web edits rather than using .set

Function objectType(objObject, parameter)
   On Error Resume Next
   objObject.Click
   Set oShell = CreateObject("WScript.Shell")
   oShell.SendKeys parameter
   oShell.SendKeys("{TAB}")
   Set oShell = Nothing
   If Err.Number = 0 Then
      objectType = True
   Else
      Reporter.ReportEvent micFail, "objectType", "Error # " & CStr(Err.Number) & "Error Detail: " & Err.Description & "Error source: " & Err.Source
      Err.Clear
      objectType = False
   End If
   On Error GoTo 0
End Function

You can call this function as
objectType(UserName, Arun)

No comments:

About Me

My photo
Hi all,I am Arun Singh Rajaputra. I am working as a Project Lead in a reputed organization in Hyderabad, AP, India. I have little bit knowledge on Quick Test Professional and like to share my knowledge to all through this blog.

Subscribe to get updates on this blog

Enter your email address:

NOTE

Some of the posts posted in this blog are collected and most of them have been prepared by me. If any one have objections regarding any copied posts. Please mail me so that I can take a necessary action on that post.