Forum Discussion

ory_z's avatar
ory_z
Contributor
13 years ago

Cannot post HTML to the Additional Text

Hi,



I've tried both in a KDT as well as a script and a simple bit of HTML does not get posted properly to the Additional Text field (gets posted as plain text - see attched image).

To make sure that it is not my error, I copied the code from the following TC blog:

http://blog.smartbear.com/post/10-03-22/TestComplete-8-Sneak-Peek-Posting-HTML-Messages-to-the-Log/



Example code (JScript):

  Log.Message ("Log  Message ", "<html><body><p>This is my <b style=\"color : green\">HTML</b> message. </p> </body> </html>");



I have even tried adding the following code prior to the above line to make sure the ExtendedMessageAsPlainText attribute is equal to false:

  var Attrs = Log.CreateNewAttributes(); 

  Attrs.ExtendedMessageAsPlainText = false;



TestComplete ver 8.70.



Thanks!

1 Reply

  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)
    Hi Ory,



    You're actually pretty close. You just need to pass the created attributes object as a parameter to the Log.Message call:

    var Attrs = Log.CreateNewAttributes();  

    Attrs.ExtendedMessageAsPlainText = false;



    Log.Message ("Log Message ", "<html><body><p>This is my <b style=\"color : green\">HTML</b> message. </p> </body> </html>", pmNormal, Attrs);


    That blog post was written based on a pre-release beta build of TestComplete 8, and the test log behavior appears to have been changed since then.