Is there a specific method to obtain the xPath of an angleSharp IElement
In order to pass an IElement to a JavaScript function, I require a way to convert the angleSharp element into a JavaScript DOM element.
function selectLevels(element, name, level){
document.querySelectorAll("*").forEach(e => {
if(e.isEqualNode(element)){
e.setAttribute('level', level);
e.setAttribute('title', name);
}
})
}
My goal is to invoke this JavaScript function on the page by transferring an element from the C# code below. However, I encounter an error stating that angleSharp could not be found on the page.
IElement element = mainDoc.QuerySelector("strong");
Page.ClientScript.RegisterStartupScript(this.GetType(), "SelectLevel", "selectLevels('" + element + "', '" + name + "', '" + level + "')", true);