Facebook

For any corporate training requirements Please mail To sudhakar@qtpsudhakar.com
Course Name Date Time Duration Type Location
An important update from QtpSudhakar. I stopped giving classroom training in MindQ Systems. I have bigger plans and I want to put an end to regular classroom training because very less people are practicing. From now onwards every session of mine is going to have explanation and practice. Everyone should practice in presence of mine and should go out of classroom with practical knowledge. So I started my own institute AnyTechLabs in Madhapur. Please reach out to +91-8328152362 for course details. Visit AnyTechLabs.com for address details.
Selenium + Cucumber 22nd September 9 AM IST to 2.00 PM IST 4 WeekEnds Theory + Practical AnyTechLabs
Selenium + Cucumber 8th October 7.30 AM IST to 9.00 AM IST 45 Days Theory+Practical AnyTechLabs

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