1#[derive(PartialEq)]
2#[derive(Debug)]
3#[derive(Copy, Clone)]
4pub enum Selector {
5 Css,
6 XPath,
7 TagName,
8 LinkText,
9 PartialLinkText
10}
11
12impl Selector {
13 pub fn to_string(self) -> &'static str {
14 match self {
15 Selector::Css => "css selector",
16 Selector::XPath => "xpath",
17 Selector::TagName => "tag name",
18 Selector::LinkText => "link text",
19 Selector::PartialLinkText => "partial link text"
20 }
21 }
22}
23
24#[derive(PartialEq)]
25#[derive(Debug)]
26#[derive(Copy, Clone)]
27pub enum Browser {
28 Firefox,
29 Chrome
30}
31
32impl Browser {
33 pub fn to_string(self) -> &'static str {
34 match self {
35 Browser::Firefox => "firefox",
36 Browser::Chrome => "chrome"
37 }
38 }
39}
40
41#[derive(PartialEq)]
42#[derive(Debug)]
43#[derive(Copy, Clone)]
44pub enum Platform {
45 Linux,
46 Windows,
47 Unknow
48}
49
50impl Platform {
51 pub fn to_string(self) -> &'static str {
52 match self {
53 Platform::Linux => "linux",
54 Platform::Windows => "windows",
55 Platform::Unknow => "unknow"
56 }
57 }
58
59 pub fn current() -> Platform {
60 if cfg!(unix) {
61 Platform::Linux
62 } else if cfg!(windows) {
63 Platform::Windows
64 } else {
65 Platform::Unknow
66 }
67 }
68}
69
70pub trait WebdriverObject: PartialEq {
71 fn get_id(&self) -> &String;
72}