Forum Discussion
I am sorry but I do not think I am being clear on my question.
What I really need to do is get the text from the Additional Info tab in the ERROR results set.
A previous answer stated I could create an EVENT, which I have, and it is listed below but the problem is that the EVENT triggers EVERY time "any" ERROR is raised and I do not want that to happen. So what I would like to get is the Additional Info either through an event that is only called when I state it to be called or a different way to get the Additional Info.
I hope this is more clear.
Unless your post stated to allow the EVENT to trigger and wrap it with an "If" statement for WebAccessibility. I could easily do this but it seems odd that there is not better control of the EVENTs
Suggestions or Comments?
Thank you
Andrew
function EventControl1_OnLogError(Sender, LogParams)
{
var sFolder = "M:\\MyFiles\\";
var aString = LogParams.MessageText;
var aSubString = "\"";
var ResFirst = aqString.Find(aString, aSubString);
var ResLast = aqString.FindLast(aString, aSubString);
if ( ResFirst != -1 ) {
str = aqString.SubString(aString, ResLast, aqString.GetLength(aString) );
aString = aqString.Replace(aString, str, "");
str = aqString.SubString(aString, 0, ResFirst+1);
aString = aqString.Replace(aString, str, "");
}
var sFile = sFolder + aString + aqConvert.DateTimeToFormatStr(aqDateTime.Today(), "_%Y-%m-%d") + ".txt";
if (!aqFileSystem.Exists(sFolder)){
aqFileSystem.CreateFolder(sFolder);
}
if (aqFile.Exists(sFile))
{
aqFileSystem.DeleteFile(sFile);
Log.Message("The file was created and the specified text is written to it successfully.");
}
aqFile.Create(sFile);
aqFile.WriteToTextFile(sFile, LogParams.AdditionalText, aqFile.ctUTF8);
}
Unless your post stated to allow the EVENT to trigger and wrap it with an "If" statement for WebAccessibility.
This was exactly my point: to verify whether error message is posted by WebAccessibility Checkpoint and send additional text of the error to the text file in this case.
I have never used WebAccessibility checkpoint, but when I decided to answer your question I made a simple investigation and found out that this looks like the simplest solution, since there is no specific event handler for WebAccessibility Checkpoint. During this investigation I have also found that for some reason if checkpoint fails, than even OnLogCheckpoint doesn't trigger, that's why I suggested using OnLogError.
BTW, you can ask Smartbear to add your suggestion to their database and after a while it will be implemented (though nobody can predict when exactly). Just note, that there are many customers and a lot of them have their vision of how the product should work, however it is not always reachable. That's what we are doing here on the forum: helping others finding solutions for their problems. Sometimes they are easy and obvious, sometimes they are workarounds :)
- cst990037 years agoContributor
Thank you.
I will use the technique (EventControl1_OnLogError) that was suggested and wrap an "if" around it so to only use the code when the Additional Text is needed.
Again Thank you
Andrew
- karkadil7 years agoValued Contributor
If you find a better solution - please let us know here :)