18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
Simulate keyDown Function
Hi,
I try to simulate a press on a F4 in a specific element.
I have a basic javascript on my web page that capture the key press.
I try to use :
_keyPress(_textbox("MY_ELEMENT"), [115, 0]);
_keyDown(_textbox("MY_ELEMENT"), [115, 0]);
_keyUp(_textbox("MY_ELEMENT"), [115, 0]);
_keyPressEvent(_textbox("MY_ELEMENT"), [115, 0]);
but without any success for the moment.
Thanks in advance for your help,
Regards,
HadanMarv
I try to simulate a press on a F4 in a specific element.
I have a basic javascript on my web page that capture the key press.
I try to use :
_keyPress(_textbox("MY_ELEMENT"), [115, 0]);
_keyDown(_textbox("MY_ELEMENT"), [115, 0]);
_keyUp(_textbox("MY_ELEMENT"), [115, 0]);
_keyPressEvent(_textbox("MY_ELEMENT"), [115, 0]);
but without any success for the moment.
Thanks in advance for your help,
Regards,
HadanMarv
Comments
_keyUp(_textbox("MY_ELEMENT"), [115, 0]);
Would be the right thing to do.
Also try
_focus(_textbox("MY_ELEMENT"));
_keyDown(_textbox("MY_ELEMENT"), [115, 0]);
_keyUp(_textbox("MY_ELEMENT"), [115, 0]);
i check my capture event trigger and it's like this onKeyPress="try{capture_keys(event)}catch(err){};"
When i use _keyPress(_textbox("MY_ELEMENT"), [115, 0]); it's insert data into my field.
Have you any other ideas ?
Regards,
HadanMarv
_keyDown(_textbox(1,_under(_div('Customer Item Number'))),[13,0]);
but it doesnot work for me
Thanks in advance for you r help
Please have a look at the following link:
It shows how files can be uploaded using native events(that includes simulating enter key press).
You need to add 2 functions in you script (_typeNative and _typeNativeKeyCode) for this purpose and use them.
If its unclear in some way, please do let me know.
Regards.