20 Feb 2024 08:40 AM - edited 08 Oct 2025 05:13 PM
Some applications require keyboard actions, such as arrow up, arrow down, arrow left, arrow right, enter, escape, etc. The Dynatrace Synthetic Recorder does not record these, and they need to be manually added using a JavaScript event.
var input = document.querySelector("body");
Go to the relevant page on a Chrome browser.
Right-click on the element you want to interact with on the page and select Inspect. Developer tools will then open with the relevant element selected.
Update the input variable with the selector you have just copied
var input = document.querySelector("#yourSelector");
var parameters1 = {isTrusted: true, altKey: false, bubbles: true, cancelBubble: false, cancelable: true, charCode: 0, code: "F7", composed: true, ctrlKey: false, defaultPrevented: true, detail: 0, eventPhase: 0, isComposing: false, key: "F7", keyCode: 118, location: 0, metaKey: false, repeat: false, returnValue: false, shiftKey: false, which: 118};
var parameters2 = { isTrusted: true, altKey: false, bubbles: true, cancelBubble: false, cancelable: true, charCode: 0, code: "F7", composed: true, ctrlKey: false, defaultPrevented: false, detail: 0, eventPhase: 0, isComposing: false, key: "F7", keyCode: 118, location: 0, metaKey: false, repeat: false, returnValue: true, shiftKey: false, which: 118};
var input = document.querySelector("#yourSelector");
input.dispatchEvent(new KeyboardEvent("keydown", parameters1));
input.dispatchEvent(new KeyboardEvent("keyup", parameters2));
If none of the previous steps resolved the issue, open a chat and provide a link to the monitor you're updating and the configuration steps you have already completed.
You can find further troubleshooting tips for Synthetic in the Synthetic Troubleshooting Map