EnterKey Event in Sahi.

Below is the sample code snippet to work with EnterKey.

var $storedVars = new Array();
_sahi.robot = new java.awt.Robot();
Sahi.prototype._typeNativeKeyCode = function(keyCode){
this.robot.keyPress(keyCode);
this.robot.keyRelease(keyCode);
};
_navigateTo("http://sahitest.com/demo/training/login.htm");
_setValue(_textbox("user"),"test");
_setValue(_password("password"),"secret");
_sahi._typeNativeKeyCode(java.awt.event.KeyEvent.VK_ENTER);
_wait(10000);


Since Key events happens at OS level, Please make sure that your app under test is active while re-playing the test.


Last updated: March 09, 2023

If you have any feedback on this topic, please contact us at documentation@appvance.ai


Revision #2
Created 2026-07-31 15:39:54 UTC by Admin
Updated 2026-07-31 15:54:24 UTC by Admin