How to scrape value from option tag inside select?

I want to scrape all the options under the select element to scrape product variants available on the eCommerce website I am scraping

Example HTML

<select name="sizes">
<option value="S">Small</option>
<option value="M">Medium</option>
<option value="L">Large</option>
<option value="XL">Extra-Large</option>

I tried to use the “.sizes” selector and it’s not scraping anything. And I don’t want full text, instead the option value of the select item.

“sizes” is not a class, so you cannot use it with dot (.) to match this element. You should be using the attribute selector select[name="sizes"] option and value as your attribute to scrape all values.

Here is Github example to try out - Forum #16