https://github.com/andrewvy/chrome-launcher
Launch managed Chrome processes easily in Elixir
https://github.com/andrewvy/chrome-launcher
elixir headless-chrome
Last synced: over 1 year ago
JSON representation
Launch managed Chrome processes easily in Elixir
- Host: GitHub
- URL: https://github.com/andrewvy/chrome-launcher
- Owner: andrewvy
- Created: 2017-08-21T00:09:43.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-11-06T20:33:17.000Z (over 8 years ago)
- Last Synced: 2024-04-24T01:20:28.227Z (about 2 years ago)
- Topics: elixir, headless-chrome
- Language: Elixir
- Homepage: https://hex.pm/packages/chrome_launcher
- Size: 15.6 KB
- Stars: 5
- Watchers: 2
- Forks: 7
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Chrome Launcher
This Elixir library makes launching headless Google Chrome processes with custom options easily.
Utilizes [erlexec](https://github.com/saleyn/erlexec) to manage processes under the hood.
Only supports OSX + Linux at this time.
---
### Installation:
```elixir
{:chrome_launcher, "~> 0.0.4"}
```
### Usage:
```elixir
{:ok, pid} = ChromeLauncher.launch([
remote_debugging_port: 9233
])
```
> Or in a supervisor (1.5+)
```elixir
children = [
{ChromeLauncher, [remote_debugging_port: 9222]}
]
Supervisor.start_link(children, strategy: :one_for_one)
```
> With multiple instances in a supervisor (1.5+)
```elixir
children = [
Supervisor.child_spec({ChromeLauncher, [remote_debugging_port: 9222]}, id: :chrome_1),
Supervisor.child_spec({ChromeLauncher, [remote_debugging_port: 9223]}, id: :chrome_2),
]
Supervisor.start_link(children, strategy: :one_for_one)
```
> Pre 1.5
```elixir
import Supervisor.Spec
children = [
worker(ChromeLauncher, [[remote_debugging_port: 9222]], id: :chrome_1),
worker(ChromeLauncher, [[remote_debugging_port: 9223]], id: :chrome_2),
]
Supervisor.start_link(children, strategy: :one_for_one)
```
Available options:
- `remote_debugging_port`: Configures `--remote-debugging-port=PORT` flag for connecting to the chrome process.
- `flags`: Flags to be passed in when starting the headless chrome process. (Overrides defaults set by `:chrome_launcher`)