selenium-webdriver 0.0.24 → 0.0.25

Sign up to get free protection for your applications and to get access to all the features.
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,483 +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 A class for working with elements on the page under test.
20
- * @author jmleyba@gmail.com (Jason Leyba)
21
- */
22
-
23
- goog.provide('webdriver.WebElement');
24
-
25
- goog.require('goog.array');
26
- goog.require('webdriver.By.Locator');
27
- goog.require('webdriver.By.Strategy');
28
- goog.require('webdriver.CommandName');
29
- goog.require('webdriver.Future');
30
-
31
-
32
- /**
33
- * Represents a DOM element. WebElements can be found by searching from the
34
- * document root using a {@code webdriver.WebDriver}, or by searhcing under
35
- * another {@code webdriver.WebElement}:
36
- *
37
- * driver.get('http://www.google.com');
38
- * var searchForm = driver.findElement({tagName: 'form'});
39
- * var searchBox = searchForm.findElement({name: 'q'});
40
- * searchBox.sendKeys('webdriver');
41
- *
42
- * @param {webdriver.WebDriver} driver The WebDriver instance that will
43
- * actually execute commands.
44
- * @constructor
45
- */
46
- webdriver.WebElement = function(driver) {
47
-
48
- /**
49
- * The WebDriver instance to issue commands to.
50
- * @type {webdriver.WebDriver}
51
- * @private
52
- */
53
- this.driver_ = driver;
54
-
55
- /**
56
- * The UUID used by WebDriver to identify this element on the page. The ID is
57
- * wrapped in a webdriver.Future instance so it can be determined
58
- * asynchronously.
59
- * @type {webdriver.Future}
60
- * @private
61
- */
62
- this.elementId_ = new webdriver.Future(this.driver_);
63
- };
64
-
65
-
66
- /**
67
- * Adds a command to determine if an element is present under this element in
68
- * the DOM tree.
69
- * @param {webdriver.By.Locator|{*: string}} locator The locator to use for
70
- * finding the element, or a short-hand object that can be converted into a
71
- * locator.
72
- * @return {webdriver.Future} A future whose value will be set when the driver
73
- * completes the search; value will be {@code true} if the element was
74
- * found, false otherwise.
75
- * @see webdriver.By.Locator.createFromObj
76
- */
77
- webdriver.WebElement.prototype.isElementPresent = function(locator) {
78
- locator = webdriver.By.Locator.checkLocator(locator);
79
- return this.driver_.callFunction(function() {
80
- var findCommand = this.
81
- createCommand_(webdriver.CommandName.FIND_CHILD_ELEMENT).
82
- setParameter('using', locator.type).
83
- setParameter('value', locator.target);
84
- var commandFailed = false;
85
- var key = goog.events.listenOnce(findCommand,
86
- webdriver.Command.ERROR_EVENT, function(e) {
87
- commandFailed = true;
88
- this.driver_.abortCommand(e.currentTarget);
89
- e.preventDefault();
90
- e.stopPropagation();
91
- return false;
92
- }, /*capture phase*/true, this);
93
- return this.driver_.callFunction(function() {
94
- goog.events.unlistenByKey(key);
95
- return !commandFailed;
96
- });
97
- }, this);
98
- };
99
-
100
-
101
- /**
102
- * Adds a command to search for a single element on the page, restricting the
103
- * search to the descendants of the element represented by this instance.
104
- * @param {webdriver.By.Locator|{*: string}} locator The locator to use for
105
- * finding the element, or a short-hand object that can be converted into a
106
- * locator.
107
- * @return {webdriver.WebElement} A WebElement that can be used to issue
108
- * commands on the found element. The element's ID will be set
109
- * asynchronously once the element is successfully located.
110
- * @see webdriver.By.Locator.createFromObj
111
- */
112
- webdriver.WebElement.prototype.findElement = function(locator) {
113
- var webElement = new webdriver.WebElement(this.driver_);
114
- locator = webdriver.By.Locator.checkLocator(locator);
115
- this.driver_.callFunction(function() {
116
- var command = this.
117
- createCommand_(webdriver.CommandName.FIND_CHILD_ELEMENT).
118
- setParameter('using', locator.type).
119
- setParameter('value', locator.target);
120
- this.driver_.callFunction(function(id) {
121
- webElement.getId().setValue(id['ELEMENT']);
122
- });
123
- }, this);
124
- return webElement;
125
- };
126
-
127
-
128
- /**
129
- * Adds a command to search for multiple elements on the page, restricting the
130
- * search to the descendants of hte element represented by this instance.
131
- * @param {webdriver.By.Locator|{*: string}} locator The locator to use for
132
- * finding the element, or a short-hand object that can be converted into a
133
- * locator.
134
- * @see webdriver.By.Locator.createFromObj
135
- */
136
- webdriver.WebElement.prototype.findElements = function(locator) {
137
- locator = webdriver.By.Locator.checkLocator(locator);
138
- this.driver_.callFunction(function() {
139
- this.createCommand_(webdriver.CommandName.FIND_CHILD_ELEMENTS).
140
- setParameter('using', locator.type).
141
- setParameter('value', locator.target);
142
- return this.driver_.callFunction(function(ids) {
143
- var elements = [];
144
- for (var i = 0; i < ids.length; i++) {
145
- if (ids[i]) {
146
- var element = new webdriver.WebElement(this.driver_);
147
- element.getId().setValue(ids[i]['ELEMENT']);
148
- elements.push(element);
149
- }
150
- }
151
- return elements;
152
- }, this);
153
- }, this);
154
- };
155
-
156
-
157
- /**
158
- * @return {webdriver.WebDriver} The driver that this element delegates commands
159
- * to.
160
- */
161
- webdriver.WebElement.prototype.getDriver = function() {
162
- return this.driver_;
163
- };
164
-
165
-
166
- /**
167
- * @return {webdriver.Futur} The UUID of this element wrapped in a Future.
168
- */
169
- webdriver.WebElement.prototype.getId = function() {
170
- return this.elementId_;
171
- };
172
-
173
-
174
- /**
175
- * Creates a new {@code webdriver.Command} against the element represented by
176
- * this instance.
177
- * @param {string} name The name of the command to create.
178
- * @return {webdriver.Command} The new command.
179
- * @private
180
- */
181
- webdriver.WebElement.prototype.createCommand_ = function(name) {
182
- return this.driver_.addCommand(name).setParameter('id', this.getId());
183
- };
184
-
185
-
186
- /**
187
- * Adds a command to click on this element.
188
- */
189
- webdriver.WebElement.prototype.click = function() {
190
- this.createCommand_(webdriver.CommandName.CLICK_ELEMENT);
191
- };
192
-
193
-
194
- /**
195
- * Types a sequence on the DOM element represented by this instance.
196
- * <p/>
197
- * Modifier keys (SHIFT, CONTROL, ALT, META) are stateful; once a modifier is
198
- * processed in the keysequence, that key state is toggled until one of the
199
- * following occurs:
200
- * <ul>
201
- * <li>The modifier key is encountered again in the sequence. At this point the
202
- * state of the key is toggled (along with the appropriate keyup/down events).
203
- * </li>
204
- * <li>The {@code webdriver.Key.NULL} key is encountered in the sequence. When
205
- * this key is encountered, all modifier keys current in the down state are
206
- * released (with accompanying keyup events). The NULL key can be used to
207
- * simulate common keyboard shortcuts:
208
- * <code>
209
- * element.sendKeys("text was",
210
- * webdriver.Key.CONTROL, "a", webdriver.Key.NULL,
211
- * "now text is");
212
- * // Alternatively:
213
- * element.sendKeys("text was",
214
- * webdriver.Key.chord(webdriver.Key.CONTROL, "a"),
215
- * "now text is");
216
- * </code></li>
217
- * <li>The end of the keysequence is encountered. When there are no more keys
218
- * to type, all depressed modifier keys are released (with accompanying keyup
219
- * events).
220
- * </li>
221
- * </ul>
222
- * If a certain character can only be generated by using the shift key, such as
223
- * uppercase characters or certain punctuation marks, the shift key will be
224
- * applied for that individual key. If the shift key was not depressed before
225
- * typing that key, it will be released after typing the key. If the shift key
226
- * was already depressed, the extra event will not be generated. For example:
227
- * <code>
228
- * // Expect shift down/up for each character.
229
- * element.sendKeys("ABC");
230
- * // Shift is already depressed, so it will not be pushed again for each
231
- * // character.
232
- * element.sendKeys(webdriver.Key.SHIFT, "ABC");
233
- * </code>
234
- * <p/>
235
- * <strong>Note:</strong> On browsers where native keyboard events are not yet
236
- * supported (e.g. Firefox on OS X), key events will be synthesized. Special
237
- * punctionation keys will be synthesized according to a standard QWERTY English
238
- * keyboard layout.
239
- * @param {string|webdriver.Future} var_args The strings to type. All arguments
240
- * will be joined into a single sequence (var_args is permitted for
241
- * convenience).
242
- */
243
- webdriver.WebElement.prototype.sendKeys = function(var_args) {
244
- var command = this.createCommand_(
245
- webdriver.CommandName.SEND_KEYS_TO_ELEMENT);
246
- command.setParameter('value', goog.array.slice(arguments, 0));
247
- };
248
-
249
- /**
250
- * Queries for the tag/node name of this element.
251
- */
252
- webdriver.WebElement.prototype.getTagName = function() {
253
- return this.createCommand_(webdriver.CommandName.GET_ELEMENT_TAG_NAME).
254
- getFutureResult();
255
- };
256
-
257
-
258
- /**
259
- * Queries for the computed style of the element represented by this instance.
260
- * If the element inherits the named style from its parent, the parent will be
261
- * queried for its value. Where possible, color values will be converted to
262
- * their hex representation (#00ff00 instead of rgb(0, 255, 0)).
263
- * <em>Warning:</em> the value returned will be as the browser interprets it, so
264
- * it may be tricky to form a proper assertion.
265
- * @param {string} cssStyleProperty The name of the CSS style property to look
266
- * up.
267
- * @return {webdriver.Future<string>} The computed style property wrapped in a
268
- * Future.
269
- */
270
- webdriver.WebElement.prototype.getComputedStyle = function(cssStyleProperty) {
271
- return this.createCommand_(
272
- webdriver.CommandName.GET_ELEMENT_VALUE_OF_CSS_PROPERTY).
273
- setParameter('propertyName', cssStyleProperty).
274
- getFutureResult();
275
- };
276
-
277
-
278
- /**
279
- * Queries for the specified attribute.
280
- * @param {string} attributeName The name of the attribute to query.
281
- */
282
- webdriver.WebElement.prototype.getAttribute = function(attributeName) {
283
- return this.createCommand_(webdriver.CommandName.GET_ELEMENT_ATTRIBUTE).
284
- setParameter('name', attributeName).
285
- getFutureResult();
286
- };
287
-
288
-
289
- /**
290
- * @return {webdriver.Future} The value attribute for the element represented by
291
- * this instance.
292
- */
293
- webdriver.WebElement.prototype.getValue = function() {
294
- return this.createCommand_(webdriver.CommandName.GET_ELEMENT_VALUE).
295
- getFutureResult();
296
- };
297
-
298
-
299
- /**
300
- * @return {webdriver.Future} The innerText of this element, without any leading
301
- * or trailing whitespace.
302
- */
303
- webdriver.WebElement.prototype.getText = function() {
304
- return this.createCommand_(webdriver.CommandName.GET_ELEMENT_TEXT).
305
- getFutureResult();
306
- };
307
-
308
-
309
- /**
310
- * Selects this element.
311
- */
312
- webdriver.WebElement.prototype.setSelected = function() {
313
- this.createCommand_(webdriver.CommandName.SET_ELEMENT_SELECTED);
314
- };
315
-
316
-
317
- /**
318
- * @return {webdriver.Future} The size of this element.
319
- */
320
- webdriver.WebElement.prototype.getSize = function() {
321
- return this.createCommand_(webdriver.CommandName.GET_ELEMENT_SIZE).
322
- getFutureResult();
323
- };
324
-
325
-
326
- /**
327
- * @return {webdriver.Future} The location of this element.
328
- */
329
- webdriver.WebElement.prototype.getLocation = function() {
330
- return this.createCommand_(webdriver.CommandName.GET_ELEMENT_LOCATION).
331
- getFutureResult();
332
- };
333
-
334
-
335
- /**
336
- * Drags this element by the given offset.
337
- * @param {number} x The horizontal amount, in pixels, to drag this element.
338
- * @param {number} y The vertical amount, in pixels, to drag this element.
339
- * @return {webdriver.Future} The new location of the element.
340
- */
341
- webdriver.WebElement.prototype.dragAndDropBy = function(x, y) {
342
- return this.createCommand_(webdriver.CommandName.DRAG_ELEMENT).
343
- setParameter('x', x).
344
- setParameter('y', y).
345
- getFutureResult();
346
- };
347
-
348
-
349
- /**
350
- * Drags this element to the location of another {@code webElement}. After this
351
- * command executes, this element's upper-left hand corner should be the same
352
- * location as the upper-left hand corner of the given {@code webElement}.
353
- * @param {webdriver.WebElement} webElement The element to drag this element to.
354
- * @return {webdriver.Future} This element's new location.
355
- */
356
- webdriver.WebElement.prototype.dragAndDropTo = function(webElement) {
357
- if (this.driver_ != webElement.driver_) {
358
- throw new Error(
359
- 'WebElements created by different drivers cannot coordinate');
360
- }
361
-
362
- var toLocation = webElement.getLocation();
363
- var thisLocation = this.getLocation();
364
- return this.driver_.callFunction(function() {
365
- var delta = goog.math.Coordinate.difference(
366
- toLocation.getValue(), thisLocation.getValue());
367
- return this.dragAndDropBy(delta.x, delta.y);
368
- }, this);
369
- };
370
-
371
-
372
- /**
373
- * @return {boolean} Whether the DOM element represented by this instance is
374
- * enabled, as dictated by the {@code disabled} attribute.
375
- */
376
- webdriver.WebElement.prototype.isEnabled = function() {
377
- return this.driver_.callFunction(function() {
378
- this.getAttribute('disabled');
379
- return this.driver_.callFunction(function(value) {
380
- return !!!value;
381
- });
382
- }, this);
383
- };
384
-
385
-
386
- /**
387
- * Determines if this element is checked or selected; will generate an error if
388
- * the DOM element represented by this instance is not an OPTION or checkbox
389
- * INPUT element.
390
- * @return {webdriver.Future} Whether this element is checked or selected.
391
- * @private
392
- */
393
- webdriver.WebElement.prototype.isCheckedOrSelected_ = function() {
394
- return this.driver_.callFunction(function() {
395
- this.createCommand_(webdriver.CommandName.GET_ELEMENT_TAG_NAME);
396
- return this.driver_.callFunction(function(prevResult) {
397
- var attribute = prevResult == 'input' ? 'checked' : 'selected';
398
- return this.getAttribute(attribute);
399
- }, this);
400
- }, this);
401
- };
402
-
403
-
404
- /**
405
- * @return {webdriver.Future} Whether this element is selected.
406
- */
407
- webdriver.WebElement.prototype.isSelected = function() {
408
- return this.isCheckedOrSelected_();
409
- };
410
-
411
-
412
- /**
413
- * @return {webdriver.Future} Whether this element is checked.
414
- */
415
- webdriver.WebElement.prototype.isChecked = function() {
416
- return this.isCheckedOrSelected_();
417
- };
418
-
419
-
420
- /**
421
- * Toggles the checked/selected state of this element; will generate an error if
422
- * the DOM element represented by this instance is not an OPTION or checkbox
423
- * input element.
424
- * @return {webdriver.Future} The new checked/selected state of this element.
425
- */
426
- webdriver.WebElement.prototype.toggle = function() {
427
- return this.driver_.callFunction(function() {
428
- this.createCommand_(webdriver.CommandName.TOGGLE_ELEMENT);
429
- return this.isCheckedOrSelected_();
430
- }, this);
431
- };
432
-
433
-
434
- /**
435
- * If this current element is a form, or an element within a form, then this
436
- * will that form.
437
- */
438
- webdriver.WebElement.prototype.submit = function() {
439
- this.createCommand_(webdriver.CommandName.SUBMIT_ELEMENT);
440
- };
441
-
442
-
443
- /**
444
- * If this instance represents a text INPUT element, or a TEXTAREA element, this
445
- * will clear its {@code value}.
446
- */
447
- webdriver.WebElement.prototype.clear = function() {
448
- this.createCommand_(webdriver.CommandName.CLEAR_ELEMENT);
449
- };
450
-
451
-
452
- /**
453
- * @return {webdriver.Future} Whether this element is currently displayed.
454
- */
455
- webdriver.WebElement.prototype.isDisplayed = function() {
456
- return this.createCommand_(webdriver.CommandName.IS_ELEMENT_DISPLAYED).
457
- getFutureResult();
458
- };
459
-
460
-
461
- /**
462
- * @return {webdriver.Future} The outer HTML of this element.
463
- */
464
- webdriver.WebElement.prototype.getOuterHtml = function() {
465
- return this.driver_.executeScript(
466
- ['var element = arguments[0];',
467
- 'if ("outerHTML" in element) {',
468
- ' return element.outerHTML;',
469
- '} else {',
470
- ' var div = document.createElement("div");',
471
- ' div.appendChild(element.cloneNode(true));',
472
- ' return div.innerHTML;',
473
- '}'].join(''), this);
474
- };
475
-
476
-
477
- /**
478
- * @return {webdriver.Future} The inner HTML of this element.
479
- */
480
- webdriver.WebElement.prototype.getInnerHtml = function() {
481
- return this.driver_.executeScript('return arguments[0].innerHTML', this);
482
- };
483
-