Description
When posting messages to the test log, you may need to post a string of HTML code along with the log message. To specify whether this extended text will be displayed in the Details pane of the test log in HTML format or as plain text, use the ExtendedMessageAsPlainText
property.
Declaration
LogAttributesObj.ExtendedMessageAsPlainText
Read-Write Property | Boolean |
LogAttributesObj | An expression, variable or parameter that specifies a reference to a LogAttributes object |
Applies To
The property is applied to the following object:
Property Value
True if the extended text of a message to be posted to the test log will be displayed as plain text, and False if it will be displayed in the HTML format. The default value is True.
Example
The code below specifies new attributes for test log messages and then posts the contents of the specified text file as an HTML page to the Details panel.
JavaScript, JScript
function LogAttrExample()
{
// Specifies new log attributes
var attr = Log.CreateNewAttributes();
attr.ExtendedMessageAsPlainText = false;
// Opens a text file holding HTML code
var MyFile = aqFile.OpenTextFile("C:\\Work\\HTML_Code.txt", aqFile.faRead, aqFile.ctANSI);
// Reads the HTML code from the file to a single string
var str = MyFile.ReadAll();
// Posts a log message with the HTML page as extended information
Log.Message("Message Text", str, 300, attr);
}
Python
def LogAttrExample():
# Specifies new log attributes
attr = Log.CreateNewAttributes()
attr.ExtendedMessageAsPlainText = False
# Opens a text file holding HTML code
MyFile = aqFile.OpenTextFile("C:\\Work\\HTML_Code.txt", aqFile.faRead, aqFile.ctANSI)
# Reads the HTML code from the file to a single string
str = MyFile.ReadAll()
# Posts a log message with the HTML page as extended information
Log.Message("Message Text", str, 300, attr)
VBScript
Sub LogAttrExample()
' Specifies new log attributes
Set attr = Log.CreateNewAttributes
attr.ExtendedMessageAsPlainText = False
' Opens a text file holding HTML code
Set MyFile = aqFile.OpenTextFile("C:\Work\HTML_Code.txt", aqFile.faRead, aqFile.ctANSI)
' Reads the HTML code from the file to a single string
str = MyFile.ReadAll()
' Posts a log message with the HTML page as extended information
Call Log.Message("Message Text", str, 300, attr)
End Sub
DelphiScript
function LogAttrExample;
var attr, MyFile, str;
begin
// Specifies new log attributes
attr := Log.CreateNewAttributes;
attr.ExtendedMessageAsPlainText := false;
// Opens a text file holding HTML code
MyFile := aqFile.OpenTextFile('C:\Work\HTML_Code.txt', aqFile.faRead, aqFile.ctANSI);
// Reads the HTML code from the file to a single string
str := MyFile.ReadAll;
// Posts a log message with the HTML page as extended information
Log.Message('Message Text', str, 300, attr);
end;
C++Script, C#Script
function LogAttrExample()
{
// Specifies new log attributes
var attr = Log["CreateNewAttributes"]();
attr["ExtendedMessageAsPlainText"] = false;
// Opens a text file holding HTML code
var MyFile = aqFile["OpenTextFile"]( "C:\\Work\\HTML_Code.txt", aqFile["faRead"], aqFile["ctANSI"] );
// Reads the HTML code from the file to a single string
var str = MyFile["ReadAll"]();
// Posts a log message with the HTML page as extended information
Log["Message"]("Message Text", str, 300, attr);
}