how to hide elements that are not displayed?

5 views
Skip to first unread message

Karter

unread,
Dec 13, 2009, 12:45:04 PM12/13/09
to beautifulsoup
Hi,
say I have a structure like the following:

<div>
<p>
main text..valid text..
</p>
<div style="top:XX;left:XXX;display:none">
<p>
this text is not visible
</p>
</div>
</div>

I don't want to select the <p> where the text is not visible.

How do I do this generically?

I would prefer a way to somehow express if the parent is hidden - do
not select the text..

sste...@gmail.com

unread,
Dec 13, 2009, 3:24:34 PM12/13/09
to beauti...@googlegroups.com

On Dec 13, 2009, at 12:45 PM, Karter wrote:

> Hi,
> say I have a structure like the following:
>
> <div>
> <p>
> main text..valid text..
> </p>
> <div style="top:XX;left:XXX;display:none">
> <p>
> this text is not visible
> </p>
> </div>
> </div>
>
> I don't want to select the <p> where the text is not visible.
>
> How do I do this generically?

There are way too many ways for things not to be visible (css, direct styling, etc.) that coming uop with a 'generic' way is going to be virtually impossible.

If it's a limited case, you'll probably be able to filter it out one chunk/case/method at a time.

S

Reply all
Reply to author
Forward
0 new messages