Reverse engineered prompt

Build me a Python command line tool for Termux on Android that can automate a real browser on my phone without root. I want Firefox as the default and Chromium as an option, with a background daemon so the browser stays open and commands are fast after the first launch. It should be easy to use by hand and also friendly for scripts or AI tools, with optional JSON output for every command.

I need the basics like opening pages, reading text and links, running JavaScript, checking the accessibility tree, clicking, typing, scrolling, switching tabs, and taking screenshots or PDFs. Please also support session persistence, cookie save and load, smart element finding by visible text, human like input, Cloudflare handling, downloads, console and network logging, request blocking, clipboard access, file upload, iframe actions, local and session storage, geolocation spoofing, user agent override, and reusable JSON macros.

Make it run fully on device in Termux, no root required, and feel lightweight rather than relying on a big browser automation framework. Look up current docs online if you need to.

Want more depth? Deep Reverse