Click here to Skip to main content
15,891,513 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hello everyone,

I have encountered the following problem:

==> I have a WebBrowser control I would like to know how could I get only the visible html elements (links, textboxes, and so on ) at a given moment on the WebBrowser control.

If someone has an idea, please help me out here!

Thanks in advance,
Tamash

UPDATE:
Solved by OP himself. Answer added as comment.
Posted
Updated 13-Feb-11 17:55pm
v2
Comments
Manfred Rudolf Bihy 13-Feb-11 16:55pm    
Get the document root and iterate through all children recursivly to find the ones that are visible. Where exactly are your issues and what have you tried so far?
tamash_ionut 13-Feb-11 18:18pm    
Well I mean visible not as not-hidden, but as those elements that the user can see at a specific state of the WebBrowser control. For example, now I can't see the whole page but only a part of the page (the "Submit Comment","Cancel" button and so on) and I only want those elements. (I want especially the buttons, link and other forms of input that are visible for the user and not paragraphs,text and "static" elements ).
tamash_ionut 13-Feb-11 18:41pm    
I'ved found a solution to the problem using ClientRectangle of each HtmlElement and checking if the bounds are within the WebBrowser control bounds. (http://msdn.microsoft.com/en-us/library/system.windows.forms.htmlelement.clientrectangle.aspx)
Sorry for posting without checking more in depth on the internet.

1 solution

Just to remove it from unanswered list.

Solution as found by OP:
I'ved found a solution to the problem using ClientRectangle of each HtmlElement and checking if the bounds are within the WebBrowser control bounds. (http://msdn.microsoft.com/en-us/library/system.windows.forms.htmlelement.clientrectangle.aspx[^])
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900