title: CSS selector QuerySelector alternative
body: <p>I have searched a lot and a lot so as to find material about how to get meta data using XMLHTTP. And I think that's impossible to do that using the Early binding method. The only approach that will work is the late binding by <code>CreateObject("HTMLFile")</code> and dealing with that HTML which is late binding. The disadvantage of this approach is that it doesn't support the use of the <code>QuerySelector</code> or <code>QuerySelectorAll</code>..
  Now I am trying to find alternative to this CSS selector .. without using the <code>QuerySelector</code></p>
  
  <pre><code>Set post = .querySelector("table div span[itemprop='lowPrice']")
  </code></pre>
  
  <p>This arises an error .. and I can't find easier way to find the element
  Here's the HTML content </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;table class="p"&gt;
      &lt;tbody&gt;&lt;tr&gt;
          &lt;td class="foto"&gt;
              &lt;div class="foto"&gt;
                          &lt;a href="https://krmivo-psy.heureka.cz/brit-premium-by-nature-adult-l-15-kg/#gallery-open" target="_blank" class="gallery-link product-detail__gallery-link" onclick="dataLayer.push({'event':'sendEvent','event_category':'Product Detail - Desktop','event_action':'Gallery','event_label':'Otev\u0159en\u00ed galerie','event_value':0});"&gt;
                             &lt;img src="https://im9.cz/iR/importprodukt-orig/4c2/4c2b1733c8b233edd5052d3063ac46d9--mmf250x250.jpg" alt="Brit Premium by Nature Adult L 15 kg" width="250" height="250" id="picture-main"&gt;
                              &lt;span class="image-hover"&gt;
                                  &lt;span class="image-overlay"&gt;&lt;/span&gt;
                                  &lt;span class="js-test-image-count-info image-count-info"&gt;Galerie &lt;span class="picture-count"&gt;(2)&lt;/span&gt;&lt;/span&gt;
                              &lt;/span&gt;
                              &lt;span class="product-detail__gallery-link__image__count-info"&gt;Galerie
                                  &lt;span class="product-detail__gallery-link__image__count-info__count"&gt;(2)&lt;/span&gt;
                              &lt;/span&gt;
                          &lt;/a&gt;
                          &lt;a href="https://krmivo-psy.heureka.cz/top-produkty/" class="top-ico gtm-header-link" data-gtm-link-description="Pořadí v TOP produktech"&gt;&lt;span&gt;Top&lt;/span&gt;&lt;strong&gt;1.&lt;/strong&gt;&lt;/a&gt;
                      &lt;div class="poty-ico"&gt;
                          &lt;a href="http://www.produktroku.cz/" target="_blank"&gt;&lt;img src="https://im9.cz/iR/recenze-externi/107.png" alt="Produkt Roku 2019" class="product-of-year-badge"&gt;&lt;/a&gt;&lt;/div&gt;
  
  
  
              &lt;/div&gt;
  
          &lt;/td&gt;
          &lt;td&gt;
  &lt;div class="main-info"&gt;
      &lt;div class="text-cover"&gt;
          &lt;div id="n649054946" data-id="649054946" class="item js-public-product-id"&gt;
                  &lt;h2 itemprop="name"&gt;Brit Premium by Nature Adult L 15 kg&lt;/h2&gt;
          &lt;/div&gt;
          &lt;div class="rating-box" itemprop="aggregateRating" itemscope="" itemtype="http://schema.org/AggregateRating"&gt;
  
              &lt;p class="eval"&gt;
                  &lt;strong itemprop="ratingValue"&gt;95%&lt;/strong&gt;
                  &lt;a href="https://krmivo-psy.heureka.cz/brit-premium-by-nature-adult-l-15-kg/pridat-uzivatelskou-recenzi/#section"&gt;
                      &lt;span class="rating"&gt;&lt;span class="hidden"&gt;Hodnocení produktu: 95%&lt;/span&gt;&lt;span class="over" title="Hodnocení produktu: 95%"&gt;&lt;span style="width: 75px;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
                  &lt;/a&gt;
              &lt;/p&gt;
  
              &lt;span class="hidden-microdata" itemprop="ratingCount"&gt;
                  456
              &lt;/span&gt;
  
              &lt;p class="review-count delimiter-blank"&gt;
                  &lt;a href="https://krmivo-psy.heureka.cz/brit-premium-by-nature-adult-l-15-kg/recenze/#section" class="gtm-header-link" data-gtm-link-description="Počet recenzí"&gt;
                      &lt;span itemprop="reviewCount"&gt;344&lt;/span&gt;
                      recenzí
                  &lt;/a&gt;
              &lt;/p&gt;
              &lt;div class="cleaner"&gt;&lt;/div&gt;
              &lt;p class="rating-box__item rating-box__favourite"&gt;
                  &lt;a href="https://ucet.heureka.cz/prihlaseni?callbackUrl=https%3A%2F%2Fkrmivo-psy.heureka.cz%2Fbrit-premium-by-nature-adult-l-15-kg%2F" title="Chci to" class="gtm-header-link" data-gtm-link-description="Akce - oblíbené"&gt;Přidat do oblíbených&lt;/a&gt;
              &lt;/p&gt;
  
              &lt;p id="cli649054946" class="rating-box__item rating-box__compare delimiter-blank cl-add"&gt;
                  &lt;a class="checkbox gtm-header-link" data-gtm-link-description="Akce - porovnání" href="#" title="Porovnat"&gt;Přidat do porovnání&lt;/a&gt;
              &lt;/p&gt;
              
              &lt;p class="delimiter-blank rating-box__item rating-box__price-watch js-price-watch-button"&gt;
                  &lt;a href="#" title="Hlídat cenu" class="gtm-header-link" data-gtm-link-description="Akce - hlídat cenu"&gt;
                          Hlídat cenu
                  &lt;/a&gt;
              &lt;/p&gt;
  
              &lt;p class="add-review rating-box__item rating-box__add-review delimiter-blank"&gt;
                  &lt;a href="https://krmivo-psy.heureka.cz/brit-premium-by-nature-adult-l-15-kg/pridat-uzivatelskou-recenzi/#section" class="gtm-header-link" data-gtm-link-description="Akce - přidat recenzi"&gt;
                      Přidat recenzi
                  &lt;/a&gt;
              &lt;/p&gt;
          &lt;/div&gt;
  
          &lt;div id="top-shop-info" class="top-shop-info"&gt;
              &lt;div class="inner"&gt;
              &lt;div class="guar"&gt;
                  &lt;div&gt;
                      &lt;img class="guar-badge" src="https://im9.cz/css-v2/images/guaranty-seal.png?1" alt="Garance nákupu - SpokojenyPes.cz" width="27" height="34"&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
  
          &lt;div class="shop-claim bold"&gt;
              &lt;strong&gt;Produkt vám dodá:&lt;/strong&gt;
          &lt;/div&gt;
          &lt;div class="shop-logo"&gt;
              &lt;a href="https://www.heureka.cz/exit/spokojenypes-cz/3180319922/?z=41" target="_blank" rel="nofollow noopener" class="gtm-header-link" data-gtm-link-description="Exit - produkt vám dodá"&gt;
                      &lt;img src="https://im9.cz/iR/importobchod-orig/1983_logo--mmf130x40.png" alt="SpokojenyPes.cz" width="130" height="40"&gt;
              &lt;/a&gt;
          &lt;/div&gt;
  
          &lt;div class="recommendation"&gt;
              &lt;a href="https://obchody.heureka.cz/spokojenypes-cz/recenze/" class="gtm-header-link" data-gtm-link-description="Hodnocení - Produkt vám dodá"&gt;
                  99% zákazníků doporučuje obchod
              &lt;/a&gt;
          &lt;/div&gt;
  
              &lt;div class="delivery-info bold price-delivery-free"&gt;
                  Doprava zdarma
              &lt;/div&gt;
                  &lt;div class="availability-info bold in-stock"&gt;
              skladem
          &lt;/div&gt;
  
  
      &lt;/div&gt;
      &lt;a data-gtm-link-description="Další nabídky" id="top-shop-count-info" href="https://krmivo-psy.heureka.cz/brit-premium-by-nature-adult-l-15-kg/porovnat-ceny/#section" class="top-shop-count-info box-active gtm-header-link"&gt;Dalších 134 nabídek od 728 Kč&lt;/a&gt;
          &lt;/div&gt;
  
          &lt;p class="desc"&gt;
              &lt;span id="product-short-description"&gt;
                      Kompletní krmivo Brit Premium pro dospělé psy. Kuřecí receptura pro dospělé psy velkých plemen (25 - 45 kg). 
                  &lt;a id="product-short-description-button" href="https://krmivo-psy.heureka.cz/brit-premium-by-nature-adult-l-15-kg/specifikace/#section" title="celá specifikace Brit Premium by Nature Adult L 15 kg"&gt;celá specifikace&lt;/a&gt;
              &lt;/span&gt;
          &lt;/p&gt;
      &lt;/div&gt;
  
      &lt;div itemprop="offers" itemscope="" itemtype="http://schema.org/AggregateOffer" style="display:none"&gt;
          &lt;span itemprop="lowPrice"&gt;728.00&lt;/span&gt;
          &lt;span itemprop="highPrice"&gt;1579.00&lt;/span&gt;
          &lt;span itemprop="offerCount"&gt;135&lt;/span&gt;
              &lt;link itemprop="availability" href="http://schema.org/InStock"&gt;
      &lt;/div&gt;
  
      &lt;div itemprop="offers" itemscope="" itemtype="http://schema.org/Offer" class="price-from shopping-cart"&gt;
          &lt;link itemprop="itemCondition" href="http://schema.org/OfferItemCondition" content="http://schema.org/NewCondition"&gt;
              &lt;link itemprop="availability" href="http://schema.org/InStock"&gt;
          &lt;link itemprop="category" href="http://schema.org/category" content="Hobby / Chovatelství / Pro psy / Krmivo pro psy"&gt;
          &lt;link itemprop="image" href="http://schema.org/image" content="https://im9.cz/iR/importprodukt-orig/4c2/4c2b1733c8b233edd5052d3063ac46d9.jpg"&gt;
                          &lt;div class="top-left"&gt;
                  &lt;div id="top-button" class="buy-click-observed"&gt;
  &lt;p class="buy"&gt;
      &lt;a href="#" class="flat-button flat-button--top-position flat-button--orange buy-btn hb hb-3180319922 js-top-pos-btn" data-cart-position="0"&gt;
          &lt;i class="ico basket"&gt;&lt;/i&gt;
          &lt;i class="ico check"&gt;&lt;/i&gt;
          &lt;span class="in"&gt;Koupit na Heurece&lt;/span&gt;
          &lt;span class="in replace"&gt;Přidáno do košíku&lt;/span&gt;
      &lt;/a&gt;
  &lt;/p&gt;
                  &lt;/div&gt;
  
                  &lt;div class="n" id="top-offer-price"&gt;
  &lt;p class="buy-price"&gt;
      &lt;span itemprop="price" class="js-top-price" content="839.00"&gt;839 Kč&lt;/span&gt;
      &lt;span class="price-vat-title small"&gt;s DPH&lt;/span&gt;
      &lt;span itemprop="priceCurrency" content="CZK"&gt;&lt;/span&gt;
  &lt;/p&gt;
                  &lt;/div&gt;
  
  
                  &lt;div class="clear"&gt;&lt;/div&gt;
                  &lt;div class="js-top-gifts-info top-shop-gifts-info-box"&gt;
                  &lt;/div&gt;
  
              &lt;/div&gt;
              &lt;div class="clear"&gt;&lt;/div&gt;
          &lt;div class="clear"&gt;&lt;/div&gt;
      &lt;/div&gt;
      &lt;span id="new-pd"&gt;&lt;/span&gt;
      &lt;script&gt;
          (function() {
              loadScript("https:\/\/im9.cz\/js\/cache\/7e39f733-1-42bd9e7837b830d87e1af94da6d0e4a82055c56f.hash.js", function () {
                  var productHeadObserver = new ProductHeadObserver({ 'topShortDescElm': $('product-short-description'), 'topShopBox': $('top-shop-info'), 'maxOfferNameLength': 90 });
                  productHeadObserver.oneOfferInit();
              });
  
                  H.Awards._reviewClick($$('#awards-list span.pa'));
                  var notSelectedCallback = function() {
                      if ('undefined' != typeof H.ShoppingCartHelper.BuyMoreOptions &amp;&amp;
                          typeof H.ShoppingCartHelper.BuyMoreOptions.buyClickNotSelectedCallback == 'function') {
                          H.ShoppingCartHelper.BuyMoreOptions.buyClickNotSelectedCallback();
                      }
                  };
                  H.ShoppingCartHelper.observeBuyClick($('top-button'), new H.ShoppingCart(), notSelectedCallback, 'js-top-pos-btn');
          })();
      &lt;/script&gt;
  
      &lt;div class="clear"&gt;&lt;/div&gt;
  
  
  &lt;/div&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;&lt;/table&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>This is the whole HTML
  <a href="https://pastebin.com/Dgu1wk2b" rel="nofollow noreferrer">https://pastebin.com/Dgu1wk2b</a></p>
  
  <p>Here's the code till now</p>
  
  <pre><code>Sub MyTest()
  Dim source      As Object
  Dim obj         As Object
  Dim resp        As String
  Dim post As Object
  Dim a, i As Long
  
  With CreateObject("MSXML2.xmlHttp")
      .Open "GET", "https://krmivo-psy.heureka.cz/brit-premium-by-nature-adult-l-15-kg/specifikace/#section", False
      .send
      resp = .responseText
  End With
  
  With CreateObject("HTMLFile")
      .write resp
      Set post = .getElementsByTagName("meta")
  
      For i = 0 To post.Length - 1
          On Error Resume Next
          Debug.Print post.item(i).getAttribute("name")
          If post.item(i).getAttribute("name") = "gtm:product_id" Then
              Cells(2, 1).Value = post.item(i).Value
          End If
          If post.item(i).getAttribute("name") = "gtm:product_name" Then
              Cells(2, 3).Value = post.item(i).Value
          End If
          If post.item(i).getAttribute("name") = "gtm:product_brand" Then
              Cells(2, 4).Value = post.item(i).Value
          End If
          On Error GoTo 0
      Next i
  
      Set post = Nothing
  
      Set post = .getElementsByTagName("link")
      For i = 0 To post.Length - 1
          On Error Resume Next
          If post.item(i).getAttribute("rel") = "canonical" Then
              Cells(2, 2).Value = post.item(i).href
          End If
          On Error GoTo 0
      Next i
  
      'I am stuck here
      'Set post = .querySelector("table div span[itemprop='lowPrice']")
      'Debug.Print .getElementsByTagName("table")(0).innerHTML
  End With
  
  End Sub
  </code></pre>