Question

Were running SAHI automated testing on our web site. Were looking into upgrading to SAHI pro so we can use the _takeSnapShot method.

We have thousands of asserts scattered all over our scripts. What we want is some kind of global way so that if an assert fails the system will fire _takeSnapShot and then continue.

We've tried a JavaScript try{} catch{} but SAHI doesn't actually throw an exception, it just logs the failure and continues.

We've also tried attaching an _setRecovery function as documented here http://sahi.co.in/w/_setrecovery-recovering-from-a-scenario-without-try-catch. But this doesn't fire!

Anyone know of a good way to do this?

Was it helpful?

Solution

Got a solution from http://sahi.co.in/w/sahi-call-back-functions

function onScriptError($e){
    _focusWindow();
    _takeScreenShot();  
} 
onScriptFailure = onScriptError;
_navigateTo("http://sahi.co.in/demo/training/"); 
_setValue(_textbox("user"), "test"); 
_setValue(_password("password"), "secret"); 
_click(_submit("Login"));
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top