forked from angel-popov/cl-selenium-webdriver
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathkeys.lisp
80 lines (73 loc) · 1.71 KB
/
keys.lisp
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
(in-package :webdriver-client)
;; TODO: make constant?
(defvar *keymap*
'(:null #\ue000
:cancel #\ue001
:help #\ue002
:backspace #\ue003
:tab #\ue004
:clear #\ue005
:return #\ue006
:enter #\ue007
:shift #\ue008
:control #\ue009
:alt #\ue00a
:pause #\ue00b
:escape #\ue00c
:space #\ue00d
:page-up #\ue00e
:page-down #\ue00f
:end #\ue010
:home #\ue011
:left-arrow #\ue012
:up-arrow #\ue013
:right-arrow #\ue014
:down-arrow #\ue015
:insert #\ue016
:delete #\ue017
:semicolon #\ue018
:equals #\ue019
:numpad-0 #\ue01a
:numpad-1 #\ue01b
:numpad-2 #\ue01c
:numpad-3 #\ue01d
:numpad-4 #\ue01e
:numpad-5 #\ue01f
:numpad-6 #\ue020
:numpad-7 #\ue021
:numpad-8 #\ue022
:numpad-9 #\ue023
:multiply #\ue024
:add #\ue025
:separator #\ue026
:substract #\ue027
:decimal #\ue028
:divide #\ue029
:f1 #\ue031
:f2 #\ue032
:f3 #\ue033
:f4 #\ue034
:f5 #\ue035
:f6 #\ue036
:f7 #\ue037
:f8 #\ue038
:f9 #\ue039
:f10 #\ue03a
:f11 #\ue03b
:f12 #\ue03c
:meta #\ue03d)
"See https://www.w3.org/TR/webdriver1/#keyboard-actions")
;; TODO: prepare all keys on compile
(defun key (key)
"Returns a string with KEY's codepoint.
Category: Actions
See: https://www.w3.org/TR/webdriver/#keyboard-actions"
(make-string 1 :initial-element (or (getf *keymap* key)
(coerce key 'character))))
(defun keys (&rest keys)
"Returns a string with characters and control keyword charcters in KEYS list.
Example:
(keys :control #\t)
Category: Actions
See: https://www.w3.org/TR/webdriver/#keyboard-actions"
(apply #'concatenate 'string (mapcar 'key keys)))