-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathWDElements.ahk
184 lines (158 loc) · 2.88 KB
/
WDElements.ahk
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
; WebDriver Element class for Rufaydium
; By Xeo786
Class WDElement extends Session
{
__new(Address)
{
;RegExMatch(Address,"element\/(.*)$",i)
;this.id := i1
This.Address := Address
}
Name()
{
return this.Send("name","GET")
}
Rect()
{
return this.Send("rect","GET")
}
Size()
{
return this.Send("Size","GET")
}
Location()
{
return this.Send("location","GET")
}
LocationInView()
{
return this.Send("location_in_view","GET")
}
enabled()
{
return this.Send("enabled","GET")
}
Selected()
{
return this.Send("selected","GET")
}
Displayed()
{
return this.Send("displayed","POST",{"":""})
}
submit()
{
return this.Send("submit","POST",{"":""})
}
SendKey(text)
{
return this.Send("value","POST", {"text":text})
}
click()
{
return this.Send("click","POST",{"":""})
}
Move()
{
return this.Send("moveto","POST",{"element_id":this.id})
}
value
{
get
{
v := this.Send("value","GET")
if v.error
return this.GetAttribute("value")
}
Set
{
return this.Send("value","POST", {"text":Value})
}
}
InnerText
{
get
{
return this.Send("text","GET")
}
}
Clear()
{
;json.Load(this.Send(this.address "/ClearValue","POST")).value ; not working for me
obj := {"text": key.ctrl "a" key.delete}
return this.Send("value","POST", obj)
}
GetAttribute(Name)
{
return this.Send("attribute/" Name,"GET")
}
GetProperty(Name)
{
return this.Send("property/" Name,"GET")
}
GetCSS(Name)
{
return this.Send("css/" Name,"GET")
}
ComputedRole() ; https://www.w3.org/TR/wai-aria-1.1/#usage_intro
{
return this.Send("computedrole","GET")
}
ComputedLable() ; https://www.w3.org/TR/wai-aria-1.1/#usage_intro
{
return this.Send("computedlabel","GET")
}
Uploadfile(filelocation)
{
return this.Send("file","POST",{})
}
}
Class ShadowElement extends Session
{
__new(Address)
{
This.Address := Address
}
}
Class Key
{
static Unidentified := "\uE000"
static Cancel:= "\uE001"
static Help:= "\uE002"
static Backspace:= "\uE003"
static Tab:= "\uE004"
static Clear:= "\uE005"
static Return:= "\uE006"
static Enter:= "\uE007"
static Shift:= "\uE008"
static Control:= "\uE009"
static Ctrl:= "\uE009"
static Alt:= "\uE00A"
static Pause:= "\uE00B"
static Escape:= "\uE00C"
static Space:= "\uE00D"
static PageUp:= "\uE00E"
static PageDown:= "\uE00F"
static End:= "\uE010"
static Home:= "\uE011"
static ArrowLeft:= "\uE012"
static ArrowUp:= "\uE013"
static ArrowRight:= "\uE014"
static ArrowDown:= "\uE015"
static Insert:= "\uE016"
static Delete:= "\uE017"
static F1:= "\uE031"
static F2:= "\uE032"
static F3:= "\uE033"
static F4:= "\uE034"
static F5:= "\uE035"
static F6:= "\uE036"
static F7:= "\uE037"
static F8:= "\uE038"
static F9:= "\uE039"
static F10:= "\uE03A"
static F11:= "\uE03B"
static F12:= "\uE03C"
static Meta:= "\uE03D"
static ZenkakuHankaku:= "\uE040"
}