selenium-webdriver 0.0.9 → 0.0.10

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 (135) hide show
  1. data/chrome/prebuilt/Win32/Release/npchromedriver.dll +0 -0
  2. data/chrome/prebuilt/x64/Release/npchromedriver.dll +0 -0
  3. data/chrome/src/extension/background.js +1 -0
  4. data/chrome/src/extension/content_script.js +182 -177
  5. data/chrome/src/extension/manifest-nonwin.json +1 -1
  6. data/chrome/src/extension/manifest-win.json +1 -1
  7. data/chrome/src/rb/lib/selenium/webdriver/chrome/bridge.rb +9 -3
  8. data/chrome/src/rb/lib/selenium/webdriver/chrome/launcher.rb +1 -1
  9. data/common/src/js/core/Blank.html +7 -0
  10. data/common/src/js/core/InjectedRemoteRunner.html +8 -0
  11. data/common/src/js/core/RemoteRunner.html +101 -0
  12. data/common/src/js/core/SeleniumLog.html +109 -0
  13. data/common/src/js/core/TestPrompt.html +145 -0
  14. data/common/src/js/core/TestRunner-splash.html +55 -0
  15. data/common/src/js/core/TestRunner.html +177 -0
  16. data/common/src/js/core/icons/all.png +0 -0
  17. data/common/src/js/core/icons/continue.png +0 -0
  18. data/common/src/js/core/icons/continue_disabled.png +0 -0
  19. data/common/src/js/core/icons/pause.png +0 -0
  20. data/common/src/js/core/icons/pause_disabled.png +0 -0
  21. data/common/src/js/core/icons/selected.png +0 -0
  22. data/common/src/js/core/icons/step.png +0 -0
  23. data/common/src/js/core/icons/step_disabled.png +0 -0
  24. data/common/src/js/core/lib/cssQuery/cssQuery-p.js +6 -0
  25. data/common/src/js/core/lib/cssQuery/src/cssQuery-level2.js +142 -0
  26. data/common/src/js/core/lib/cssQuery/src/cssQuery-level3.js +150 -0
  27. data/common/src/js/core/lib/cssQuery/src/cssQuery-standard.js +53 -0
  28. data/common/src/js/core/lib/cssQuery/src/cssQuery.js +356 -0
  29. data/common/src/js/core/lib/prototype.js +2006 -0
  30. data/common/src/js/core/lib/scriptaculous/builder.js +101 -0
  31. data/common/src/js/core/lib/scriptaculous/controls.js +815 -0
  32. data/common/src/js/core/lib/scriptaculous/dragdrop.js +915 -0
  33. data/common/src/js/core/lib/scriptaculous/effects.js +958 -0
  34. data/common/src/js/core/lib/scriptaculous/scriptaculous.js +47 -0
  35. data/common/src/js/core/lib/scriptaculous/slider.js +283 -0
  36. data/common/src/js/core/lib/scriptaculous/unittest.js +383 -0
  37. data/common/src/js/core/lib/snapsie.js +91 -0
  38. data/common/src/js/core/scripts/find_matching_child.js +69 -0
  39. data/common/src/js/core/scripts/htmlutils.js +1623 -0
  40. data/common/src/js/core/scripts/injection.html +72 -0
  41. data/common/src/js/core/scripts/selenium-api.js +3294 -0
  42. data/common/src/js/core/scripts/selenium-browserbot.js +2430 -0
  43. data/common/src/js/core/scripts/selenium-browserdetect.js +153 -0
  44. data/common/src/js/core/scripts/selenium-commandhandlers.js +379 -0
  45. data/common/src/js/core/scripts/selenium-executionloop.js +175 -0
  46. data/common/src/js/core/scripts/selenium-logging.js +148 -0
  47. data/common/src/js/core/scripts/selenium-remoterunner.js +695 -0
  48. data/common/src/js/core/scripts/selenium-testrunner.js +1362 -0
  49. data/common/src/js/core/scripts/selenium-version.js +5 -0
  50. data/common/src/js/core/scripts/ui-doc.html +808 -0
  51. data/common/src/js/core/scripts/ui-element.js +1644 -0
  52. data/common/src/js/core/scripts/ui-map-sample.js +979 -0
  53. data/common/src/js/core/scripts/user-extensions.js +3 -0
  54. data/common/src/js/core/scripts/user-extensions.js.sample +75 -0
  55. data/common/src/js/core/scripts/xmlextras.js +153 -0
  56. data/common/src/js/core/selenium-logo.png +0 -0
  57. data/common/src/js/core/selenium-test.css +43 -0
  58. data/common/src/js/core/selenium.css +316 -0
  59. data/common/src/js/core/xpath/dom.js +566 -0
  60. data/common/src/js/core/xpath/javascript-xpath-0.1.11.js +2816 -0
  61. data/common/src/js/core/xpath/util.js +549 -0
  62. data/common/src/js/core/xpath/xmltoken.js +149 -0
  63. data/common/src/js/core/xpath/xpath.js +2481 -0
  64. data/common/src/js/jsunit/app/css/jsUnitStyle.css +50 -0
  65. data/common/src/js/jsunit/app/css/readme +10 -0
  66. data/common/src/js/jsunit/app/emptyPage.html +11 -0
  67. data/common/src/js/jsunit/app/jsUnitCore.js +534 -0
  68. data/common/src/js/jsunit/app/jsUnitMockTimeout.js +81 -0
  69. data/common/src/js/jsunit/app/jsUnitTestManager.js +705 -0
  70. data/common/src/js/jsunit/app/jsUnitTestSuite.js +44 -0
  71. data/common/src/js/jsunit/app/jsUnitTracer.js +102 -0
  72. data/common/src/js/jsunit/app/jsUnitVersionCheck.js +59 -0
  73. data/common/src/js/jsunit/app/main-counts-errors.html +12 -0
  74. data/common/src/js/jsunit/app/main-counts-failures.html +13 -0
  75. data/common/src/js/jsunit/app/main-counts-runs.html +13 -0
  76. data/common/src/js/jsunit/app/main-counts.html +21 -0
  77. data/common/src/js/jsunit/app/main-data.html +178 -0
  78. data/common/src/js/jsunit/app/main-errors.html +23 -0
  79. data/common/src/js/jsunit/app/main-frame.html +19 -0
  80. data/common/src/js/jsunit/app/main-loader.html +45 -0
  81. data/common/src/js/jsunit/app/main-progress.html +25 -0
  82. data/common/src/js/jsunit/app/main-results.html +67 -0
  83. data/common/src/js/jsunit/app/main-status.html +13 -0
  84. data/common/src/js/jsunit/app/testContainer.html +16 -0
  85. data/common/src/js/jsunit/app/testContainerController.html +77 -0
  86. data/common/src/js/jsunit/app/xbDebug.js +306 -0
  87. data/common/src/js/jsunit/changelog.txt +60 -0
  88. data/common/src/js/jsunit/css/jsUnitStyle.css +83 -0
  89. data/common/src/js/jsunit/images/green.gif +0 -0
  90. data/common/src/js/jsunit/images/logo_jsunit.gif +0 -0
  91. data/common/src/js/jsunit/images/powerby-transparent.gif +0 -0
  92. data/common/src/js/jsunit/images/red.gif +0 -0
  93. data/common/src/js/jsunit/licenses/JDOM_license.txt +56 -0
  94. data/common/src/js/jsunit/licenses/Jetty_license.html +213 -0
  95. data/common/src/js/jsunit/licenses/MPL-1.1.txt +470 -0
  96. data/common/src/js/jsunit/licenses/gpl-2.txt +340 -0
  97. data/common/src/js/jsunit/licenses/index.html +141 -0
  98. data/common/src/js/jsunit/licenses/lgpl-2.1.txt +504 -0
  99. data/common/src/js/jsunit/licenses/mpl-tri-license-c.txt +35 -0
  100. data/common/src/js/jsunit/licenses/mpl-tri-license-html.txt +35 -0
  101. data/common/src/js/jsunit/readme.txt +19 -0
  102. data/common/src/js/jsunit/testRunner.html +167 -0
  103. data/common/src/js/jsunit/version.txt +1 -0
  104. data/common/src/rb/README +29 -0
  105. data/common/src/rb/lib/selenium/webdriver/driver.rb +124 -12
  106. data/common/src/rb/lib/selenium/webdriver/element.rb +119 -3
  107. data/common/src/rb/lib/selenium/webdriver/error.rb +1 -2
  108. data/common/src/rb/lib/selenium/webdriver/find.rb +19 -2
  109. data/common/src/rb/lib/selenium/webdriver/keys.rb +5 -1
  110. data/common/src/rb/lib/selenium/webdriver/navigation.rb +8 -4
  111. data/common/src/rb/lib/selenium/webdriver/platform.rb +4 -2
  112. data/common/src/rb/lib/selenium/webdriver/target_locator.rb +18 -0
  113. data/firefox/prebuilt/Win32/Release/webdriver-firefox.dll +0 -0
  114. data/firefox/prebuilt/linux/Release/libwebdriver-firefox.so +0 -0
  115. data/firefox/prebuilt/linux/Release/x_ignore_nofocus.so +0 -0
  116. data/firefox/prebuilt/linux64/Release/libwebdriver-firefox.so +0 -0
  117. data/firefox/prebuilt/linux64/Release/x_ignore_nofocus.so +0 -0
  118. data/firefox/src/extension/components/utils.js +13 -2
  119. data/firefox/src/extension/install.rdf +1 -1
  120. data/firefox/src/rb/lib/selenium/webdriver/firefox.rb +3 -2
  121. data/firefox/src/rb/lib/selenium/webdriver/firefox/binary.rb +1 -7
  122. data/firefox/src/rb/lib/selenium/webdriver/firefox/bridge.rb +11 -4
  123. data/firefox/src/rb/lib/selenium/webdriver/firefox/profile.rb +56 -15
  124. data/firefox/src/rb/lib/selenium/webdriver/firefox/util.rb +1 -1
  125. data/jobbie/prebuilt/Win32/Release/InternetExplorerDriver.dll +0 -0
  126. data/jobbie/prebuilt/x64/Release/InternetExplorerDriver.dll +0 -0
  127. data/jobbie/src/rb/lib/selenium/webdriver/ie/bridge.rb +10 -5
  128. data/jobbie/src/rb/lib/selenium/webdriver/ie/util.rb +9 -10
  129. data/remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb +4 -2
  130. data/remote/client/src/rb/lib/selenium/webdriver/remote/capabilities.rb +23 -23
  131. metadata +103 -6
  132. data/jobbie/prebuilt/Win32/Release/webdriver-ie-test.dll +0 -0
  133. data/jobbie/prebuilt/Win32/Release/webdriver-ie.dll +0 -0
  134. data/jobbie/prebuilt/x64/Release/webdriver-ie-test.dll +0 -0
  135. data/jobbie/prebuilt/x64/Release/webdriver-ie.dll +0 -0
@@ -5,6 +5,12 @@ module Selenium
5
5
 
6
6
  attr_reader :bridge
7
7
 
8
+ #
9
+ # Creates a new Element
10
+ #
11
+ # @api private
12
+ #
13
+
8
14
  def initialize(bridge, id)
9
15
  @bridge, @id = bridge, id
10
16
  end
@@ -13,26 +19,65 @@ module Selenium
13
19
  '#<%s:0x%x id=%s tag_name=%s>' % [self.class, hash*2, @id.inspect, tag_name.inspect]
14
20
  end
15
21
 
22
+ #
23
+ # Click the element
24
+ #
25
+
16
26
  def click
17
27
  bridge.clickElement @id
18
28
  end
19
29
 
30
+ #
31
+ # Get the tag name of this element
32
+ #
33
+ # @return [String]
34
+ #
35
+
20
36
  def tag_name
21
37
  bridge.getElementTagName @id
22
38
  end
23
39
 
40
+ #
41
+ # Get the value of this element
42
+ #
43
+ # @return [String]
44
+ #
45
+
24
46
  def value
25
47
  bridge.getElementValue @id
26
48
  end
27
49
 
50
+ #
51
+ # Get the value of the given attribute
52
+ #
53
+ # @param [String]
54
+ # attribute name
55
+ # @return [String,nil]
56
+ # attribute value
57
+ #
58
+
28
59
  def attribute(name)
29
60
  bridge.getElementAttribute @id, name
30
61
  end
31
62
 
63
+ #
64
+ # Get the text content of this element
65
+ #
66
+ # @return [String]
67
+ #
68
+
32
69
  def text
33
70
  bridge.getElementText @id
34
71
  end
35
72
 
73
+ #
74
+ # Send keystrokes to this element
75
+ #
76
+ # @param [String, Symbol]
77
+ #
78
+ # @see Keys::KEYS
79
+ #
80
+
36
81
  def send_keys(*args)
37
82
  args.each do |arg|
38
83
  if arg.kind_of?(Symbol)
@@ -44,54 +89,123 @@ module Selenium
44
89
  end
45
90
  alias_method :send_key, :send_keys
46
91
 
92
+ #
93
+ # Clear this element
94
+ #
95
+
47
96
  def clear
48
97
  bridge.clearElement @id
49
98
  end
50
99
 
100
+ #
101
+ # Is the element enabled?
102
+ #
103
+ # @return [Boolean]
104
+ #
105
+
51
106
  def enabled?
52
107
  bridge.isElementEnabled @id
53
108
  end
54
109
 
110
+ #
111
+ # Is the element selected?
112
+ #
113
+ # @return [Boolean]
114
+ #
115
+
55
116
  def selected?
56
117
  bridge.isElementSelected @id
57
118
  end
58
119
 
120
+ #
121
+ # Is the element displayed?
122
+ #
123
+ # @return [Boolean]
124
+ #
125
+
59
126
  def displayed?
60
127
  bridge.isElementDisplayed @id
61
128
  end
62
129
 
130
+ #
131
+ # Select this element
132
+ #
133
+
63
134
  def select
64
135
  bridge.setElementSelected @id
65
136
  end
66
137
 
138
+ #
139
+ # Submit this element
140
+ #
141
+
67
142
  def submit
68
143
  bridge.submitElement @id
69
144
  end
70
145
 
146
+ #
147
+ # Toggle this element
148
+ #
149
+
71
150
  def toggle
72
151
  bridge.toggleElement @id
73
152
  end
74
153
 
154
+ #
155
+ # Get the value of the given CSS property
156
+ #
157
+
75
158
  def style(prop)
76
159
  bridge.getElementValueOfCssProperty @id, prop
77
160
  end
78
161
 
162
+ #
163
+ # Hover over this element. Not applicable to all browsers.
164
+ #
165
+
79
166
  def hover
80
167
  bridge.hoverOverElement @id
81
168
  end
82
169
 
170
+ #
171
+ # Get the location of this element.
172
+ #
173
+ # @return [WebDriver::Point]
174
+ #
175
+
83
176
  def location
84
177
  bridge.getElementLocation @id
85
178
  end
86
179
 
180
+ #
181
+ # Get the size of this element
182
+ #
183
+ # @return [WebDriver::Dimension]
184
+ #
185
+
87
186
  def size
88
187
  bridge.getElementSize @id
89
188
  end
90
189
 
190
+ #
191
+ # Drag and drop this element
192
+ #
193
+ # @param [Integer] right_by
194
+ # number of pixels to drag right
195
+ # @param [Integer] down_by
196
+ # number of pixels to drag down
197
+ #
198
+
91
199
  def drag_and_drop_by(right_by, down_by)
92
200
  bridge.dragElement @id, right_by, down_by
93
201
  end
94
202
 
203
+ #
204
+ # Drag and drop this element on the given element
205
+ #
206
+ # @param [WebDriver::Element] other
207
+ #
208
+
95
209
  def drag_and_drop_on(other)
96
210
  current_location = location()
97
211
  destination = other.location
@@ -105,25 +219,27 @@ module Selenium
105
219
  #-------------------------------- sugar --------------------------------
106
220
 
107
221
  #
108
- # element.first(:id, 'foo')
222
+ # element.first(:id, 'foo')
109
223
  #
110
224
 
111
225
  alias_method :first, :find_element
112
226
 
113
227
  #
114
- # element.all(:class, 'bar')
228
+ # element.all(:class, 'bar')
115
229
  #
116
230
 
117
231
  alias_method :all, :find_elements
118
232
 
119
233
  #
120
- # element['class'] or element[:class] #=> "someclass"
234
+ # element['class'] or element[:class] #=> "someclass"
121
235
  #
122
236
  alias_method :[], :attribute
123
237
 
124
238
  #
125
239
  # for Find and execute_script
126
240
  #
241
+ # @api private
242
+ #
127
243
 
128
244
  def ref
129
245
  @id
@@ -1,9 +1,8 @@
1
1
  module Selenium
2
2
  module WebDriver
3
3
  module Error
4
- class WebDriverError < StandardError; end
5
-
6
4
 
5
+ class WebDriverError < StandardError; end
7
6
  class IndexOutOfBoundsError < WebDriverError; end # 1
8
7
  class NoCollectionError < WebDriverError; end # 2
9
8
  class NoStringError < WebDriverError; end # 3
@@ -14,12 +14,21 @@ module Selenium
14
14
  :xpath => 'ByXpath',
15
15
  }
16
16
 
17
+ #
18
+ # Find the first element matching the given arguments.
19
+ #
20
+ # @param [:class, :class_name, :id, :link_text, :link, :partial_link_text, :name, :tag_name, :xpath] how
21
+ # @param [String] what
22
+ # @return [WebDriver::Element]
23
+ #
24
+ # @raise [NoSuchElementError] if the element doesn't exist
25
+ #
17
26
 
18
27
  def find_element(*args)
19
28
  how, what = extract_args(args)
20
29
 
21
30
  unless by = FINDERS[how.to_sym]
22
- raise Error::UnsupportedOperationError, "Cannot find element by #{how.inspect}"
31
+ raise ArgumentError, "cannot find element by #{how.inspect}"
23
32
  end
24
33
 
25
34
  meth = "findElement#{by}"
@@ -28,11 +37,19 @@ module Selenium
28
37
  bridge.send meth, ref, what
29
38
  end
30
39
 
40
+ #
41
+ # Find all elements matching the given arguments
42
+ #
43
+ # @param [:class, :class_name, :id, :link_text, :link, :partial_link_text, :name, :tag_name, :xpath] how
44
+ # @param [String] what
45
+ # @return [Array<WebDriver::Element>]
46
+ #
47
+
31
48
  def find_elements(*args)
32
49
  how, what = extract_args(args)
33
50
 
34
51
  unless by = FINDERS[how.to_sym]
35
- raise Error::UnsupportedOperationError, "Cannot find elements by #{how.inspect}"
52
+ raise ArgumentError, "cannot find elements by #{how.inspect}"
36
53
  end
37
54
 
38
55
  meth = "findElements#{by}"
@@ -2,8 +2,12 @@ module Selenium
2
2
  module WebDriver
3
3
  module Keys
4
4
 
5
- # \x works on both 1.8.6/1.9
5
+ #
6
+ # @see Element#send_keys
7
+ #
8
+
6
9
  KEYS = {
10
+ # \x works on both 1.8.6/1.9
7
11
  :null => "\xEE\x80\x80",
8
12
  :cancel => "\xEE\x80\x81",
9
13
  :help => "\xEE\x80\x82",
@@ -3,19 +3,23 @@ module Selenium
3
3
  class Navigation
4
4
 
5
5
  def initialize(driver)
6
- @driver = driver
6
+ @bridge = driver.bridge
7
7
  end
8
8
 
9
9
  def to(url)
10
- @driver.bridge.get url
10
+ @bridge.get url
11
11
  end
12
12
 
13
13
  def back
14
- @driver.bridge.goBack
14
+ @bridge.goBack
15
15
  end
16
16
 
17
17
  def forward
18
- @driver.bridge.goForward
18
+ @bridge.goForward
19
+ end
20
+
21
+ def refresh
22
+ @bridge.refresh
19
23
  end
20
24
 
21
25
  end # Navigation
@@ -17,7 +17,9 @@ module Selenium
17
17
  :windows
18
18
  when /darwin/
19
19
  :macosx
20
- when /linux|solaris|bsd/
20
+ when /linux/
21
+ :linux
22
+ when /solaris|bsd/
21
23
  :unix
22
24
  else
23
25
  RUBY_PLATFORM
@@ -34,7 +36,7 @@ module Selenium
34
36
  os = case os_name
35
37
  when /windows/i then :windows
36
38
  when /mac os/i then :macosx
37
- when /linux/i then :unix
39
+ when /linux/i then :linux
38
40
  else os_name
39
41
  end
40
42
  end
@@ -2,18 +2,36 @@ module Selenium
2
2
  module WebDriver
3
3
  class TargetLocator
4
4
 
5
+ #
6
+ # @api private
7
+ #
8
+
5
9
  def initialize(driver)
6
10
  @bridge = driver.bridge
7
11
  end
8
12
 
13
+ #
14
+ # switch to the frame with the given id
15
+ #
16
+
9
17
  def frame(id)
10
18
  @bridge.switchToFrame id
11
19
  end
12
20
 
21
+ #
22
+ # switch to the frame with the given id
23
+ #
24
+
13
25
  def window(id)
14
26
  @bridge.switchToWindow id
15
27
  end
16
28
 
29
+ #
30
+ # get the active element
31
+ #
32
+ # @return [WebDriver::Element]
33
+ #
34
+
17
35
  def active_element
18
36
  @bridge.switchToActiveElement
19
37
  end
@@ -1197,6 +1197,18 @@ Utils.unwrapParameters = function(wrappedParameters, resultArray, context) {
1197
1197
  };
1198
1198
 
1199
1199
 
1200
+ Utils.isArray_ = function(obj) {
1201
+ return (obj !== undefined &&
1202
+ obj.constructor.toString().indexOf("Array") != -1);
1203
+ }
1204
+
1205
+
1206
+ Utils.isHtmlCollection_ = function(obj) {
1207
+ return (obj !== undefined && obj['length'] &&
1208
+ obj['item'] && obj['namedItem']);
1209
+ }
1210
+
1211
+
1200
1212
  Utils.wrapResult = function(result, context) {
1201
1213
  // Sophisticated.
1202
1214
  if (null === result || undefined === result) {
@@ -1204,8 +1216,7 @@ Utils.wrapResult = function(result, context) {
1204
1216
  } else if (result['tagName']) {
1205
1217
  return {type: "ELEMENT",
1206
1218
  value: Utils.addToKnownElements(result, context)};
1207
- } else if (result !== undefined &&
1208
- result.constructor.toString().indexOf("Array") != -1) {
1219
+ } else if (Utils.isArray_(result) || Utils.isHtmlCollection_(result)) {
1209
1220
  var array = [];
1210
1221
  for (var i = 0; i < result.length; i++) {
1211
1222
  array.push(Utils.wrapResult(result[i], context));
@@ -4,7 +4,7 @@
4
4
  <Description about="urn:mozilla:install-manifest">
5
5
  <em:id>fxdriver@googlecode.com</em:id>
6
6
  <em:name>Firefox WebDriver</em:name>
7
- <em:version>0.6.680</em:version>
7
+ <em:version>2.0a1</em:version>
8
8
  <em:description>WebDriver implementation for Firefox</em:description>
9
9
  <em:creator>Simon Stewart</em:creator>
10
10
 
@@ -13,8 +13,9 @@ module Selenium
13
13
  module WebDriver
14
14
  module Firefox
15
15
 
16
- DEFAULT_PROFILE_NAME = "WebDriver".freeze
17
- DEFAULT_PORT = 7055
16
+ DEFAULT_PROFILE_NAME = "WebDriver".freeze
17
+ DEFAULT_PORT = 7055
18
+ DEFAULT_ENABLE_NATIVE_EVENTS = Platform.win?
18
19
 
19
20
  end
20
21
  end