1use crate::role::Role;
2
3pub type Result<T> = std::result::Result<T, Error>;
5
6#[derive(Debug, thiserror::Error)]
9pub enum Error {
10 #[error("Permission denied: {instructions}")]
12 PermissionDenied { instructions: String },
13
14 #[error("No element matched selector: {selector}")]
16 SelectorNotMatched { selector: String },
17
18 #[error("Element stale: could not relocate element")]
20 ElementStale { selector: String },
21
22 #[error("Action {action} not supported on {role}")]
24 ActionNotSupported { action: String, role: Role },
25
26 #[error("Text value input not supported for this element")]
28 TextValueNotSupported,
29
30 #[error("Timeout after {elapsed:?}")]
32 Timeout { elapsed: std::time::Duration },
33
34 #[error("Invalid selector '{selector}': {message}")]
36 InvalidSelector { selector: String, message: String },
37
38 #[error("Invalid action data: {message}")]
40 InvalidActionData { message: String },
41
42 #[error("Platform error ({code}): {message}")]
44 Platform { code: i64, message: String },
45}