This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

JS code to press Ctrl - (zoom out) in IE - Ajax TruClient

Greetings Experts,

I do hope someone will be able to assist me on this issue.

I found an article which describes how to press F2 Key on the keybaod in Ajax Truclient:

/adtd/sws-loadrunner/loadrunner/f/sws-loadrunner_sf/97696/need-js-code-to-press-f2-button-in-ajax-tru-client

also used the website they offered:

http://unixpapa.com/js/testkey.html

 

I have recorded a website and it's not fully loaded (sizing issue) however i noticed when I zoom out once (Ctrl & - keys) i can see the tool bar.

this is what i came out with:

var keyboardEvent = document.createEvent("KeyboardEvent");
var initMethod = typeof keyboardEvent.initKeyboardEvent !== 'undefined' ? "initKeyboardEvent" : "initKeyEvent";

// ###### Ctrl key Section ######
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
17, // keyCodeArg : unsigned long the virtual key code, else 0
0 // charCodeArgs : unsigned long the Unicode character associated with the depressed key, else 0
);
document.activeElement.dispatchEvent(keyboardEvent);

keyboardEvent[initMethod](
"keyup", // event type : keydown, keyup, keypress
true, // bubbles
true, // cancelable
window, // viewArg: should be window
false, // ctrlKeyArg
false, // altKeyArg
false, // shiftKeyArg
false, // metaKeyArg
17, // keyCodeArg : unsigned long the virtual key code, else 0
0 // charCodeArgs : unsigned long the Unicode character associated with the depressed key, else 0
);
document.activeElement.dispatchEvent(keyboardEvent);
// ###### Ctrl key Section ######

// ########################################################

// ###### - (Minus) key Section ######
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
189, // keyCodeArg : unsigned long the virtual key code, else 0
0 // charCodeArgs : unsigned long the Unicode character associated with the depressed key, else 0
);
document.activeElement.dispatchEvent(keyboardEvent);

keyboardEvent[initMethod](
"keypress", // event type : keydown, keyup, keypress
true, // bubbles
true, // cancelable
window, // viewArg: should be window
false, // ctrlKeyArg
false, // altKeyArg
false, // shiftKeyArg
false, // metaKeyArg
45, // keyCodeArg : unsigned long the virtual key code, else 0
0 // charCodeArgs : unsigned long the Unicode character associated with the depressed key, else 0
);
document.activeElement.dispatchEvent(keyboardEvent);

keyboardEvent[initMethod](
"keyup", // event type : keydown, keyup, keypress
true, // bubbles
true, // cancelable
window, // viewArg: should be window
false, // ctrlKeyArg
false, // altKeyArg
false, // shiftKeyArg
false, // metaKeyArg
189, // keyCodeArg : unsigned long the virtual key code, else 0
0 // charCodeArgs : unsigned long the Unicode character associated with the depressed key, else 0
);
document.activeElement.dispatchEvent(keyboardEvent);

// ###### - (Minus) key Section ######

 

Anyone can help me with that?

 

Best Regards,

Tal.