-
Notifications
You must be signed in to change notification settings - Fork 15
/
by.go
62 lines (50 loc) · 1.11 KB
/
by.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package marionette_client
import "fmt"
type ByStrategy interface {
fmt.Stringer
}
// By strategy type to find elements in the DOM
type By int
/*
The method to use to locate the element; one of:
"id", "name", "class name", "tag name", "css selector",
"link text", "partial link text", "xpath", "anon" and "anon
attribute". Note that the "name", "link text" and "partial
link test" methods are not supported in the chrome DOM.
:param target: The target of the search. For example, if method =
"tag", target might equal "div". If method = "id", target would
be an element id.
:param id: If specified, search for elements only inside the element
with the specified id.
*/
const (
Id By = 1 + iota
Name
ClassName
TagName
CssSelector
LinkText
PartialLinkText
Xpath
Anon
AnonAttribute
)
func ID() By {
return By(Id)
}
var bys = [...]string{
"id",
"name",
"class name",
"tag name",
"css selector",
"link text",
"partial link text",
"xpath",
"anon",
"anon attribute",
}
// String returns the value name of the strategy ("css selector", "link text", ...).
func (b By) String() string {
return bys[b-1]
}