I think your question is answered here .
The original html source is what the server sends. I think this is html compilation time or the initial state of the DOM.
The Inspect Element HTML file could be updated using ajax or javascript answers, so it wonβt necessarily be the same. I think of it as html runtime or the current state of the DOM.
The GetAttribute () method queries the current state of the DOM element. You can directly return a specific html attribute value
webElement.GetAttribute("class")
or get the whole html line.
webElement.GetAttribute("innerHTML")
source share