Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bogdanp/marionette
A Racket library that lets you control Firefox via the Marionette Protocol.
https://github.com/bogdanp/marionette
firefox racket webdriver
Last synced: 11 days ago
JSON representation
A Racket library that lets you control Firefox via the Marionette Protocol.
- Host: GitHub
- URL: https://github.com/bogdanp/marionette
- Owner: Bogdanp
- Created: 2019-06-08T13:36:10.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-09-12T18:11:33.000Z (4 months ago)
- Last Synced: 2024-11-18T06:43:19.445Z (about 1 month ago)
- Topics: firefox, racket, webdriver
- Language: Racket
- Homepage:
- Size: 162 KB
- Stars: 74
- Watchers: 4
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
# marionette
[![CI](https://github.com/Bogdanp/marionette/actions/workflows/ci.yml/badge.svg)](https://github.com/Bogdanp/marionette/actions/workflows/ci.yml)
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:
``` racket
#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.[Marionette Protocol]: https://firefox-source-docs.mozilla.org/testing/marionette/marionette/Protocol.html