您如何使用vba从html中提取属性

问题描述 投票:0回答:1

我需要使用VBA从html的此部分中提取sku(CS060120)(编辑:)

尝试使用getAttribute和getElementsbyTag(和Class)Name,但是我无法获得想要的返回值。有人知道该怎么做吗?

<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>

这是我正在尝试的:

ieDoc.getElementsByClassName("product_options")(0).getAttribute("sku")
html vba web-scraping
1个回答
0
投票

<!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>
© www.soinside.com 2019 - 2024. All rights reserved.