Ask a Question

Internet Explorer outerHTML and innerHTML missing closing tags on table objects <th> and <td>

Occasional Contributor

Internet Explorer outerHTML and innerHTML missing closing tags on table objects <th> and <td>

I am trying to convert HTML tables to XML, but when performing the conversion on a Table object in IE, I get an error about tags not matching. The function I'm running is:

    while True:
      if (ReportObj.VisibleOnScreen == True):
        XMLdoc = Sys.OleObject["Msxml2.DOMDocument.6.0"]
        xmlstring = ReportObj.outerHTML
        XMLdoc.loadXML(xmlstring) # This is the part of the function throwing the error below
        return XMLdoc


The exact error in TestComplete is: End tag 'tr' does not match the start tag 'th'


In Chrome, FF, and Edge this function works fine, only IE gives me the problem. After some digging, I've tracked it down to the outerHTML and innerHTML properties not returning the closing </th> or </td> on the table in TestComplete, which is what is breaking the XML conversion.


After the </button> tag it should have a </th> tag. I've inspected the element in IE and verified that it includes the </th> tag.

            <th style="width: 7.69%;">Plan Name
                <button uib-tooltip-html="tipPlanName" tooltip-trigger="mouseenter click" tooltip-class="help-swui">?</button>


When I run the same thing in Chrome, it returns correctly:

            <th style="width: 7.69231%;">Plan Name
                <button uib-tooltip-html="tipPlanName" tooltip-class="help-swui" tooltip-trigger="mouseenter click">?</button></th>

Does anyone know why I can't get the closing tags to show properly in TestComplete?

Champion Level 3

I suggest that you contact Support directly.  You can use this link:

Occasional Contributor

We managed to find a solution. 

The tags that IE wasn't returning (</td> and </th>) are considered optional tags in HTML5. The utility we used for building our web application was configured to automatically strip optional HTML tags to "minify" the code for performance reasons. So while our source code included those tags, it was being stripped during our build process. We changed our build process to not strip the tags anymore and it's been working since.
Thank you for the help, it's greatly appreciated.
Esteemed Contributor

THAT's an interesting piece to know... Thanks for sharing.  We're currently not coding HTML5 applications but, when and if we do, I'll store this bit for later.

Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
Showing results for 
Search instead for 
Did you mean: