'***************************************************
Function SetValueinEditBox(PageObject,EditName,Value2Set)
Dim EditObjects
Dim Edit
set EditObjects=PageObject.getElementsByTagName("INPUT")
For each Edit in EditObjects
If lcase(Edit.name)=lcase(EditName) and lcase(Edit.type)="text" then
Edit.value=Value2Set
Exit for
End If
Next
Set EditObjects= Nothing
Set Edit=Nothing
End Function
'***************************************************
'Using above Function without QTP
'***************************************************
'Create Internet Explorer Object
Set IE=CreateObject("internetexplorer.application")
'Make it Visible
IE.Visible=True
'Navigate to a URL
IE.Navigate "http://google.com"
'Get Document Object
Set PageObject=IE.Document
'Set Value in Google Search Edit Box
SetValueinEditBox PageObject,"q","qtp sudhakar"
'***************************************************
'Using above Function in QTP
'***************************************************
'Open internet explorere with specific URL
SystemUtil.Run "iexplore.exe","www.google.com"
'Get DOM Page object using .Object property
set oPageObject=Browser("name:=Google").Page("title:=Google").Object
'Set Value in Google Search Edit Box
SetValueinEditBox PageObject,"q","qtp sudhakar"
No comments :
Post a Comment