WDKeys.pm 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. package Selenium::Remote::WDKeys;
  2. # ABSTRACT: Representation of keystrokes used by Selenium::Remote::WebDriver
  3. =head1 DESCRIPTION
  4. The constant KEYS is defined here.
  5. =head1 SYNOPSIS
  6. use Selenium::Remote::WDKeys;
  7. my $space_key = KEYS->{'space'};
  8. my $enter_key = KEYS->{'enter'};
  9. =head1 CONSTANT KEYS
  10. null
  11. cancel
  12. help
  13. backspace
  14. tab
  15. clear
  16. return
  17. enter
  18. shift
  19. control
  20. alt
  21. pause
  22. escape
  23. space
  24. page_up
  25. page_down
  26. end
  27. home
  28. left_arrow
  29. up_arrow
  30. right_arrow
  31. down_arrow
  32. insert
  33. delete
  34. semicolon
  35. equals
  36. numpad_0
  37. numpad_1
  38. numpad_2
  39. numpad_3
  40. numpad_4
  41. numpad_5
  42. numpad_6
  43. numpad_7
  44. numpad_8
  45. numpad_9
  46. multiply
  47. add
  48. separator
  49. subtract
  50. decimal
  51. divide
  52. f1
  53. f2
  54. f3
  55. f4
  56. f5
  57. f6
  58. f7
  59. f8
  60. f9
  61. f10
  62. f11
  63. f12
  64. command_meta
  65. ZenkakuHankaku
  66. =head1 FUNCTIONS
  67. Functions of Selenium::Remote::WDKeys.
  68. =head2 KEYS
  69. my $keys = KEYS();
  70. A hash reference that contains constant keys. This function is exported by default.
  71. =cut
  72. use strict;
  73. use warnings;
  74. use base 'Exporter';
  75. # http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/value
  76. use constant KEYS => {
  77. 'null' => "\N{U+E000}",
  78. 'cancel' => "\N{U+E001}",
  79. 'help' => "\N{U+E002}",
  80. 'backspace' => "\N{U+E003}",
  81. 'tab' => "\N{U+E004}",
  82. 'clear' => "\N{U+E005}",
  83. 'return' => "\N{U+E006}",
  84. 'enter' => "\N{U+E007}",
  85. 'shift' => "\N{U+E008}",
  86. 'control' => "\N{U+E009}",
  87. 'alt' => "\N{U+E00A}",
  88. 'pause' => "\N{U+E00B}",
  89. 'escape' => "\N{U+E00C}",
  90. 'space' => "\N{U+E00D}",
  91. 'page_up' => "\N{U+E00E}",
  92. 'page_down' => "\N{U+E00f}",
  93. 'end' => "\N{U+E010}",
  94. 'home' => "\N{U+E011}",
  95. 'left_arrow' => "\N{U+E012}",
  96. 'up_arrow' => "\N{U+E013}",
  97. 'right_arrow' => "\N{U+E014}",
  98. 'down_arrow' => "\N{U+E015}",
  99. 'insert' => "\N{U+E016}",
  100. 'delete' => "\N{U+E017}",
  101. 'semicolon' => "\N{U+E018}",
  102. 'equals' => "\N{U+E019}",
  103. 'numpad_0' => "\N{U+E01A}",
  104. 'numpad_1' => "\N{U+E01B}",
  105. 'numpad_2' => "\N{U+E01C}",
  106. 'numpad_3' => "\N{U+E01D}",
  107. 'numpad_4' => "\N{U+E01E}",
  108. 'numpad_5' => "\N{U+E01f}",
  109. 'numpad_6' => "\N{U+E020}",
  110. 'numpad_7' => "\N{U+E021}",
  111. 'numpad_8' => "\N{U+E022}",
  112. 'numpad_9' => "\N{U+E023}",
  113. 'multiply' => "\N{U+E024}",
  114. 'add' => "\N{U+E025}",
  115. 'separator' => "\N{U+E026}",
  116. 'subtract' => "\N{U+E027}",
  117. 'decimal' => "\N{U+E028}",
  118. 'divide' => "\N{U+E029}",
  119. 'f1' => "\N{U+E031}",
  120. 'f2' => "\N{U+E032}",
  121. 'f3' => "\N{U+E033}",
  122. 'f4' => "\N{U+E034}",
  123. 'f5' => "\N{U+E035}",
  124. 'f6' => "\N{U+E036}",
  125. 'f7' => "\N{U+E037}",
  126. 'f8' => "\N{U+E038}",
  127. 'f9' => "\N{U+E039}",
  128. 'f10' => "\N{U+E03A}",
  129. 'f11' => "\N{U+E03B}",
  130. 'f12' => "\N{U+E03C}",
  131. 'command_meta' => "\N{U+E03D}",
  132. 'ZenkakuHankaku' => "\N{U+E040}", #Asian language keys, maybe altGr too?
  133. #There are other code points for say, left versus right meta/shift/alt etc, but I don't seriously believe anyone uses that level of sophistication on the web yet.
  134. };
  135. our @EXPORT = ('KEYS');
  136. 1;