Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I want to scrape things from a web page. The way I want to do this is to extract the text of a DOM element (I believe this is the correct description). This means that I will to retrieve the text of an element like document.frames.item(0).document.innerhtml. Now I am looking for a tool to do this quickly by clicking on the element in a web page.

IE DOM Inspector can do this, but is not free and requires admin rights on the computer. I have not been able to get the reference to the DOM element using DOM inspector plug-in for Firefox. Are there any other alternative tools?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Every modern browser today has a built-in DOM inspector.

Usually all you have to do is right-click on any element and select "inspect element" from the pop-up menu. The DOM inspector will load and the element you clicked will be showed, along with the rest of the DOM tree and every detail you can imagine.

They are free, even for IE.

Anyway, with those tools you will be able to see the text content of an element, copy it and paste somewhere where you need. They are not automated tool able to automatically copy the text for you with only a click.

You have to write your own JavaScript to do that.

share|improve this answer

I can give you a few pointers: If you parse XML documents, you can use something like a xpath generator http://xpath.alephzarro.com/download (freeware)

Here is a relevant StackOverflow thread:

Other relevant keywords could be: CSS child selectors This could be helpful especially if your HTML is not a well-formed XML document.

The way to acces it is via right click in the page -> inspect, and then in Firebug window right click on the desired element and the topmost section contains "Copy XPath" and "Copy CSS Path".

UPDATE: I can confirm that Firefox Firebug gives you the XPath and the CSS Path, as stated in the StackOverflow thread. Be sure to read that info and follow the links - the recommended books are quite nice.

Have fun hacking!

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.