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

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

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

 
Highlighted
Occasional Contributor

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

Get properties of a web page element

Participate!

Compare images using the Region Checkpoint

See replies!

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

Participate!

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

Participate!
Top Kudoed Authors