0

I need some help in JS. Basically I want to write a function in JavaScript which takes XPath of the webpage and returns the innerHTML of that Xpath. Something like this

function : getXpath(my_xpath)
{
  // JS Code that will parse the above Xpath and returns an InnerHTML as value
   return value.
}

In the above example, the xpath = "/html/body/div[5]/div[2]/div/div[2]/div[2]"

So how should I get an innerHTML that is present in last div[2]. I want to use pure JavaScript.

PS For people who wants to suggest some JS Libraries or frameworks. PLEASE EXCUSE!!!

Cerbrus
  • 70,800
  • 18
  • 132
  • 147

0 Answers0