Skip to content
A Racket library that lets you control Firefox via the Marionette Protocol.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github github: add FUNDING.yml Jun 12, 2019
examples examples: add more caveats to pdf.rkt Jun 9, 2019
marionette-doc core: avoid deleting custom profile paths on shutdown Jul 9, 2019
marionette-lib core: fix path to profile to be deleted Jul 9, 2019
marionette-test
marionette doc: add reference docs Jun 8, 2019
.gitignore core: initial commit Jun 8, 2019
README.md

README.md

marionette

A Racket library that lets you control Firefox via the Marionette Protocol.

Quickstart

Install marionette:

$ raco pkg install marionette

Run Firefox with the -marionette flag:

$ /path/to/firefox -headless -marionette -safe-mode

Run this script:

#lang racket

(require marionette)

(call-with-browser!
  (lambda (b)
    (call-with-page! b
      (lambda (p)
        (page-goto! p "https://racket-lang.org")
        (call-with-page-screenshot! p
          (lambda (data)
            (define filename (make-temporary-file "~a.png"))
            (with-output-to-file filename
              #:exists 'truncate/replace
              (lambda _
                (write-bytes data)))

            (system* (find-executable-path "open") filename)))))))

Tips

To run a headless, marionette-enabled Firefox while you've got another instance of the browser open, add the -no-remote flag:

$ /path/to/firefox -no-remote -headless -marionette -safe-mode

It's advisable that you use a separate profile as well:

$ /path/to/firefox -P marionette -no-remote -headless -marionette -safe-mode

You can create new profiles by visiting about:profiles in the browser.

Todos

  • Cookies
  • Frames
You can’t perform that action at this time.