How to do custom scraping without a class value

Hi guys, just a quick question with scraping. This is the part of the html code that i’m scraping. Form there, I would like to scrape the label value without the class name of hide-oos-disable. How can I achieve that.

<fieldset class="js product-form__input">
                        <legend class="form__label">Size</legend><input type="radio" id="template--14819390488630__main-1-0" name="Size" value="XXS" form="product-form-template--14819390488630__main" disabled="">
                          <label for="template--14819390488630__main-1-0" class="hide-oos-disable">
                          </label><input type="radio" id="template--14819390488630__main-1-1" name="Size" value="XS" form="product-form-template--14819390488630__main" checked="">
                          <label for="template--14819390488630__main-1-1">
                          </label><input type="radio" id="template--14819390488630__main-1-2" name="Size" value="S" form="product-form-template--14819390488630__main">
                          <label for="template--14819390488630__main-1-2">
                          </label><input type="radio" id="template--14819390488630__main-1-3" name="Size" value="M" form="product-form-template--14819390488630__main" disabled="">
                          <label for="template--14819390488630__main-1-3" class="hide-oos-disable">
                          </label><input type="radio" id="template--14819390488630__main-1-4" name="Size" value="L" form="product-form-template--14819390488630__main" disabled="">
                          <label for="template--14819390488630__main-1-4" class="hide-oos-disable">

Hi @kyawphonehan,

This is hard to decipher without the actual full page you are trying to scrape from (at least for me). Would you mind sharing the link to the page and advise which labels you are trying to scrape?

Thank you,

Hi @kyawphonehan

Welcome to the community!

Sorry about the delay.

To select the labels without the class name “hide-oos-disable” within the given HTML code, you can use the :not() pseudo-class in your CSS selector. Here’s the CSS selector you can use to select those labels:

fieldset.js.product-form__input label:not(.hide-oos-disable)

This selector will target all elements that are children of a with the classes “js”, “product-form__input” and have a class attribute not containing “hide-oos-disable.”

→ That’s ChatGPT response. Worth a shot :slight_smile:

Tagging @danmelk as well if he has an input here

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.