ithken
ithken

Reputation: 11

sahi onScriptFailure doesn't seem to work

I am new to Sahi and I am just trying to take a screenshot on script errors. I have tried to used their demo and the script the website provides for the task, but the onScriptFailure doesn't seem to trigger. I added the alert box and changed the log in name to trigger a failure. Sorry if i'm missing something obvious.

  function onScriptError($e){
  _focusWindow();
  _takeScreenShot();
  _alert("test me");
}
onScriptFailure = onScriptError;
_navigateTo("http://sahi.co.in/demo/training/");
_setValue(_textbox("user"), "test");
_setValue(_password("password"), "secret");
_click(_submit("TriggerError"));

Upvotes: 0

Views: 170

Answers (2)

Mrinal kumar
Mrinal kumar

Reputation: 67

HI You can use the GlobalInclude.sah file which has the code for the error handling. you can edit this file to make the script behave according to your needs

Upvotes: 0

ithken
ithken

Reputation: 11

I was using Sahi Pro. I actually got the answer from their support department. This is what he had me do:

var onScriptError = function ($e) {
  _focusWindow();
  _takeScreenShot();
  _alert("test me");
}
onScriptFailure = onScriptError;
_navigateTo("http://sahi.co.in/demo/training/");
_setValue(_textbox("user"), "test");
_setValue(_password("password"), "secret");
_click(_submit("TriggerError"));

Upvotes: 1

Related Questions