Module Webdriver_cohttp_lwt_unix.Error

All potentital errors raised by the WebDriver protocol.

type error = [
| `element_click_intercepted
| `element_not_interactable
| `insecure_certificate
| `invalid_argument
| `invalid_element_state
| `invalid_selector
| `invalid_session_id
| `javascript_error
| `move_target_out_of_bounds
| `no_such_alert
| `no_such_element
| `no_such_frame
| `no_such_window
| `script_timeout
| `session_not_created
| `stale_element_reference
| `timeout
| `unable_to_capture_screen
| `unexpected_alert_open
| `unknown_command
| `unknown_error
| `unknown_method
| `unsupported_operation
| `unspecified of string

browser specific failure

| `ocaml_protocol_failure

a bug in this library, please report!

]
type t = {
error : error;

the WebDriver error

message : string;

a human readable explanation

stacktrace : string;

browser stacktrace

data : Yojson.Safe.t;

additional metadatas

}
val to_string : t -> string

to_string err returns a debug-friendly string of the WebDriver error.

val catch : (unit -> 'a cmd) -> ?⁠errors:error list -> (t -> 'a cmd) -> 'a cmd

catch (fun () -> cmd) ?errors (fun err -> catch) runs cmd, catching any WebDriver exceptions from ?errors (or all if unspecified), then runs catch if necessary with the error err as an argument.

Some errors are less fatal than others: it's common to catch `no_such_element, sleep and retry when the element in question is created by some (slow) javascript. See Timeouts to add an implicit wait for this situation.

val fail : exn -> 'a cmd

fail e raises the exception e.