It's convenient to use RaiseError() function to terminate a transaction. But SilkPerformer does not capture the browser screen when RaiseError() is used even when TrueLog is set to true on error. To overcome this problem, you have to insert a fake click just before calling RaiseError to force SilkPerformer to capture the screen into TrueLog. For example, you can insert BrowserClick() for an DOM object does not exist. Such a click will fail and SilkPerformer will take a screen shot for TrueLog such that you can see what happened.
function MyBrowserFind(
isXPath : string;
inTimeout : number optional
) : number
var
nRetval : number;
nTimeout : number;
begin
if inTimeout = 0 then
nTimeout := 10000
else
nTimeout := inTimeout
end;
nRetval := BrowserFind(HANDLE_DESKTOP, isXPath, false, nTimeout, true);
if (nRetval = HANDLE_INVALID) then
// this fake click is here to cause TrueLog
BrowserClick("//IMG[@id='ZZraiseErrorClickZZ']", BUTTON_Left);
RaiseError(CUSTOM_ERROR,
GetTransactionName() + ": Failed to find {" + isXPath + '}',
SEVERITY_TRANS_EXIT)
end;
MyBrowserFind := nRetval;
end MyBrowserFind;
No comments:
Post a Comment