selenium-webdriver 0.0.24 → 0.0.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (207) hide show
  1. data/{common/src/rb/CHANGES → CHANGES} +13 -0
  2. data/{common/src/rb/README → README} +1 -1
  3. data/{common/src/rb/lib → lib}/selenium-webdriver.rb +0 -0
  4. data/{common/src/rb/lib → lib}/selenium/webdriver.rb +2 -1
  5. data/{common/src/rb/lib → lib}/selenium/webdriver/bridge_helper.rb +0 -0
  6. data/{common/src/rb/lib → lib}/selenium/webdriver/child_process.rb +0 -0
  7. data/{chrome/src/rb/lib → lib}/selenium/webdriver/chrome.rb +0 -0
  8. data/{chrome/src/rb/lib → lib}/selenium/webdriver/chrome/bridge.rb +2 -2
  9. data/{chrome/src/rb/lib → lib}/selenium/webdriver/chrome/command_executor.rb +0 -0
  10. data/lib/selenium/webdriver/chrome/extension.zip +0 -0
  11. data/{chrome/src/rb/lib → lib}/selenium/webdriver/chrome/launcher.rb +26 -20
  12. data/{common/src/rb/lib → lib}/selenium/webdriver/core_ext/dir.rb +0 -0
  13. data/{common/src/rb/lib → lib}/selenium/webdriver/core_ext/string.rb +0 -0
  14. data/{common/src/rb/lib → lib}/selenium/webdriver/driver.rb +0 -0
  15. data/{common/src/rb/lib → lib}/selenium/webdriver/driver_extensions/takes_screenshot.rb +0 -0
  16. data/{common/src/rb/lib → lib}/selenium/webdriver/element.rb +0 -0
  17. data/{common/src/rb/lib → lib}/selenium/webdriver/error.rb +0 -0
  18. data/{common/src/rb/lib → lib}/selenium/webdriver/file_reaper.rb +2 -1
  19. data/{common/src/rb/lib → lib}/selenium/webdriver/find.rb +0 -0
  20. data/{firefox/src/rb/lib → lib}/selenium/webdriver/firefox.rb +2 -1
  21. data/{firefox/src/rb/lib → lib}/selenium/webdriver/firefox/binary.rb +32 -6
  22. data/{firefox/src/rb/lib → lib}/selenium/webdriver/firefox/bridge.rb +0 -0
  23. data/lib/selenium/webdriver/firefox/extension/webdriver.xpi +0 -0
  24. data/{firefox/src/rb/lib → lib}/selenium/webdriver/firefox/launcher.rb +0 -0
  25. data/lib/selenium/webdriver/firefox/native/linux/amd64/x_ignore_nofocus.so +0 -0
  26. data/lib/selenium/webdriver/firefox/native/linux/x86/x_ignore_nofocus.so +0 -0
  27. data/{firefox/src/rb/lib → lib}/selenium/webdriver/firefox/profile.rb +37 -72
  28. data/{firefox/src/rb/lib → lib}/selenium/webdriver/firefox/profiles_ini.rb +0 -0
  29. data/{firefox/src/rb/lib → lib}/selenium/webdriver/firefox/util.rb +0 -0
  30. data/{jobbie/src/rb/lib → lib}/selenium/webdriver/ie.rb +2 -2
  31. data/{jobbie/src/rb/lib → lib}/selenium/webdriver/ie/bridge.rb +7 -2
  32. data/{jobbie/src/rb/lib → lib}/selenium/webdriver/ie/lib.rb +0 -0
  33. data/{jobbie/prebuilt/Win32/Release → lib/selenium/webdriver/ie/native/win32}/InternetExplorerDriver.dll +0 -0
  34. data/lib/selenium/webdriver/ie/native/x64/InternetExplorerDriver.dll +0 -0
  35. data/{jobbie/src/rb/lib → lib}/selenium/webdriver/ie/util.rb +0 -0
  36. data/{common/src/rb/lib → lib}/selenium/webdriver/keys.rb +0 -0
  37. data/{common/src/rb/lib → lib}/selenium/webdriver/navigation.rb +0 -0
  38. data/{common/src/rb/lib → lib}/selenium/webdriver/options.rb +0 -0
  39. data/{common/src/rb/lib → lib}/selenium/webdriver/platform.rb +5 -1
  40. data/{remote/client/src/rb/lib → lib}/selenium/webdriver/remote.rb +0 -0
  41. data/{remote/client/src/rb/lib → lib}/selenium/webdriver/remote/bridge.rb +0 -0
  42. data/{remote/client/src/rb/lib → lib}/selenium/webdriver/remote/capabilities.rb +0 -0
  43. data/{remote/client/src/rb/lib → lib}/selenium/webdriver/remote/commands.rb +0 -0
  44. data/{remote/client/src/rb/lib → lib}/selenium/webdriver/remote/http/common.rb +0 -0
  45. data/{remote/client/src/rb/lib → lib}/selenium/webdriver/remote/http/curb.rb +0 -0
  46. data/{remote/client/src/rb/lib → lib}/selenium/webdriver/remote/http/default.rb +5 -1
  47. data/{remote/client/src/rb/lib → lib}/selenium/webdriver/remote/response.rb +0 -0
  48. data/{remote/client/src/rb/lib → lib}/selenium/webdriver/remote/server_error.rb +0 -0
  49. data/{common/src/rb/lib → lib}/selenium/webdriver/target_locator.rb +0 -0
  50. data/{common/src/rb/lib → lib}/selenium/webdriver/timeouts.rb +0 -0
  51. data/lib/selenium/webdriver/zip_helper.rb +30 -0
  52. metadata +73 -214
  53. data/COPYING +0 -204
  54. data/chrome/prebuilt/Win32/Release/npchromedriver.dll +0 -0
  55. data/chrome/prebuilt/x64/Release/npchromedriver.dll +0 -0
  56. data/chrome/src/extension/background.html +0 -9
  57. data/chrome/src/extension/background.js +0 -1029
  58. data/chrome/src/extension/content_script.js +0 -1488
  59. data/chrome/src/extension/icons/busy.png +0 -0
  60. data/chrome/src/extension/icons/free.png +0 -0
  61. data/chrome/src/extension/manifest-nonwin.json +0 -19
  62. data/chrome/src/extension/manifest-win.json +0 -20
  63. data/chrome/src/extension/utils.js +0 -231
  64. data/common/src/js/abstractcommandprocessor.js +0 -132
  65. data/common/src/js/asserts.js +0 -296
  66. data/common/src/js/by.js +0 -149
  67. data/common/src/js/command.js +0 -380
  68. data/common/src/js/core/Blank.html +0 -7
  69. data/common/src/js/core/InjectedRemoteRunner.html +0 -8
  70. data/common/src/js/core/RemoteRunner.html +0 -101
  71. data/common/src/js/core/SeleniumLog.html +0 -109
  72. data/common/src/js/core/TestPrompt.html +0 -145
  73. data/common/src/js/core/TestRunner-splash.html +0 -55
  74. data/common/src/js/core/TestRunner.html +0 -165
  75. data/common/src/js/core/icons/all.png +0 -0
  76. data/common/src/js/core/icons/continue.png +0 -0
  77. data/common/src/js/core/icons/continue_disabled.png +0 -0
  78. data/common/src/js/core/icons/pause.png +0 -0
  79. data/common/src/js/core/icons/pause_disabled.png +0 -0
  80. data/common/src/js/core/icons/selected.png +0 -0
  81. data/common/src/js/core/icons/step.png +0 -0
  82. data/common/src/js/core/icons/step_disabled.png +0 -0
  83. data/common/src/js/core/lib/cssQuery/cssQuery-p.js +0 -6
  84. data/common/src/js/core/lib/cssQuery/src/cssQuery-level2.js +0 -142
  85. data/common/src/js/core/lib/cssQuery/src/cssQuery-level3.js +0 -150
  86. data/common/src/js/core/lib/cssQuery/src/cssQuery-standard.js +0 -53
  87. data/common/src/js/core/lib/cssQuery/src/cssQuery.js +0 -356
  88. data/common/src/js/core/lib/prototype.js +0 -2006
  89. data/common/src/js/core/lib/scriptaculous/builder.js +0 -101
  90. data/common/src/js/core/lib/scriptaculous/controls.js +0 -815
  91. data/common/src/js/core/lib/scriptaculous/dragdrop.js +0 -915
  92. data/common/src/js/core/lib/scriptaculous/effects.js +0 -958
  93. data/common/src/js/core/lib/scriptaculous/scriptaculous.js +0 -47
  94. data/common/src/js/core/lib/scriptaculous/slider.js +0 -283
  95. data/common/src/js/core/lib/scriptaculous/unittest.js +0 -383
  96. data/common/src/js/core/lib/snapsie.js +0 -91
  97. data/common/src/js/core/scripts/find_matching_child.js +0 -69
  98. data/common/src/js/core/scripts/htmlutils.js +0 -8716
  99. data/common/src/js/core/scripts/injection.html +0 -72
  100. data/common/src/js/core/scripts/selenium-api.js +0 -3291
  101. data/common/src/js/core/scripts/selenium-browserbot.js +0 -2457
  102. data/common/src/js/core/scripts/selenium-browserdetect.js +0 -153
  103. data/common/src/js/core/scripts/selenium-commandhandlers.js +0 -379
  104. data/common/src/js/core/scripts/selenium-executionloop.js +0 -175
  105. data/common/src/js/core/scripts/selenium-logging.js +0 -148
  106. data/common/src/js/core/scripts/selenium-remoterunner.js +0 -695
  107. data/common/src/js/core/scripts/selenium-testrunner.js +0 -1362
  108. data/common/src/js/core/scripts/selenium-version.js +0 -5
  109. data/common/src/js/core/scripts/ui-doc.html +0 -808
  110. data/common/src/js/core/scripts/ui-element.js +0 -1644
  111. data/common/src/js/core/scripts/ui-map-sample.js +0 -979
  112. data/common/src/js/core/scripts/user-extensions.js +0 -3
  113. data/common/src/js/core/scripts/user-extensions.js.sample +0 -75
  114. data/common/src/js/core/scripts/xmlextras.js +0 -153
  115. data/common/src/js/core/selenium-logo.png +0 -0
  116. data/common/src/js/core/selenium-test.css +0 -43
  117. data/common/src/js/core/selenium.css +0 -316
  118. data/common/src/js/core/xpath/dom.js +0 -566
  119. data/common/src/js/core/xpath/javascript-xpath-0.1.11.js +0 -2816
  120. data/common/src/js/core/xpath/util.js +0 -549
  121. data/common/src/js/core/xpath/xmltoken.js +0 -149
  122. data/common/src/js/core/xpath/xpath.js +0 -2481
  123. data/common/src/js/extension/README +0 -2
  124. data/common/src/js/extension/dommessenger.js +0 -152
  125. data/common/src/js/factory.js +0 -55
  126. data/common/src/js/future.js +0 -141
  127. data/common/src/js/jsunit.js +0 -40
  128. data/common/src/js/jsunit/app/css/jsUnitStyle.css +0 -50
  129. data/common/src/js/jsunit/app/css/readme +0 -10
  130. data/common/src/js/jsunit/app/emptyPage.html +0 -11
  131. data/common/src/js/jsunit/app/jsUnitCore.js +0 -534
  132. data/common/src/js/jsunit/app/jsUnitMockTimeout.js +0 -81
  133. data/common/src/js/jsunit/app/jsUnitTestManager.js +0 -705
  134. data/common/src/js/jsunit/app/jsUnitTestSuite.js +0 -44
  135. data/common/src/js/jsunit/app/jsUnitTracer.js +0 -102
  136. data/common/src/js/jsunit/app/jsUnitVersionCheck.js +0 -59
  137. data/common/src/js/jsunit/app/main-counts-errors.html +0 -12
  138. data/common/src/js/jsunit/app/main-counts-failures.html +0 -13
  139. data/common/src/js/jsunit/app/main-counts-runs.html +0 -13
  140. data/common/src/js/jsunit/app/main-counts.html +0 -21
  141. data/common/src/js/jsunit/app/main-data.html +0 -178
  142. data/common/src/js/jsunit/app/main-errors.html +0 -23
  143. data/common/src/js/jsunit/app/main-frame.html +0 -19
  144. data/common/src/js/jsunit/app/main-loader.html +0 -45
  145. data/common/src/js/jsunit/app/main-progress.html +0 -25
  146. data/common/src/js/jsunit/app/main-results.html +0 -67
  147. data/common/src/js/jsunit/app/main-status.html +0 -13
  148. data/common/src/js/jsunit/app/testContainer.html +0 -16
  149. data/common/src/js/jsunit/app/testContainerController.html +0 -77
  150. data/common/src/js/jsunit/app/xbDebug.js +0 -306
  151. data/common/src/js/jsunit/changelog.txt +0 -60
  152. data/common/src/js/jsunit/css/jsUnitStyle.css +0 -83
  153. data/common/src/js/jsunit/images/green.gif +0 -0
  154. data/common/src/js/jsunit/images/logo_jsunit.gif +0 -0
  155. data/common/src/js/jsunit/images/powerby-transparent.gif +0 -0
  156. data/common/src/js/jsunit/images/red.gif +0 -0
  157. data/common/src/js/jsunit/licenses/JDOM_license.txt +0 -56
  158. data/common/src/js/jsunit/licenses/Jetty_license.html +0 -213
  159. data/common/src/js/jsunit/licenses/MPL-1.1.txt +0 -470
  160. data/common/src/js/jsunit/licenses/gpl-2.txt +0 -340
  161. data/common/src/js/jsunit/licenses/index.html +0 -141
  162. data/common/src/js/jsunit/licenses/lgpl-2.1.txt +0 -504
  163. data/common/src/js/jsunit/licenses/mpl-tri-license-c.txt +0 -35
  164. data/common/src/js/jsunit/licenses/mpl-tri-license-html.txt +0 -35
  165. data/common/src/js/jsunit/readme.txt +0 -19
  166. data/common/src/js/jsunit/testRunner.html +0 -167
  167. data/common/src/js/jsunit/version.txt +0 -1
  168. data/common/src/js/key.js +0 -117
  169. data/common/src/js/localcommandprocessor.js +0 -171
  170. data/common/src/js/testcase.js +0 -219
  171. data/common/src/js/timing.js +0 -89
  172. data/common/src/js/webdriver.js +0 -860
  173. data/common/src/js/webelement.js +0 -483
  174. data/firefox/prebuilt/Win32/Release/webdriver-firefox.dll +0 -0
  175. data/firefox/prebuilt/amd64/libnoblur64.so +0 -0
  176. data/firefox/prebuilt/i386/libnoblur.so +0 -0
  177. data/firefox/prebuilt/linux/Release/libwebdriver-firefox.so +0 -0
  178. data/firefox/prebuilt/linux64/Release/libwebdriver-firefox.so +0 -0
  179. data/firefox/prebuilt/nsICommandProcessor.xpt +0 -0
  180. data/firefox/prebuilt/nsINativeEvents.xpt +0 -0
  181. data/firefox/prebuilt/nsIResponseHandler.xpt +0 -0
  182. data/firefox/src/extension/chrome.manifest +0 -3
  183. data/firefox/src/extension/components/badCertListener.js +0 -295
  184. data/firefox/src/extension/components/dispatcher.js +0 -495
  185. data/firefox/src/extension/components/driver-component.js +0 -130
  186. data/firefox/src/extension/components/errorcode.js +0 -70
  187. data/firefox/src/extension/components/firefoxDriver.js +0 -831
  188. data/firefox/src/extension/components/json2.js +0 -273
  189. data/firefox/src/extension/components/keytest.html +0 -554
  190. data/firefox/src/extension/components/nsCommandProcessor.js +0 -684
  191. data/firefox/src/extension/components/promptService.js +0 -208
  192. data/firefox/src/extension/components/request.js +0 -219
  193. data/firefox/src/extension/components/response.js +0 -276
  194. data/firefox/src/extension/components/screenshooter.js +0 -81
  195. data/firefox/src/extension/components/session.js +0 -314
  196. data/firefox/src/extension/components/sessionstore.js +0 -226
  197. data/firefox/src/extension/components/socketListener.js +0 -435
  198. data/firefox/src/extension/components/utils.js +0 -1335
  199. data/firefox/src/extension/components/webLoadingListener.js +0 -57
  200. data/firefox/src/extension/components/webdriverserver.js +0 -110
  201. data/firefox/src/extension/components/wrappedElement.js +0 -706
  202. data/firefox/src/extension/content/fxdriver.xul +0 -30
  203. data/firefox/src/extension/content/server.js +0 -95
  204. data/firefox/src/extension/idl/nsICommandProcessor.idl +0 -38
  205. data/firefox/src/extension/idl/nsIResponseHandler.idl +0 -34
  206. data/firefox/src/extension/install.rdf +0 -29
  207. data/jobbie/prebuilt/x64/Release/InternetExplorerDriver.dll +0 -0
@@ -1,19 +0,0 @@
1
- {
2
- "name": "WebDriver",
3
- "version": "1.9.12",
4
- "description": "WebDriver extension for Chrome",
5
- "browser_action": {
6
- "default_title": "WebDriver",
7
- "default_icon": "icons/free.png"
8
- },
9
- "background_page": "background.html",
10
- "content_scripts": [
11
- {
12
- "matches": ["http://*/*", "https://*/*", "file:///*"],
13
- "js": ["utils.js", "content_script.js"],
14
- "run_at": "document_end",
15
- "all_frames": true
16
- }
17
- ],
18
- "permissions": ["http://*/*", "tabs"]
19
- }
@@ -1,20 +0,0 @@
1
- {
2
- "name": "WebDriver",
3
- "version": "1.9.12",
4
- "description": "WebDriver extension for Chrome",
5
- "browser_action": {
6
- "default_title": "WebDriver",
7
- "default_icon": "icons/free.png"
8
- },
9
- "background_page": "background.html",
10
- "content_scripts": [
11
- {
12
- "matches": ["http://*/*", "https://*/*", "file:///*"],
13
- "js": ["utils.js", "content_script.js"],
14
- "run_at": "document_end",
15
- "all_frames": true
16
- }
17
- ],
18
- "plugins": [{"path": "npchromedriver.dll", "public": true}],
19
- "permissions": ["http://*/*", "tabs"]
20
- }
@@ -1,231 +0,0 @@
1
- //Very cut-down and slightly modified (generally to remove context) from
2
- //$WEBDRIVER_HOME/firefox/src/extension/components/utils.js
3
-
4
- function Utils() {
5
- }
6
-
7
- function getTextFromNode(node, toReturn, textSoFar, isPreformatted) {
8
- if (node['tagName'] && node.tagName == "SCRIPT") {
9
- return [toReturn, textSoFar];
10
- } else if (node['tagName'] && node.tagName == "TITLE") {
11
- return [textSoFar + node.text, ""];
12
- }
13
- var children = node.childNodes;
14
-
15
- for (var i = 0; i < children.length; i++) {
16
- var child = children[i];
17
-
18
- // Do we need to collapse the text so far?
19
- if (child["tagName"] && child.tagName == "PRE") {
20
- toReturn += collapseWhitespace(textSoFar);
21
- textSoFar = "";
22
- var bits = getTextFromNode(child, toReturn, "", true);
23
- toReturn += bits[1];
24
- continue;
25
- }
26
-
27
- // Or is this just plain text?
28
- if (child.nodeName == "#text") {
29
- if (Utils.isDisplayed(child)) {
30
- var textToAdd = child.nodeValue;
31
- textToAdd = textToAdd.replace(new RegExp(String.fromCharCode(160), "gm"), " ");
32
- textSoFar += textToAdd;
33
- }
34
- continue;
35
- }
36
-
37
- // Treat as another child node.
38
- var bits = getTextFromNode(child, toReturn, textSoFar, false);
39
- toReturn = bits[0];
40
- textSoFar = bits[1];
41
- }
42
-
43
- if (isBlockLevel(node)) {
44
- if (node["tagName"] && node.tagName != "PRE") {
45
- toReturn += collapseWhitespace(textSoFar) + "\n";
46
- textSoFar = "";
47
- } else {
48
- toReturn += "\n";
49
- }
50
- }
51
- return [toReturn, textSoFar];
52
- }
53
- ;
54
-
55
- function isBlockLevel(node) {
56
- if (node["tagName"] && node.tagName == "BR")
57
- return true;
58
-
59
- try {
60
- // Should we think about getting hold of the current document?
61
- return "block" == Utils.getStyleProperty(node, "display");
62
- } catch (e) {
63
- return false;
64
- }
65
- };
66
-
67
- Utils.isInHead = function(element) {
68
- while (element) {
69
- if (element.tagName && element.tagName.toLowerCase() == "head") {
70
- return true;
71
- }
72
- try {
73
- element = element.parentNode;
74
- } catch (e) {
75
- // Fine. the DOM has dispeared from underneath us
76
- return false;
77
- }
78
- }
79
-
80
- return false;
81
- };
82
-
83
- Utils.isDisplayed = function(element) {
84
- // Ensure that we're dealing with an element.
85
- var el = element;
86
- while (el.nodeType != 1 && !(el.nodeType >= 9 && el.nodeType <= 11)) {
87
- el = el.parentNode;
88
- }
89
-
90
- // Hidden input elements are, by definition, never displayed
91
- if (el.tagName == "input" && el.type == "hidden") {
92
- return false;
93
- }
94
-
95
- var visibility = Utils.getStyleProperty(el, "visibility");
96
-
97
- var _isDisplayed = function(e) {
98
- var display = e.ownerDocument.defaultView.getComputedStyle(e, null).getPropertyValue("display");
99
- if (display == "none") return display;
100
- if (e && e.parentNode && e.parentNode.style) {
101
- return _isDisplayed(e.parentNode);
102
- }
103
- return undefined;
104
- };
105
-
106
- var displayed = _isDisplayed(el);
107
-
108
- if (element.scrollIntoView && element.getBoundingClientRect &&
109
- element.tagName.toLowerCase() != "option") {
110
- //Option tags have 0-dimension bounding rects so ignore them
111
- element.scrollIntoView(true);
112
- var clientRect = element.getBoundingClientRect();
113
- if (clientRect.width == 0 || clientRect.height == 0) {
114
- return false;
115
- }
116
- }
117
-
118
- return displayed != "none" && visibility != "hidden";
119
- };
120
-
121
- Utils.getStyleProperty = function(node, propertyName) {
122
- if (!node)
123
- return undefined;
124
-
125
- var value = node.ownerDocument.defaultView.getComputedStyle(node, null).getPropertyValue(propertyName);
126
-
127
- // Convert colours to hex if possible
128
- var raw = /rgb\((\d{1,3}),\s(\d{1,3}),\s(\d{1,3})\)/.exec(value);
129
- if (raw) {
130
- var temp = value.substr(0, raw.index);
131
-
132
- var hex = "#";
133
- for (var i = 1; i <= 3; i++) {
134
- var colour = (raw[i] - 0).toString(16);
135
- if (colour.length == 1)
136
- colour = "0" + colour;
137
- hex += colour
138
- }
139
- hex = hex.toLowerCase();
140
- value = temp + hex + value.substr(raw.index + raw[0].length);
141
- }
142
-
143
- if (value == "inherit" && element.parentNode.style) {
144
- value = Utils.getStyleProperty(node.parentNode, propertyName);
145
- }
146
-
147
- return value;
148
- };
149
-
150
- function collapseWhitespace(textSoFar) {
151
- return textSoFar.replace(/\s+/g, " ");
152
- }
153
-
154
- function getPreformattedText(node) {
155
- var textToAdd = "";
156
- return getTextFromNode(node, "", textToAdd, true)[1];
157
- }
158
-
159
- function isWhiteSpace(character) {
160
- return character == '\n' || character == ' ' || character == '\t' || character == '\r';
161
- }
162
-
163
- Utils.getText = function(element) {
164
- var bits = getTextFromNode(element, "", "", element.tagName == "PRE");
165
- var text = bits[0] + collapseWhitespace(bits[1]);
166
- var start = 0;
167
- while (start < text.length && isWhiteSpace(text[start])) {
168
- ++start;
169
- }
170
- var end = text.length;
171
- while (end > start && isWhiteSpace(text[end - 1])) {
172
- --end;
173
- }
174
- return text.slice(start, end);
175
- };
176
-
177
- /**
178
- * Fires the event using Utils.fireEvent, and if the event returned true,
179
- * perform callback, which will be passed on arguments
180
- */
181
- Utils.fireHtmlEventAndConditionallyPerformAction = function(element, eventName, callback) {
182
- Utils.fireHtmlEvent(element, eventName, function(evt) { if (JSON.parse(evt.newValue).value) { callback(); } });
183
- };
184
-
185
- Utils.fireHtmlEvent = function(element, eventName, callback) {
186
- if (callback === undefined) {
187
- callback = function() {};
188
- }
189
- var args = [
190
- {"ELEMENT": addElementToInternalArray(element)},
191
- eventName
192
- ];
193
-
194
- // We need to do this because event handlers refer to functions that
195
- // the content script can't reah. See:
196
- // http://code.google.com/p/chromium/issues/detail?id=29071
197
- var script = "var e = document.createEvent('HTMLEvents'); "
198
- + "e.initEvent(arguments[1], true, true); "
199
- + "return arguments[0].dispatchEvent(e);";
200
-
201
- execute_(script, args, callback);
202
- };
203
-
204
-
205
- Utils.fireMouseEventOn = function(element, eventName) {
206
- Utils.triggerMouseEvent(element, eventName, 0, 0);
207
- };
208
-
209
- Utils.triggerMouseEvent = function(element, eventType, clientX, clientY) {
210
- var args = [
211
- {"ELEMENT": addElementToInternalArray(element)},
212
- eventType,
213
- clientX,
214
- clientY
215
- ];
216
-
217
- // We need to do this because event handlers refer to functions that
218
- // the content script can't reah. See:
219
- // http://code.google.com/p/chromium/issues/detail?id=29071
220
- var script =
221
- "var event = arguments[0].ownerDocument.createEvent('MouseEvents'); "
222
- + "var view = arguments[0].ownerDocument.defaultView; "
223
- + "event.initMouseEvent(arguments[1], true, true, view, 1, 0, 0, arguments[2], arguments[3], false, false, false, false, 0, arguments[0]);"
224
- + " arguments[0].dispatchEvent(event);";
225
-
226
- execute_(script, args, function(){});
227
- };
228
-
229
- Utils.trim = function(str) {
230
- return str.replace(/^\s*/, "").replace(/\s*$/, "");
231
- };
@@ -1,132 +0,0 @@
1
- /** @license
2
- Copyright 2007-2009 WebDriver committers
3
- Copyright 2007-2009 Google Inc.
4
-
5
- Licensed under the Apache License, Version 2.0 (the "License");
6
- you may not use this file except in compliance with the License.
7
- You may obtain a copy of the License at
8
-
9
- http://www.apache.org/licenses/LICENSE-2.0
10
-
11
- Unless required by applicable law or agreed to in writing, software
12
- distributed under the License is distributed on an "AS IS" BASIS,
13
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- See the License for the specific language governing permissions and
15
- limitations under the License.
16
- */
17
-
18
- /**
19
- * @fileoverview Base class for all WebDriver command processors.
20
- * @author jmleyba@gmail.com (Jason Leyba)
21
- */
22
-
23
- goog.provide('webdriver.AbstractCommandProcessor');
24
-
25
- goog.require('goog.Disposable');
26
- goog.require('goog.array');
27
- goog.require('goog.object');
28
- goog.require('webdriver.CommandName');
29
- goog.require('webdriver.Future');
30
- goog.require('webdriver.Response');
31
- goog.require('webdriver.Response.Code');
32
- goog.require('webdriver.WebElement');
33
- goog.require('webdriver.timing');
34
-
35
-
36
- /**
37
- * Base class for all WebDriver command processors.
38
- * @constructor
39
- * @extends {goog.Disposable}
40
- */
41
- webdriver.AbstractCommandProcessor = function() {
42
- goog.Disposable.call(this);
43
- };
44
- goog.inherits(webdriver.AbstractCommandProcessor, goog.Disposable);
45
-
46
-
47
- /**
48
- * Updates a {@code webdriver.Command} instance so that any parameters that
49
- * are {@code webdriver.Future} values are converted to their asynchronously set
50
- * values.
51
- * @param {webdriver.Command} command The command object to modify.
52
- * @throws If an attempt is made to fetch the value of a
53
- * {@code webdriver.Future} that hasn't been computed yet.
54
- * @private
55
- */
56
- webdriver.AbstractCommandProcessor.resolveFutureParams_ = function(
57
- command) {
58
- function getValue(obj) {
59
- if (obj instanceof webdriver.Future) {
60
- return obj.getValue();
61
- } else if (goog.isFunction(obj) ||
62
- obj instanceof webdriver.WebElement) {
63
- return obj;
64
- } else if (goog.isObject(obj)) {
65
- goog.object.forEach(obj, function(value, key) {
66
- if (value instanceof webdriver.Future) {
67
- obj[key] = getValue(value);
68
- }
69
- });
70
- }
71
- return obj;
72
- }
73
-
74
- command.parameters = goog.object.map(command.parameters, function(param) {
75
- if (goog.isArray(param)) {
76
- return goog.array.map(param, getValue);
77
- } else {
78
- return getValue(param);
79
- }
80
- });
81
- };
82
-
83
-
84
- /**
85
- * Executes a command.
86
- * @param {webdriver.Command} command The command to execute.
87
- */
88
- webdriver.AbstractCommandProcessor.prototype.execute = function(command) {
89
- var driver = command.getDriver();
90
- webdriver.AbstractCommandProcessor.resolveFutureParams_(command);
91
- var parameters = command.getParameters();
92
- switch (command.getName()) {
93
- case webdriver.CommandName.SLEEP:
94
- var ms = parameters['ms'];
95
- webdriver.timing.setTimeout(function() {
96
- command.setResponse(new webdriver.Response(
97
- webdriver.Response.Code.SUCCESS, ms));
98
- }, ms);
99
- break;
100
-
101
- case webdriver.CommandName.WAIT:
102
- case webdriver.CommandName.FUNCTION:
103
- try {
104
- var result = parameters['function'].apply(null, parameters['args']);
105
- command.setResponse(new webdriver.Response(
106
- webdriver.Response.Code.SUCCESS, result));
107
- } catch (ex) {
108
- command.setResponse(new webdriver.Response(
109
- webdriver.Response.Code.UNHANDLED_ERROR, ex));
110
- }
111
- break;
112
-
113
- default:
114
- try {
115
- this.dispatchDriverCommand(command);
116
- } catch (ex) {
117
- command.setResponse(new webdriver.Response(
118
- webdriver.Response.Code.UNHANDLED_ERROR, ex));
119
- }
120
- break;
121
- }
122
- };
123
-
124
-
125
- /**
126
- * Sends a command to be executed by a browser driver. This method must be
127
- * implemented by each subclass.
128
- * @param {webdriver.Command} command The command to execute.
129
- * @protected
130
- */
131
- webdriver.AbstractCommandProcessor.prototype.dispatchDriverCommand =
132
- goog.abstractMethod;
@@ -1,296 +0,0 @@
1
- /** @license
2
- Copyright 2007-2009 WebDriver committers
3
- Copyright 2007-2009 Google Inc.
4
-
5
- Licensed under the Apache License, Version 2.0 (the "License");
6
- you may not use this file except in compliance with the License.
7
- You may obtain a copy of the License at
8
-
9
- http://www.apache.org/licenses/LICENSE-2.0
10
-
11
- Unless required by applicable law or agreed to in writing, software
12
- distributed under the License is distributed on an "AS IS" BASIS,
13
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- See the License for the specific language governing permissions and
15
- limitations under the License.
16
- */
17
-
18
- /**
19
- * @fileoverview Assertion functions for use in webdriver test cases.
20
- * @author jmleyba@gmail.com (Jason Leyba)
21
- */
22
-
23
- goog.provide('webdriver.asserts');
24
-
25
- goog.require('goog.math.Coordinate');
26
- goog.require('goog.string');
27
- goog.require('webdriver.Future');
28
-
29
-
30
- /**
31
- * @param {webdriver.Future|Object} obj The object to get the value form.
32
- * @return {*} The value of the given object.
33
- */
34
- webdriver.asserts.getValue_ = function(obj) {
35
- return obj instanceof webdriver.Future ? obj.getValue() : obj;
36
- };
37
-
38
-
39
- /**
40
- * Returns a string with the following format: "<$value> ($type)" where $value
41
- * is the String representation of the {@code obj} and $type is its type.
42
- * @param {*} obj The object to build a string for.
43
- * @return {string} A string describing the given object.
44
- */
45
- webdriver.asserts.objToString = function(obj) {
46
- var value = webdriver.asserts.getValue_(obj);
47
- var valueStr = goog.isDef(value) ? String(value) : 'undefined';
48
- return '<' + valueStr + '> (' + goog.typeOf(value) + ')';
49
- };
50
-
51
-
52
- /**
53
- * A class for determining if a value matches a defined criteria.
54
- * @param {function} matchFn A function that takes a single argument and whether
55
- * that argument matches the criteria defined by this Matcher.
56
- * @param {function} describeFn A function that returns a string describing the
57
- * criteria for this matcher. The string returned by this function should
58
- * finish this sentence: "Expected to..."
59
- * @constructor
60
- */
61
- webdriver.asserts.Matcher = function(matchFn, describeFn) {
62
- this.matches = matchFn;
63
- this.describe = describeFn;
64
- };
65
-
66
-
67
- /**
68
- * Factory method for a {@code webdriver.asserts.Matcher} that does a
69
- * {@code ===} comparison between the expected and actual values.
70
- * @param {*} expected The expected value.
71
- * @return {webdriver.asserts.Matcher} An equality matcher.
72
- */
73
- webdriver.asserts.Matcher.equals = function(expected) {
74
- return new webdriver.asserts.Matcher(
75
- function (actual) {
76
- return webdriver.asserts.getValue_(expected) ===
77
- webdriver.asserts.getValue_(actual);
78
- },
79
- function () {
80
- return 'equal ' + webdriver.asserts.objToString(expected);
81
- });
82
- };
83
- goog.exportSymbol('equals', webdriver.asserts.Matcher.equals);
84
- goog.exportSymbol('is', webdriver.asserts.Matcher.equals);
85
-
86
-
87
- /**
88
- * Creates a {@code webdriver.asserts.Matcher} that tests if the actual
89
- * value contains the expected value.
90
- * @param {string} expected The string expected to be in the actual value.
91
- * @return {webdriver.asserts.Matcher} A new matcher.
92
- */
93
- webdriver.asserts.Matcher.contains = function(expected) {
94
- return new webdriver.asserts.Matcher(
95
- function (actual) {
96
- var ev = webdriver.asserts.getValue_(expected);
97
- var av = webdriver.asserts.getValue_(actual);
98
- return goog.string.contains(av, ev);
99
- },
100
- function () {
101
- return 'contain ' + webdriver.asserts.objToString(expected);
102
- });
103
- };
104
- goog.exportSymbol('contains', webdriver.asserts.Matcher.contains);
105
-
106
-
107
- /**
108
- * Creates a {@code webdriver.asserts.Matcher} that tests if the actual value
109
- * matches the given regular expression.
110
- * @param {RegEx} regex The expected regular expression.
111
- * @return {webdriver.asserts.Matcher} A new matcher.
112
- */
113
- webdriver.asserts.Matcher.matchesRegex = function(regex) {
114
- if (!(regex instanceof RegExp)) {
115
- throw new Error('IllegalArgument; must be a RegExp, but was: ' + regex +
116
- '(' + goog.typeOf(regex) + ')');
117
- }
118
- return new webdriver.asserts.Matcher(
119
- function (actual) {
120
- var av = webdriver.asserts.getValue_(actual);
121
- return av.match(regex) != null;
122
- },
123
- function () {
124
- return 'match regex ' + regex;
125
- });
126
- };
127
- goog.exportSymbol('matchesRegex', webdriver.asserts.Matcher.matchesRegex);
128
-
129
-
130
- /**
131
- * Creates a {@code webdriver.asserts.Matcher} that tests if the actual value
132
- * starts with the given string.
133
- * @param {string} expected The expected beginning of the tested string.
134
- * @return {webdriver.asserts.Matcher} A new matcher.
135
- */
136
- webdriver.asserts.Matcher.startsWith = function(expected) {
137
- return new webdriver.asserts.Matcher(
138
- function (actual) {
139
- var ev = webdriver.asserts.getValue_(expected);
140
- var av = webdriver.asserts.getValue_(actual);
141
- return goog.string.startsWith(av, ev);
142
- },
143
- function () {
144
- return 'start with ' + webdriver.asserts.objToString(expected);
145
- });
146
- };
147
- goog.exportSymbol('startsWith', webdriver.asserts.Matcher.startsWith);
148
-
149
-
150
- /**
151
- * Creates a {@code webdriver.asserts.Matcher} that tests if the actual value is
152
- * the same location as the expected value.
153
- * @param {goog.math.Coordinate} expected The expected location, or a future
154
- * whose pending result is the expected location.
155
- * @return {webdriver.asserts.Matcher} A new matcher.
156
- */
157
- webdriver.asserts.Matcher.isTheSameLocationAs = function(expected) {
158
- return new webdriver.asserts.Matcher(
159
- function (actual) {
160
- var ev = webdriver.asserts.getValue_(expected);
161
- var av = webdriver.asserts.getValue_(actual);
162
- return goog.math.Coordinate.equals(ev, av);
163
- },
164
- function () {
165
- return 'equal ' + webdriver.asserts.objToString(expected);
166
- });
167
- };
168
- goog.exportSymbol('isTheSameLocationAs',
169
- webdriver.asserts.Matcher.isTheSameLocationAs);
170
-
171
-
172
- /**
173
- * Verifies that that given value matches the provided {@code Matcher}. This
174
- * method has two signatures based on the number of arguments:
175
- * Two arguments:
176
- * assertThat(actualValue, matcher)
177
- * Three arguments:
178
- * assertThat(failureMessage, actualValue, matcher)
179
- * @param {string} failureMessage The message to include in the resulting error
180
- * if actualValue does not match matcher.
181
- * @param {webdriver.Future|Object} The actual value to verify.
182
- * @param {webdriver.asserts.Matcher} matcher The object to match the actual
183
- * value against. If not an instanceof {@code webdriver.Matcher}, will
184
- * default to the matcher returned by the {@code webdriver.equals} factory
185
- * function.
186
- */
187
- webdriver.asserts.assertThat = function(a, b, opt_c) {
188
- var args = goog.array.slice(arguments, 0);
189
- var message = args.length > 2 ? (args[0] + '\n') : '';
190
- var future = args.length > 2 ? args[1] : args[0];
191
-
192
- var matcher = args.length > 2 ? args[2] : args[1];
193
- if (!(matcher instanceof webdriver.asserts.Matcher)) {
194
- matcher = webdriver.asserts.Matcher.equals(matcher);
195
- }
196
-
197
- var doAssertion = function() {
198
- if (!matcher.matches(future)) {
199
- throw new Error(message +
200
- 'Expected to ' + matcher.describe() +
201
- '\n but was ' + webdriver.asserts.objToString(future));
202
- }
203
- };
204
-
205
- if (future instanceof webdriver.Future) {
206
- // Schedule a function with the Future's controlling driver so the value
207
- // is verified after it has been set.
208
- future.getDriver().callFunction(doAssertion);
209
- } else {
210
- doAssertion();
211
- }
212
- };
213
- goog.exportSymbol('assertThat', webdriver.asserts.assertThat);
214
-
215
-
216
- // ----------------------------------------------------------------------------
217
- // Define some common xUnit paradigm assertion functions, but do not override
218
- // any pre-existing function (e.g. if the jsapi is being used with the jsunit
219
- // library.
220
- // ----------------------------------------------------------------------------
221
-
222
- goog.global.fail = goog.global.fail || function(opt_msg) {
223
- var msg = 'Call to fail()';
224
- if (opt_msg) {
225
- msg += ': ' + opt_msg;
226
- }
227
- throw new Error(msg);
228
- };
229
-
230
-
231
- goog.global.assertEquals = goog.global.assertEquals || function(a, b, opt_c) {
232
- var args = goog.array.slice(arguments, 0);
233
- var msg = args.length > 2 ? args[0] : '';
234
- var expected = args.length > 2 ? args[1] : args[0];
235
- var actual = args.length > 2 ? args[2] : args[1];
236
- if (expected !== actual) {
237
- webdriver.asserts.assertThat(msg, actual, equals(expected));
238
- }
239
- };
240
-
241
-
242
- goog.global.assertTrue = goog.global.assertTrue || function(a, opt_b) {
243
- var args = goog.array.slice(arguments, 0);
244
- if (args.length > 1) {
245
- goog.global.assertEquals(args[0], true, args[1]);
246
- } else {
247
- goog.global.assertEquals(true, args[0]);
248
- }
249
- };
250
-
251
-
252
- goog.global.assertFalse = goog.global.assertFalse || function(a, opt_b) {
253
- var args = goog.array.slice(arguments, 0);
254
- if (args.length > 1) {
255
- goog.global.assertEquals(args[0], false, args[1]);
256
- } else {
257
- goog.global.assertEquals(false, args[0]);
258
- }
259
- };
260
-
261
-
262
- /**
263
- * Utility function for inverting a value. If the input is a...
264
- * <ul>
265
- * <li>{@code webdriver.asserts.Matcher}, returns a new Matcher that inverts
266
- * the result of the input</li>
267
- * <li>{@code webdriver.Future}, returns a new Future whose result will be the
268
- * inverse of hte input</li>
269
- * <li>any other type of object, it will be converted to a boolean and
270
- * inverted</li>
271
- * </ul>
272
- * @param {*) input The value to invert.
273
- * @return {webdriver.asserts.Matcher|webdriver.Future|boolean} The inverted
274
- * value according to the rules defined above.
275
- */
276
- webdriver.not = function(input) {
277
- if (input instanceof webdriver.Future) {
278
- var invertedFuture = new webdriver.Future(input.getDriver());
279
- goog.events.listen(input, goog.events.EventType.CHANGE,
280
- function() {
281
- invertedFuture.setValue(!!!input.getValue());
282
- });
283
- return invertedFuture;
284
- } else if (input instanceof webdriver.asserts.Matcher) {
285
- return new webdriver.asserts.Matcher(
286
- function (actual) {
287
- return !input.matches(actual);
288
- },
289
- function () {
290
- return 'not ' + input.describe();
291
- });
292
- } else {
293
- return !!!value;
294
- }
295
- };
296
- goog.exportSymbol('not', webdriver.not);