There is a variable in which the DOM page. How to get all the links that are visible on the page using HtmlAgilityPack?
- And what are these "prominent links"? HTML can be seen? - EvgeniyZ
- For example, "spoller", is found on the forums very often. Link as it is, but under the spoller it is not visible. - Dr.
- It gives me nothing. Spoilers are completely different, some hide the content completely (by outputting something like "type N reputation") - such is not like you can not get. Others are simply collapsed in style — usually a div block with a certain style, everything is simple — take the div itself and then all its internal links. Find an example of such HTML and then you will most likely be helped! - EvgeniyZ pm
|
2 answers
Visible - no way. Visibility can be styled using CSS tables.
|
The answer is sought in Google :) https://stackoverflow.com/questions/2248411/get-all-links-on-html-page
HtmlWeb hw = new HtmlWeb(); HtmlDocument doc = hw.Load(/* url */); foreach(HtmlNode link in doc.DocumentNode.SelectNodes("//a[@href]")) { } - As far as I understand, this option will find all the links, and only those that are displayed are needed. Now I can not check. - Dr.
- The link can be hidden and it is necessary to check the attributes of the width! = 0 type - Dr.
- @Dr. link is an object of class HtmlAgilityPack.HtmlNode, in which there is a string field OuterHtml. So there are all the attributes - vasenev.ea
|