Top Rounds
| We are Hiring! |

Scripting Changes in Sahi V2 ·

The V2 release of Sahi has a lot of changes which makes Sahi even more powerful. Scripting has partly moved to the proxy using the rhino js engine and this should help in significant simplification of Sahi scripts. There has been one major change which may break older scripts:

Using custom functions that access the DOM.

Custom functions which access the browser’s DOM to say, identify a particular element, need to now be wrapped in a <browser></browser> tag.

Eg.


<browser>
function getEmailField(){
   return _textbox("email");
}
</browser>

_assertEqual("a@sahi.example.com",  getEmailField());

A general tip is to always call a browser based function from inside a Browser Action API. Otherwise they will be executed on the proxy and will fail because they do not have access to the browser’s DOM.

The other rules remain the same.


Related topics

Sahi Scripting Basics - Part 1
Sahi Scripting Basics - Part 2
Sahi Scripting - Calling Java
Scripting Changes in Sahi V2
For loops
While loops
If condition
Functions
Exception handling using try-catch
Recovering without try-catch using _setRecovery




---


Top Rounds