soup icon indicating copy to clipboard operation
soup copied to clipboard

How to find an element with particular value?

Open andreygursky opened this issue 7 years ago • 2 comments

Hi!

I have html files not using ids. With beautifulsoup it is easy to find such element using find("Some text"):

<span style="color: #012345">Some text</span>

Is the only way to find this to use FindAll("span") and then iterating through all found spans? In this case, how can I check whether a particular span element contains text? I wouldn't like to disable debugging, since, I guess, empty span is not necessary a critical error.

andreygursky avatar Jun 02 '18 22:06 andreygursky

Hi, this isn't supported currently (could be included in future versions) Iterating through all spans and calling the method Text() on them would be an alternative option atm.

anaskhan96 avatar Sep 22 '20 20:09 anaskhan96

Hi @anaskhan96
If no one is working on this enhancement and it's still open, can I take it up? Could you assign it to me?

Swathi-L avatar Apr 06 '22 22:04 Swathi-L