Facebook

For any corporate training requirements Please mail To sudhakar@qtpsudhakar.com
New Schedule in MindQ Systems, Madhapur By SUDHAKAR
Course Name Date Time Duration Type Branch
UFT + UFTPro 20th September 2017 7.30 AM - 9.00 AM IST 25Days Classroom + Online Hitech City
Selenium+Appium 4th October 2017 4.30 PM - 6.00 PM IST 40Days Online -

A book "Cracking the QTP interview" authored by Sudhakar.Read More. Buy From FlipKart

Tuesday, April 27, 2010

Set Value in EditBox Using DOM

'***************************************************
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"


_______________________________________________________
Please send your Suggestions and Doubts to my yahoo group http://in.groups.yahoo.com/group/qtpsudhakar

No comments :

Post a Comment