I have written following code to find and get the div element with id vcr_data from html string. When I try to append that div to html tag, it's getting printed as follows instead of the stringified div:
... <body>[object HTMLDivElement]</body></html>
code snippet:
let doc = new DOMParser().parseFromString(html, 'text/html');
console.log('div element ', doc.getElementById('vcr_data'));
const response = `<!DOCTYPE html>
<html>
<head>
<style id="jss-server-side"></style>
</head>
<body>${doc.getElementById('vcr_data')}</body>
</html>`;
console.log('html: ', response);