marionette.el lets you control the Firefox web browser via the Marionette Protocol.
To use this library, you need to have a running Firefox instance with the
marionette protocol enabled. To do this, all you have to do is run the firefox
binary with the -marionette
flag. E.g.,
$ /Applications/Firefox.app/Contents/MacOS/firefox -marionette
# For macOS (open(1) does not block your terminal)
$ open -a Firefox --args -marionette
;; Get Title of http://example.com
(marionette-with-page
(lambda (proc)
(marionette-request proc 'Navigate :url "http://example.com")
(marionette-request proc 'GetTitle)))
;; => ((value . "Example Domain"))
;; Take Screenshot of http://example.com, save to example.com.png
(marionette-with-page
(lambda (proc)
(marionette-request proc 'Navigate :url "http://example.com")
(let-alist (marionette-request proc 'TakeScreenshot :full t)
(let ((coding-system-for-write 'binary))
(write-region
(base64-decode-string .value)
nil
"example.com.png")))))