I am trying to click on copy button on an editor using Javascript for automation purposes but the text not stored in the clipboard
tried the below codes
const button = document.getElementById("copy-1");
button.click();
and
const button = document.getElementById("copy-1");
const event = new Event("click");
button.dispatchEvent(event);
the HTML code
<button id="copy-1" type="button" tabindex="-1" role="button" class="fr-command fr-btn" data-cmd="copy" data-title="Copy" style="outline: 1px solid blue;">
<froalacopy_button class="hoverable"><i class="fas fa-copy"></i></froalacopy_button><span class="fr-sr-only">Copy</span>
</button>
also, I tried to copy it directly but the copied text was not formatted