Hi Chimona,
I can think of 2 ways to solve this issue.
The first and easiest is to do the following:
- On the page you want to "Press enter" on, Insert a "Generic Object Action" into your script
- Click the element on which you wish to preform the key press on
- In the "Step" section set the "Action" property to "Press Key"
- In the "Arguments" section the the "Key Name" property to "Enter"
The 2nd way will let you preform any keystroke on the page in general.
Step 1: Insert an "Evaluate JS Function" block into your TruClient script
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
118, // 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);
Step 3: Find out what the keyCodeArg or charCodeArg is for the key you wish to press, (118 is F7).
Hope this helps,
James