Quantcast
Channel: LoadRunner Practitioners Forum topics
Viewing all articles
Browse latest Browse all 3978

Need JS code to press F2 button in Ajax Tru client

$
0
0

Hi ,

I need to press F2 button in the application to get into Edit mode , found no option to press keys from F1-F12.

Executed  below code using Evaluate JS and no action was taken place.

Suggest any option where i can press F2 by executing JS.

 var keyboardEvent = document.createEvent("KeyboardEvent");

var initMethod = typeof keyboardEvent.initKeyboardEvent !== 'undefined' ? "initKeyboardEvent" : "initKeyEvent";

 

 

keyboardEvent[initMethod](

                   "keydown", // event type : keydown, keyup, keypress

                    true, // bubbles

                    true, // cancelable

                    window, // viewArg: should be window

                    false, // ctrlKeyArg

                    false, // altKeyArg

                    false, // shiftKeyArg

                    false, // metaKeyArg

                    113, // keyCodeArg : unsigned long the virtual key code, else 0

                    0 // charCodeArgs : unsigned long the Unicode character associated with the depressed key, else 0

);

document.dispatchEvent(keyboardEvent);

 

Thanks in advance

 


Viewing all articles
Browse latest Browse all 3978

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>