问题
I have a WebBrowser in a .net Form, and I am looking for a way to get all the HTMLElements that match a given XPath expression.
回答1:
I suggest that instead of WebBrowser, use the HTML Agility Pack.
It lets you download documents from the web and supports XPath natively. I also deals well with badly formed HTML and HTML fragments.
来源:https://stackoverflow.com/questions/6431090/get-all-elements-matching-an-xpath-expression-in-a-webbrowser-document