Sunday, January 23, 2011

XML Paresr using MSXML2.DOMDocument

Parsing XML file using QTP Example:

Public Function getXmlValueByTag(ByVal TagName, ByVal Attribs)
Dim xmlDoc, objNodeList, Attrib
Dim i, rndNum

Set xmlDoc =CreateObject("MSXML2.DOMDocument")
xmlDoc.load("D:\xmlfile.xml")

For h = 0 To UBound(Split(TagName, "\"))
Set objNodeList = xmlDoc.getElementsByTagName(Split(TagName, "\")(h))
If objNodeList.length > 0 Then
If ISEmpty(rndNum) And Split(TagName, "\")(h) <> "ASR" Then
rndNum = RandomNumber(1, objNodeList.length -1)
End If
Set Attrib = objNodeList.item(rndNum).attributes
If Attrib.length > 0 Then
For j = 0 To Attrib.length -1
For i = 0 To UBound(Split(Attribs, ","))
If Split(Attribs, ",")(i) = Attrib.item(j).name Then
print Attrib.item(j).name & "---" & Attrib.item(j).value
End If
Next
Next
End If
End If
Next
End Function

Print getXmlValueByTag ("COM", "P35C56")

>>>First parameter contain the tag name
>>> 2nd parameter contain the attribute name

Example:

Sunday, March 22, 2009

Addicted to Travian Browser based game

Well, I am putting this line of blog after a long time, although this is not useful for any learning purpose. Why I am writing this blog, there are many reason, I was one of those guys who usually spend lot’s of time at home developing small utility which help automation people to help them. But now a days I have started playing Travian game which is not at all help me in future to my career. Why I am playing dun know yet, but I am sure I will be back to my normal track.
This game was introduce by of my friend called Rahul Paul, after that I was sleep les forget everything about personal life just game and game.

Bounty highest collected on 22/03/09 09:41:42 pm:
3113 3647 2793 2242
http://s1.travian.in/berichte.php?id=3285658

Thursday, November 20, 2008

Microsoft Excel Connectivity using ODBC connection

How to connect Microsoft Excel connection using ODBC?
[Example below using VB Code:]
Dim XlFile: XlFile="C:\MyExcel.xls"
Dim AdodbCn
Set AdodbCn = CreateObject("ADODB.Connection")
AdodbCn.ConnectionString = "Driver={Microsoft Excel Driver (*.xls)}; DBQ=" & XlFile &"; HDR=Yes; IMEX=1;"
'HDR=Yes;" indicates that the first row contains columnnames, not data
'IMEX=1;" tells the driver to always read "intermixed" data columns as text
AdodbCn.Open

Thursday, October 30, 2008

Trim: Can't Find Project Or Library

This error occur when you do not have (Office XP Tool: Web Components).
Locate the installer from Microsoft site and installed the same will resolve the issue.
-Restart the application and try, I am sure the issue will go

Thursday, September 4, 2008

Why PDM is essential for QTP Automation Engineer?

What is PDM?
PDM stands for Microsoft Process Debug Manager, which allow you to debug QTP on runtime.
Where to get the PDM?
http://www.processlibrary.com/directory/files/pdm/21442

Monday, August 25, 2008

How to get the data from selected row QTP?

Dim webElement, childAttrib, tableRow
Set webElement= Browser(<"Browser">).Page(<"Page">).WebTable(<"WebTable">).Object.getElementsByTagName("TR")
tableRow= Browser(<"Browser">).Page(<"Page">).WebTable(<"WebTable">).RowCount
For i=1 to tableRow-1
Set childAttrib= webElement(i).attributes
Print childAttrib("class").value
Next

More Info:
http://developer.mozilla.org/En/DOM:document.getElementsByTagName