Multiple Modes in a Single Script

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 technology.All
BROWSERDesktop browsers like Chrome, Firefox, Internet Explorer etc. as defined in browser_types.xml. Eg. chromeSahi Pro
ANDROID_BROWSERAndroid web applicationsSahi Pro
IOS_BROWSERiOS web applicationsSahi Pro
WINDOWSNative Windows applications (WPF, WinForms, .NET, SilverLight, XBAP)Sahi Pro Desktop Add-on
JAVAJava desktop and Web Start/JNLP applicationsSahi Pro Desktop Add-on
JAVA_APPLETJava AppletsSahi Pro Desktop Add-on
ANDROIDAndroid applications (native and hybrid)Sahi Pro Mobile Add-on
IOSiOS applications (native, hybrid and web)Sahi Pro Mobile Add-on
SAPSAP GUI ApplicationSahi Pro SAP 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. If Sahi Browser capability is enabled, 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