I was developing a web scraper to find the price tag from a given website.
I have a code
price = soup.findAll(['div'],{'class':re.compile(r'(.*?price.*?)',re.IGNORECASE)})
With this, I was able to find all div tags with a class attribute having values with a price keyword. (words which contain price like - data-price, price value etc.)
But I want to retrieve all div tags which contain price keyword irrespective of the attribute name.
Example:
The Website I am trying to scrape has this format:
<div class="css-2vqe5n esdkp3p0" data-automation="buybox-price" aria-label="Now $74">$74</div>
My code only retrieves if the price keyword is present in the class attribute, But in this case, it is present in the data-automation attribute.
So I am looking for a solution that would search all attributes of the div tag but not only in the class tag.