anaskhan96 / soup

Web Scraper in Go, similar to BeautifulSoup
MIT License
2.18k stars 168 forks source link

How to find an element with particular value? #21

Open andreygursky opened 6 years ago

andreygursky commented 6 years ago

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.

anaskhan96 commented 4 years ago

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.

Swathi-L commented 2 years ago

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?