var elems = document.evaluate("//input[@id='input']", document, null, XPathResult.ANY_TYPE, null); var elem2 = elems.iterateNext(); elem2.dispatchEvent(new Event('paste'));