I got the answer fot this using library which generates CSS selectors from DOM nodes jhartikainen/dompath and it easy to implement.
Just add dompath.js script into your file.
USAGE :
e.target.contentDocument.body.addEventListener('click', e => {
targetSelector= '';
//call function, pass any element:
var csspath = dompath(e.target);
//get CSS selector:
targetSelector = csspath.toCSS();
console.log(targetSelector);
//#about > div:nth-child(1) > div:nth-child(1) > div:nth-child(2) > ul:nth-child(2) > li:nth-child(1)
});