To wait for the execution until the specified DOM appears.
npm install lazy-exec
var lazyExec = require("lazy-exec");
download hrere.
<script src="path/to/lazyexec.standalone.js"></script>
lazyExec("script[src^='https://code.jquery.com/']", function(error, element) {
// element is HTMLScriptElement
assert.strictEqual(element.src, "https://code.jquery.com/jquery.js");
});
var jquery = document.createElement("script");
jquery.src = "https://code.jquery.com/jquery.js";
document.head.appendChild(jquery);