htmlDocument.GetElementById returns element with same name, not id

c# getelementbyid html-agility-pack

Question

First time using HtmlAgilityPack, i'm retrieving nodes inside an html that has 2 different elements, sharing a value as id for one and as name for the other:

    <span name="abc"></span>
     . . .
    <div id="abc"></div>

When i use GetElementById("abc") i end up getting the element whose name, and not the id, is the one specified. Hows so?

Thanks in advance

Popular Answer

It seems like I can't reproduce your issue in VB.NET (see above screenshot).

It's only targetting the element whith id "abc" and not the one with same name.

Maybe you could send us a piece of code with wrong behaviour ?

Working piece of code



Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why