pusk/bin/main.ml

31 lines
627 B
OCaml
Raw Normal View History

2023-05-12 20:04:04 +02:00
open Pusk.Utils
open Pusk.Net
open Pusk.Drivers
2023-05-12 19:36:27 +02:00
let main =
let json_payload =
{|
{
"capabilities": {
"alwaysMatch": {
"moz:firefoxOptions": {
"args": ["-headless"]
}
}
}
}
|}
in
let body = send_post_request "http://localhost:4444/session" json_payload in
print_endline (Lwt_main.run body)
;;
2023-05-12 20:30:02 +02:00
2023-05-12 19:36:27 +02:00
let () =
let driver = prepare (Gecko "0.33.0") in
let driver_pid = run driver [] in
print_endline (fmt "Driver running as %d" driver_pid);
2023-05-12 20:30:02 +02:00
main;
let closed_pid = close driver_pid in
2023-05-12 20:30:02 +02:00
print_endline (fmt "Program %d closed!" closed_pid)
2023-05-12 19:36:27 +02:00
;;