Crates.io | chrome_driver |
lib.rs | chrome_driver |
version | 0.2.0 |
source | src |
created_at | 2022-11-25 14:15:39.235066 |
updated_at | 2024-05-05 11:46:30.897717 |
description | API to manage chromium headless processes. |
homepage | |
repository | https://github.com/a11ywatch/chrome |
max_upload_size | |
id | 722804 |
size | 42,413 |
Chrome instance and panel to manage startup and shutdowns easily.
cargo install chrome_driver
The current instance binds chrome to 0.0.0.0 when starting via API.
Use the env variable REMOTE_ADDRESS
to change the address of the chrome instance between physical or network.
The application will pass alp health checks when using port 6000
to get the status of the chrome container.
A side loaded application is required to run chrome on a load balancer, one of the main purposes of the project.
The default port is 9222
for chrome.
In order to build without docker set the BUILD_CHROME
env var to true.
If your running locally use the following to start the args with the first param chrome_driver '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'
/fork
to start a new chrome instance or use fork/$port
with the port to startup the instance./shutdown/$PID
to shutdown the instance. ex: curl --location --request POST 'http://localhost:6000/shutdown/77057'
/json/version
get the json info of the chrome instance to connect to web sockets./fork
curl --location --request POST 'http://localhost:6000/fork'
# PID 87659
/shutdown
curl --location --request POST 'http://localhost:6000/shutdown'
# you can also pass in a PID at the subpath /shutdown/:id
/json/version
curl --location --request GET 'http://localhost:6000/json/version' \
--header 'Content-Type: application/json'
# {
# "Browser": "HeadlessChrome/114.0.5735.133",
# "Protocol-Version": "1.3",
# "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/114.0.5735.133 Safari/537.36",
# "V8-Version": "11.4.183.23",
# "WebKit-Version": "537.36 (@fbfa2ce68d01b2201d8c667c2e73f648a61c4f4a)",
# "webSocketDebuggerUrl": "ws://127.0.0.1:9222/devtools/browser/74f18759-f4b3-4b1f-a68c-942570542f0e"
# }
'/opt/google/chrome/chrome'
.127.0.0.1
.init
to auto start chrome on 9222
.Example to start chrome (all params are optional):
chrome_driver '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome' 127.0.0.1 init
# Chrome PID: 87659
# Chrome server at localhost:6000
# DevTools listening on ws://127.0.0.1:9222/devtools/browser/c789f9e0-7f65-495d-baee-243eb454ea15
fork
.