skip to Main Content

I need to pull the sku (CS060120) from this section of html (edit:) Using VBA

tried getAttribute and getElementsbyTag(and Class)Name but I am not able to get the return I am looking for. Anyone know how to do this?

<section class="product_options">
    <header>
        <h1>
            60' x 120' NiceRink CS Liner
        </h1>
    </header>
    <vue-product-options 
        v-bind:product-opts="[]" 
        v-bind:configurable-payload="{&quot;product_option&quot;:{&quot;extension_attributes&quot;:{&quot;configurable_item_options&quot;:[]}}}" 
        v-bind:liner-types="{&quot;good&quot;:16,&quot;better&quot;:14,&quot;best&quot;:15}" 
        v-bind:is-folded-or-rolled-liner-sku="false" 
        v-bind:bundle-payload="{&quot;product_option&quot;:{&quot;extension_attributes&quot;:{&quot;bundle_options&quot;:[]}}}" 
        v-bind:tier-prices="[]" 
        v-bind:is-wholesale-only="false" 
        v-bind:prices-index="{}" 
        v-bind:options-map="{}" 
        v-bind:is-configurable="false" 
        v-bind:is-rink-liner="false" 
        v-bind:is-liner-sku="true" 
        v-bind:is-bundle="false" product-type="undefined" price="612" sku="CS060120" image="https://www.nicerink.com/media/catalog/product/l/i/liner_1.jpg" magento-base-url="https://www.nicerink.com" name="60' x 120' NiceRink CS Liner">
    </vue-product-options>
    <div class="product_options_panel package_cta">
        <h3>
            Looking for a full Rink Package?
        </h3>

        <p>
            We've got you covered!
        </p>

        <a class="button dark" href="/rink-builder">
            Rink Packages
        </a>
    </div>
</section>

This is what I’m trying:

ieDoc.getElementsByClassName("product_options")(0).getAttribute("sku")

2

Answers


  1. <!DOCTYPE html>
    <html>
    <head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
    <script>
    $(document).ready(function(){
      $("button").click(function(){
        alert($(".sdfv").attr("sku"));
      });
    });
    </script>
    </head>
    <body>
    
    <vue-product-options class="sdfv" sku="CS060120"></vue-product-options>
    
    <button>Click the button to get sku value</button>
    
    </body>
    </html>
    Login or Signup to reply.
  2. Try using attribute selector

    Debug.Print ie.document.querySelector("[sku]").getAttribute("sku")
    

    If you need to be more specific you can add the type selector so it becomes

    Debug.Print ie.document.querySelector("vue-product-options[sku]").getAttribute("sku")
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search