WORKING WITH QTP

TestEveryThinG

Archive for May, 2008

Get Max Length For Windows Edit Box (Single line edit box)

Posted by rajivkumarnandvani on May 10, 2008

”’  This Script for Check Max length In Edit Box (single line edit box ) With ussing  Maxlength Function

Set ObjName = Window(“Flight Reservation”).WinEdit(“Name:”)
Function Fun_maxlength (ObjName)
Dim m_counter
Dim  m_maxlength
Dim m_entervalue
m_entervalue=”a”
m_counter=0
Do
ObjName.set m_entervalue
m_value =ObjName.GetROProperty(“text”)
m_counter=m_counter+1
m_maxlength=len(m_value)
m_entervalue=m_value+”a”
Loop until (m_counter<>m_maxlength)
Fun_maxlength =m_maxlength
End Function

Posted in QTP, WINDOWS | Tagged: , , | 2 Comments »

How to Connect oracle database through QTP SCRIPT

Posted by rajivkumarnandvani on May 10, 2008

”””””””””””””””
Set objCon=CreateObject(“ADODB.Connection”)
Set objRec=CreateObject(“ADODB.Recordset”)
objCon.Open  “Driver={Oracle in OraHome92};” & “SERVER=”& Servicename &”;”& “UID=”&   Username &”;” &”PWD=”& Password &”;” &”DBQ=”& Servicename &”;”  “DRIVER={Oracle in OraHome92};SERVER={Servername};UID={Username};PWD={Password};DBQ={Dbnmae}”
objRec.Open “select  *  from users”,objCon
While( objRec.BOF eqv 0 )
objRec.MoveNext
Msgbox “Result” & objRec.Fields(0) &”   “& objRec.Fields(1)
Wend

objRec.Close
objCon.Close
Set objRec=Nothing
Set objCon=Nothing
Msgbox “Executed Sucessfully”

Posted in DATABASE | Tagged: , , , , , , , , | Leave a Comment »

Expand Tree Object in Web Page

Posted by rajivkumarnandvani on May 10, 2008

” this script expand tree object in webpage

set objdesc= Description.Create()
objdesc(“micclass”).value =”Image”
Set Objimage = Browser(“<browsername>”).Page(“<browserpage>”).ChildObjects(objdesc)
ImageCount = Objimage.Count
For i = 0 To ImageCount – 1
var = Objimage(i).GetROProperty(“alt”)
If InStr(1, var, “Expand”, 1) > 0 Then
Objimage(i).click

ImageCount = Objimage.Count

End If

Posted in WEB | Tagged: , , , | Leave a Comment »

 
%d bloggers like this: