How to copy the content of a div in an html page to the clipboard?

I looked at this thread talking about selecting and modifying the content of a div.

I want to be able to select the content of a webpage that is located in a div to copy it to the clipboard
and append it to a specific file.

I hope Keyboard Maestro newer versions are full of features that make it possible.

Do you want to copy the HTML code, or the text on the web page?
It would be best if you can provide the URL of an example page, and clearly identify (screenshot) the <div> and section on the web page that you wish to copy.


Here is the url:

I just want to know how to copy the content inside the div <id="articleWRD"> (the text of the page not the HTML code) to the clipboard/append it to a specific .csv file.

Please, let me know if you need any further information.

Thank you.

OK, thanks for all the details, which make this very easy to answer.
Just put this JavaScript in a Execute a JavaScript in Browser action:

That will return the plain text on the web page to whatever you like, KM Variable or Clipboard.

Does that work for you?


It works amazingly well. This macro justifies by itself buying Keyboard Maestro !

I still will have to do some cleaning with the content appended to the csv file, but a massive improvement anyway!

1 Like