# EnterKey Event in Sahi.

Below is the sample code snippet to work with EnterKey.

<div id="bkmrk-var-%24storedvars-%3D-ne" style="border-width: 1px;"><div>```
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);
```

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

<div id="bkmrk-last-updated%3A-march-">---

Last updated: <span class="mc-variable General.NewDateTimeVariable variable">March 09, 2023</span>

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

</div>