My simple need.
How do I find elements that are not visible on the webpage currently? I am guessing style="visibility:hidden"
or style="display:none"
are simple ways to hide an element, but BeautifulSoup doesn't know if its hidden or not.
For example, HTML is:
Textbox_Invisible1: <input id="tbi1" type="text" style="visibility:hidden">
Textbox_Invisible2: <input id="tbi2" type="text" class="hidden_elements">
Textbox1: <input id="tb1" type="text">
So my first concern is that BeautifulSoup cannot find out if any of the above textboxes are hidden:
# Python 2.7
# Import BeautifulSoup
>>> source = """Textbox_Invisible1: <input id="tbi1" type="text" style="visibility:hidden">
... Textbox_Invisible2: <input id="tbi2" type="text" class="hidden_elements">
... Textbox1: <input id="tb1" type="text">"""
>>> soup1 = BeautifulSoup(source)
>>> soup1.find(id='tb1').hidden
False
>>> soup1.find(id='tbi1').hidden
False
>>> soup1.find(id='tbi2').hidden
False
>>>
My only question is, is there a way to find out which elements are hidden? (We have to consider the complex HTML also where the having elements might be hidden)