In the standard methods I did not find it, only display the HTML document. But maybe there is an opportunity to somehow open the "Developer Tools", which in IE are called by F12?
- Is there an Inspect Element in the context menu? - Qwertiy ♦
- No, this is not. There are only standard - "View HTML", "Copy", "Paste", etc. - Andrei Tsapenko
|
1 answer
No, there is no such possibility. Yet WebBrowser is not Internet Explorer.
If you need to track errors, you can do this:
webBrowser.DocumentCompleted += (o, e) => { webBrowser.Document.Window.Error += (w, we) => { we.Handled = true; // реагируем на ошибку Debug.WriteLine( string.Format( "Error: {1}\nline: {0}\nURL: {2}", we.LineNumber, we.Description, we.Url)); }; }; If you need to get a tag by clicking, then this can be done by subscribing to mouse-click events. Then call the following code, passing it the coordinates.
private static String GetTagNameByClick(WebBrowser webBrowser, Int32 x, Int32 y) { Point point = webBrowser.PointToClient(new Point(x, y)); HtmlElement element = webBrowser.Document.GetElementFromPoint(point); return element.TagName; } - Yes, I do not need errors, but a convenient study of the dom-tree. Well, if not, then it is impossible. :) - Andrei Tsapenko
- @Andrey Tsapenko then only take
DocumentTextand turn it into a tree. Parsing write yourself or see the library. - andreycha
|