How to access Firefox’s DOM (or HTML content) from outside firefox

I have a question:

My program will search FireFox windows opened by user. When a user open Firefox and enter any site, I want to search for a keyword in that page’s HTML content.

How can I access Firefox’s Active Tab’s DOM (or HTML content) from outside firefox using my C++ program.

Is it possible? If so, can you give me some idea or links?

If it is not possible, how can I copy text to clipboard within Firefox without installing / setting up anything?

Best regards,
Nuri Akman

How to access Firefox’s DOM (or HTML content) from outside firefox