Sahi - Multiple modes/application types


From Sahi Pro v7.0.0, it is possible to interact with multiple applications from the same script.
With the Sahi Pro Desktop Add-on, we can interact with Window Desktop applications and Java applications

The _setMode API is used to switch modes within a script.

// by default start with browser interaction
_navigateTo("/demo/training/");
_setValue(_textbox("user"), "test");
...


// Switch to Windows automation
_setMode("WINDOWS");
_selectWindow("/Notepad/");
_mouseOver(_toolBar(""));
_click(_button("Replace..."));
_click(_tabItem("Find"));
...


// Switch back to browser
_setMode("BROWSER");
_click(_button("Logout"));

Available Modes

ModeDescriptionAvailable in
GENERICNo specific UI application.Sahi Pro
BROWSERDesktop browsers like Chrome, Firefox, Internet Explorer etc. as defined in browser_types.xml. Eg. chromeSahi Pro
WINDOWSNative Windows applications (WPF, WinForms, .NET, SilverLight, XBAP)Sahi Pro with Desktop Add-on
JAVAJava desktop and Web Start/JNLP applicationsSahi Pro with Desktop Add-on
JAVA_APPLETJava AppletsSahi Pro with Desktop Add-on

Playback Start Mode

The Playback Start Mode, specified before a script or suite is executed, is the mode with which scripts will start playing.
The mode can be later changed using _setMode.
Sahi Pro by default starts all scripts in BROWSER mode and automatically launches a browser at the start.
If a script needs to start by interacting with JAVA applications, the start mode can be set as JAVA. In this case no browser is opened at start.

Notes on Default and Start With options