GetChildElementByAttr (QTP, TestComplete, VBScript)
Parent page: Service Functions – MSXMLDOM (QTP, TestComplete, VBScript)
Description
Returns child XML node via XPath query.
Implementation
Public Function GetChildElementByAttr(ByRef objXMLParent, ByVal sTagName, ByVal sAttrName) Dim objNode sTagName = Trim(sTagName) sAttrName = Trim(sAttrName) If objXMLParent is Nothing Then Set GetChildElementByAttr = Nothing Exit Function End If Set objNode = objXMLParent.SelectSingleNode("./"&sTagName&"[@name='" & sAttrName &"']") If isNull(objNode) or (objNode is Nothing) Then Set GetChildElementByAttr = Nothing Else Set GetChildElementByAttr = objNode End If End Function