Element selection using wildcards for class?

I am trying to scrape a website where the class of the element changes as per the following examples

'span id="product-price-875">$5.60 /span>'

'span id="product-price-4020">$8.60 /span>'

So the id changes with an apparently random number - no idea why as of course I didn't create the site. I don't know how many variations there are - probably hundreds.

Is there a way to use regex maybe to select the element that I want to scrape?


PS I removed the proper HTML tag as it disappeared in the question.

@beau Hi. Are you looking to extract all of these prices without creating several selector variants?

If so - just use the following selector span[id*="product-price"]

1 Like