Skip to main content

Posts

Verify Broken Links in Page using QTP

------------------------------------------------------------------------------------------------------------ Browser("Browser").Page("Page").Sync Set objLink = Description.Create objLink("micclass").Value = "Link" Set objAllLinks = Browser("Browser").Page("HomePage").ChildObjects(objLink) iTotalLnksCnt = objAllLinks.Count For iCurItr =0 to iTotalLnksCnt - 1 strURL = objAllLinks(iCurItr).GetROProperty("url") Set objWinHTTP = CreateObject("WinHttp.WinHttpRequest.5.1") objWinHTTP.Open "GET", strURL, False objWinHTTP.SetRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MyApp 1.0; Windows NT 5.1)" objWinHTTP.Send iReturnVal = objWinHTTP.Status If iReturnVal = 200 Then msgbox "Link - " & sURL & " Exists" ElseIf iReturnVal = 404 Then msgbox "Link - " & sURL & " is Broken" Else msgbox "C...

Triggering Web Services Using QTP

                      Triggering Web Services Using QTP   'Web Service url sWebserviceURL=  "http://sample.wsdl" 'Input file InputRequest = "C:\Jay\Input.txt" 'response or output file sOutputXML= "C:\Jay\Output.txt" 'Fso Object Set fso = CreateObject("Scripting.FileSystemObject") 'read the input file Set f = fso.OpenTextFile(InputRequest,1) sInFileContent =   f.ReadAll f.close 'xml object Set http = CreateObject("MSXML2.ServerXMLHTTP.3.0") 'open the connection http.open "POST", sWebserviceURL,False http.setRequestHeader "content-type","text/xml" 'Send the input file http.send sInFileContent 'read the response OutputResponse=http.ResponseText 'write into output file Set f = fso.OpenTextFile(sOutputXML , 2, True) f.Write(OutputResponse) f.close set f= nothing set fso=nothing

Create DSN using VB Script in ODBC

    'Create the Filesystem Object     Const SystemFolder= 1     Set oFso = CreateObject("Scripting.FileSystemObject")     Set SysFolder =oFso.GetSpecialFolder(SystemFolder)     SysFolderPath= SysFolder.Path     'Set the Driver details     DriverPath = SysFolderPath & "\sqora32.dll"     DriverName = "Oracle in Oraclient11g_home4"     'get the required details     DataSourceName = "Sample Source Name"     DatabaseName = "DB Name"     sDescription = "Odbc Desc " & DatabaseName        tnsNames = "Tns Names"     userId  = "User name"             'Create Shell Object     Set WshShell = CreateObject("WScript.Shell")     'Set the Key in the register of DSN ...

Working with BLOB or CLOB Objects in QTP

The below Code will Insert the CLOB or BLOB objects in  Oracle DB using QTP. Sample Code: 'CLOB or BLOB file Path strClobFileName = "C:\Jay\SampleInputs\BLOBorCLOB.txt" 'Connection String strOracleConnectionString =  "Driver= {Microsoft ODBC for Oracle}; " &_                   "ConnectString=(DESCRIPTION=" &_                   "(ADDRESS=(PROTOCOL=TCP)" &_                   "(HOST=hostName) (PORT=1234))" &_                   "(CONNECT_DATA=(SERVICE_NAME=ABCD)));uid=userName; pwd=Password;" 'Create Required Objects Set objCon = CreateObject("Adodb.Connection") Set objRs = CreateObject("Adodb.Recordset") Set objCom = CreateObj...

Getting Record Count Using ADODB Connection in QTP

When you get the Record Count as  -1 Change the CursorLocation to 3 or 2 or 1(mostly 3 ll work) Sample Code:  strConnectionString =  "Driver= {Microsoft ODBC for Oracle}; " &_                   "ConnectString=(DESCRIPTION=" &_                   "(ADDRESS=(PROTOCOL=TCP)" &_                   "(HOST=hostName) (PORT=1234))" &_                   "(CONNECT_DATA=(SERVICE_NAME=ABCD)));uid=userName; pwd=Password;" strQuery = "Select * From Table" Set objCon = CreateObject("Adodb.Connection") objCon.CursorLocation = 3 Set objRs = CreateObject("Adodb.Recordset")  objCon.Open strConnectionString Set objRs = objCon.Exe...

HP Unified Functional Testing(UFT) 11.5

HP has launched  the latest version of QuickTest Professional (QTP). This new version of QTP is called HP Unified Functional Testing (UFT) 11.5 . Below is the sneak preview of some of the important new features that will be available in UFT 11.5 1) What is UFT 11.5? The new version of HP QTP is being called HP Unified Functional Testing 11.5 (UFT 11.5). UFT 11.5 is actually a combination of HP QTP (for testing GUI) and HP Service Test (for testing API). 2) Brand New Modern IDE This point has been discussed so many times at many forums. QTP’s IDE lacked the punch when compared to many modern IDE’s like Eclipse, Microsoft Visual Studio etc. It lacked many must have features that were there in many IDEs available in the market. With UFT 11.5, HP will be introducing a brand new modern IDE, which will a) have a new IDE aligned with modern dev IDEs (like Eclipse). b) have many new features such as script editing, coding, MDI, checkpoints, auto completion etc Image...

PDF Automation in QTP

                                                                            The most challenging issue with PDFs is that it could be of any kind, not just a tabular data; it could have plain text, images or even forms to fill up. So this makes a tester’s life a bit difficult, never mind, we will definitely find an easy of do it… Although there are already some better approaches we have to deal with PDF documents but I found many of us are facing so many difficulties using this. There are lots of queries coming at QTP forums asking for an easy way of doing it with PDFs. keeping those in my mind I started c...