title: extracting value from specific node in html using VBScript
body: <p>Is there any way to extract DomXPath of specific html elements using Vbscript in Internet Explorer???</p>
  
  <pre><code> Sub WaitForLoad 'Sub to wait for browser to load
   Do While IE.Busy
     WScript.Sleep 10
   Loop   
  End Sub
  
  Dim IE
  Dim example1
  Dim example2
  
      Set IE = CreateObject("InternetExplorer.Application")
      IE.Visible = True 
      IE.navigate "http://www.lotteimall.com/goods/viewGoodsDetail.lotte?goods_no=12570568"
      WaitForLoad 
  
  Set objRoot = ie.document
  
  MsgBox objRoot.getElementById("win10").name
  
  
  Dim vXPath : vXPath = "//*[@id='win10']"
  
  Set example1 = objRoot.selectSingleNode(vXPath) 'this works for xml
  Set example2 = objRoot.getElemetByXPath(vXPath) 'this works in javascript
  
  'none of these works in IE html
  </code></pre>
  
  <p>there is no DomXPath function like 'getElemetByXPath' in IE document object, I couldn't still proper method that returns DomXPath.</p>
  
  <p>As for the javascript,</p>
  
  <pre><code>    function XPath(elm) {
             for (segs = []; elm &amp;&amp; elm.nodeType == 1; elm = elm.parentNode) {
               if (elm.hasAttribute('id')) {
                 segs.unshift('id("' + elm.getAttribute('id') + '")')
                 return segs.join('/')
               }
               else if (elm.hasAttribute('class'))
                 segs.unshift(elm.localName.toLowerCase() + '[@class="' + elm.getAttribute('class') + '"]')
               else {
                 for (i = 1, sib = elm.previousSibling; sib; sib = sib.previousSibling)
                   if (sib.localName == elm.localName) i++
                 segs.unshift(elm.localName.toLowerCase() + '[' + i + ']')
               }
             }
             return segs.length ? '/' + segs.join('/') : null
      }
      var result = windows.document.evaluate("//div[@class='division_product_tab']//img", document, null, XPathResult.ANY_TYPE, null);
  
      var node, nodes = []
      while (node = result.iterateNext())
        nodes.push(XPath(node));
  
      console.log(nodes);
  </code></pre>
  
  <p>This returns object-specific of DomXpath. In this case, "//div[@class='division_product_tab']//img" which is img object. but this only work in Dev Tool. </p>
  
  <p>I hope there might be solution for this</p>