cancel
Showing results for 
Search instead for 
Did you mean: 

getting XML DOM tagName fails

SOLVED
Highlighted
Occasional Contributor

getting XML DOM tagName fails

Microsoft XML DOM Properties page shows "tagName" as a property. But when I try to use it with

# Python
Log.Message("Node tag: " + mynode.tagName)

I get "AttributeError: The object does not support this property or method"

I can use "nodeName", "nodeValue", "xml", "text", or various other properties with no problem.

Indeed, the "xml" property shows the tag name and the value.

But how do I get just the tagName? Why doesn't it work, or why is it not supported?

Tags (3)
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Leader

Re: getting XML DOM tagName fails

Tried this:

function testTagName() {
  let a = Sys.Browser('*').Page("https://community.smartbear.com/t5/TestComplete-General-Discussions/getting-XML-DOM-tagName-fails/m-p/199506").Panel(1).Panel(0).Panel(0).Panel(0).Panel(0).Panel(0);
  Log.Message("TagName = ", a.tagName);
}

And it worked, give me DIV

 

So by TC it's ok.

Do you load an external XML ? with which method and which driver ?

 

Un sourire et ça repart

View solution in original post

3 REPLIES 3
Highlighted
Community Leader

Re: getting XML DOM tagName fails

Tried this:

function testTagName() {
  let a = Sys.Browser('*').Page("https://community.smartbear.com/t5/TestComplete-General-Discussions/getting-XML-DOM-tagName-fails/m-p/199506").Panel(1).Panel(0).Panel(0).Panel(0).Panel(0).Panel(0);
  Log.Message("TagName = ", a.tagName);
}

And it worked, give me DIV

 

So by TC it's ok.

Do you load an external XML ? with which method and which driver ?

 

Un sourire et ça repart

View solution in original post

Highlighted
Occasional Contributor

Re: getting XML DOM tagName fails

 
Highlighted
Occasional Contributor

Re: getting XML DOM tagName fails

This finally worked for me:

# this "mynode" is the parent of the node with the text value
# 0 indicates an Element
# This may need refining if the Element node has qualifiers within it
if aqObject.GetVarType(myNode.nodeValue) == 0:
  tagName = aqConvert.VarToStr(myNode.nodeName)
  subNode = myNode.childNodes[0]
  myvalue = aqConvert.VarToStr(subMode.nodeValue)
  Log.Message("tagName " + tagName + " has value " + myvalue)
New Here?
Join us and watch the welcome video:
Announcements
Join TechCorner Challenge!
Want a fun and easy way to learn TestComplete? Try solving weekly TechCorner challenges and get into the Leaderboard!

Challenge Status

How to execute remote test and obtain results via Test Runner REST API

Participate!

Comparing content of HTML table with Excel file data

Participate!

Compare HTML table with Excel file and correct data in the file

Participate!

Retrieve Data from a Web Page

Participate!
Top Kudoed Authors