watir 6.1.0 → 6.2.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 97b12fa8cee06abcdffeeefdb6a8455ad6abfdb2
4
- data.tar.gz: 661c429b9dcf2eb4fe1ee856a7938c93ff3582d0
3
+ metadata.gz: c7a75c3cb00c09caec743b797d7b5590fc81938c
4
+ data.tar.gz: a0d2f54bca3c49c1b9c893e0f767f3015f4b00e4
5
5
  SHA512:
6
- metadata.gz: 69f706e5998202121957302950f0c71e14359032160924f066474c680f766635de7018f8eb470d6171e7993593c88beb883f1092ebe8fe3014d4d720e29d5cf9
7
- data.tar.gz: d85aec3e1d158e6fd19ba5f176ce7711d762e7f2748faa686e4de8e28a8a687271efe711feee5fd2ac4e3fa26b6ded54c2cbfbdd46bd76695d443370a3ea8793
6
+ metadata.gz: 3600748e11ba3740795eb9d80292d4b71ed0fa2798806f27c9e2a2fcf97308a4024fb231a36ba91e2a58de50852ede60b152d51449b97f754276e316d2a8f525
7
+ data.tar.gz: ca859e2face12ccdfa90cd4935a00b196ef6b8f4555e28f71f1abaffd6f054416a7d5f8d49c218eb9635e4ab936657c0aee080f9b9948bdadcf1375070c088d7
@@ -1,4 +1,5 @@
1
- sudo: false
1
+ dist: trusty
2
+ sudo: require
2
3
  rvm:
3
4
  - 2.2.6
4
5
  - 2.3.3
@@ -9,6 +10,7 @@ addons:
9
10
  packages:
10
11
  - unzip
11
12
  - libxss1
13
+ - google-chrome-stable
12
14
  cache: bundler
13
15
  notifications:
14
16
  recipients:
data/CHANGES.md CHANGED
@@ -1,3 +1,11 @@
1
+ ### 6.2.0 (2017-02-20)
2
+
3
+ * `Element#wait_while_present` exits when locator no longer matches
4
+ * Element Collections store specific element types rather than just `HTMLElement`
5
+ * Implement adjacent element location for parent, siblings and children
6
+ * Add support for assigning keywords to `Element` for better error messaging
7
+ * Update actions implementation to work with selenium-webdriver > 3.0.5
8
+
1
9
  ### 6.1.0 (2017-01-04)
2
10
 
3
11
  * Add Ruby 2.4.0 support (thanks Robert MacCracken)
@@ -6,6 +6,7 @@ require 'watir/exception'
6
6
  require 'watir/xpath_support'
7
7
  require 'watir/window'
8
8
  require 'watir/has_window'
9
+ require 'watir/adjacent'
9
10
  require 'watir/alert'
10
11
  require 'watir/atoms'
11
12
  require 'watir/container'
@@ -0,0 +1,120 @@
1
+ module Watir
2
+ module Adjacent
3
+
4
+ #
5
+ # Returns parent element of current element.
6
+ #
7
+ # @example
8
+ # browser.text_field(name: "new_user_first_name").parent == browser.fieldset
9
+ # #=> true
10
+ #
11
+
12
+ def parent(opt = {})
13
+ opt[:index] ||= 0
14
+ xpath_adjacent("ancestor::", opt)
15
+ end
16
+
17
+ #
18
+ # Returns preceding sibling element of current element.
19
+ #
20
+ # @example
21
+ # browser.text_field(name: "new_user_first_name").preceding_sibling(index: 1) == browser.legend
22
+ # #=> true
23
+ #
24
+
25
+ def preceding_sibling(opt = {})
26
+ opt[:index] ||= 0
27
+ xpath_adjacent("preceding-sibling::", opt)
28
+ end
29
+ alias_method :previous_sibling, :preceding_sibling
30
+
31
+ #
32
+ # Returns collection of preceding sibling elements of current element.
33
+ #
34
+ # @example
35
+ # browser.text_field(name: "new_user_first_name").preceding_siblings.size
36
+ # #=> 3
37
+ #
38
+
39
+ def preceding_siblings(opt = {})
40
+ raise ArgumentError, "#previous_siblings can not take an index value" if opt[:index]
41
+ xpath_adjacent("preceding-sibling::", opt)
42
+ end
43
+ alias_method :previous_siblings, :preceding_siblings
44
+
45
+ #
46
+ # Returns following sibling element of current element.
47
+ #
48
+ # @example
49
+ # browser.text_field(name: "new_user_first_name").following_sibling(index: 2) == browser.text_field(id: "new_user_last_name")
50
+ # #=> true
51
+ #
52
+
53
+ def following_sibling(opt = {})
54
+ opt[:index] ||= 0
55
+ xpath_adjacent("following-sibling::", opt)
56
+ end
57
+ alias_method :next_sibling, :following_sibling
58
+
59
+ #
60
+ # Returns collection of following sibling elements of current element.
61
+ #
62
+ # @example
63
+ # browser.text_field(name: "new_user_first_name").following_siblings.size
64
+ # #=> 52
65
+ #
66
+
67
+ def following_siblings(opt = {})
68
+ raise ArgumentError, "#next_siblings can not take an index value" if opt[:index]
69
+ xpath_adjacent("following-sibling::", opt)
70
+ end
71
+ alias_method :next_siblings, :following_siblings
72
+
73
+ #
74
+ # Returns element of direct child of current element.
75
+ #
76
+ # @example
77
+ # browser.form(id: "new_user").child == browser.fieldset
78
+ # #=> true
79
+ #
80
+
81
+ def child(opt = {})
82
+ opt[:index] ||= 0
83
+ xpath_adjacent('', opt)
84
+ end
85
+
86
+ #
87
+ # Returns collection of elements of direct children of current element.
88
+ #
89
+ # @example
90
+ # browser.select_list(id: "new_user_languages").children == browser.select_list(id: "new_user_languages").options.to_a
91
+ # #=> true
92
+ #
93
+
94
+ def children(opt = {})
95
+ raise ArgumentError, "#children can not take an index value" if opt[:index]
96
+ xpath_adjacent('', opt)
97
+ end
98
+
99
+ private
100
+
101
+ def xpath_adjacent(direction = '', opt = {})
102
+ opt = opt.dup
103
+ index = opt.delete :index
104
+ tag_name = opt.delete :tag_name
105
+ unless opt.empty?
106
+ caller = caller_locations(1, 1)[0].label
107
+ raise ArgumentError, "unsupported locators: #{opt.inspect} for ##{caller} method"
108
+ end
109
+
110
+ if index
111
+ klass = tag_name ? self.send(tag_name).class : HTMLElement
112
+ klass.new(self, xpath: "./#{direction}#{tag_name || '*'}[#{index + 1}]")
113
+ else
114
+ klass = tag_name ? Object.const_get("#{self.send(tag_name).class}Collection") : HTMLElementCollection
115
+ klass.new(self, xpath: "./#{direction}#{tag_name || '*'}")
116
+ end
117
+ end
118
+
119
+ end # Adjacent
120
+ end # Watir
@@ -10,7 +10,6 @@ module Watir
10
10
  load :fireEvent
11
11
  load :getOuterHtml
12
12
  load :getInnerHtml
13
- load :getParentElement
14
13
 
15
14
  private
16
15
 
@@ -35,7 +35,7 @@ module Watir
35
35
  #
36
36
 
37
37
  def length
38
- elements.length
38
+ to_a.length
39
39
  end
40
40
  alias_method :size, :length
41
41
 
@@ -80,12 +80,37 @@ module Watir
80
80
  #
81
81
 
82
82
  def to_a
83
- # TODO: optimize - lazy element_class instance?
84
83
  @to_a ||= elements.map.with_index do |e, idx|
85
- element_class.new(@query_scope, @selector.merge(element: e, index: idx))
84
+ element = element_class.new(@query_scope, @selector.merge(element: e, index: idx))
85
+ element_class == Watir::HTMLElement ? element.to_subtype : element
86
86
  end
87
87
  end
88
88
 
89
+ #
90
+ # Returns true if two element collections are equal.
91
+ #
92
+ # @example
93
+ # browser.select_list(name: "new_user_languages").options == browser.select_list(id: "new_user_languages").options
94
+ # #=> true
95
+ #
96
+ # @example
97
+ # browser.select_list(name: "new_user_role").options == browser.select_list(id: "new_user_languages").options
98
+ # #=> false
99
+ #
100
+
101
+ def ==(other)
102
+ to_a == other.to_a
103
+ end
104
+ alias_method :eql?, :==
105
+
106
+ #
107
+ # Creates a Collection containing elements of two collections.
108
+ #
109
+ # @example
110
+ # (browser.select_list(name: "new_user_languages").options + browser.select_list(id: "new_user_role").options).size
111
+ # #=> 8
112
+ #
113
+
89
114
  private
90
115
 
91
116
  def elements
@@ -11,6 +11,9 @@ module Watir
11
11
  include Container
12
12
  include EventuallyPresent
13
13
  include Waitable
14
+ include Adjacent
15
+
16
+ attr_accessor :keyword
14
17
 
15
18
  #
16
19
  # temporarily add :id and :class_name manually since they're no longer specified in the HTML spec.
@@ -49,11 +52,16 @@ module Watir
49
52
  alias_method :exist?, :exists?
50
53
 
51
54
  def inspect
55
+ string = "#<#{self.class}: "
56
+ string << "keyword: #{keyword} " if keyword
57
+ string << "located: #{!!@element}; "
52
58
  if @selector.empty?
53
- '#<%s:0x%x located=%s selector=%s>' % [self.class, hash*2, !!@element, '{element: (selenium element)}']
59
+ string << '{element: (selenium element)}'
54
60
  else
55
- '#<%s:0x%x located=%s selector=%s>' % [self.class, hash*2, !!@element, selector_string]
61
+ string << selector_string
56
62
  end
63
+ string << '>'
64
+ string
57
65
  end
58
66
 
59
67
  #
@@ -113,8 +121,6 @@ module Watir
113
121
  def click(*modifiers)
114
122
  element_call(:wait_for_enabled) do
115
123
  if modifiers.any?
116
- assert_has_input_devices_for "click(#{modifiers.join ', '})"
117
-
118
124
  action = driver.action
119
125
  modifiers.each { |mod| action.key_down mod }
120
126
  action.click @element
@@ -138,8 +144,6 @@ module Watir
138
144
  #
139
145
 
140
146
  def double_click
141
- assert_has_input_devices_for :double_click
142
-
143
147
  element_call(:wait_for_present) { driver.action.double_click(@element).perform }
144
148
  browser.after_hooks.run
145
149
  end
@@ -153,8 +157,6 @@ module Watir
153
157
  #
154
158
 
155
159
  def right_click
156
- assert_has_input_devices_for :right_click
157
-
158
160
  element_call(:wait_for_present) { driver.action.context_click(@element).perform }
159
161
  browser.after_hooks.run
160
162
  end
@@ -168,8 +170,6 @@ module Watir
168
170
  #
169
171
 
170
172
  def hover
171
- assert_has_input_devices_for :hover
172
-
173
173
  element_call(:wait_for_present) { driver.action.move_to(@element).perform }
174
174
  end
175
175
 
@@ -185,7 +185,6 @@ module Watir
185
185
 
186
186
  def drag_and_drop_on(other)
187
187
  assert_is_element other
188
- assert_has_input_devices_for :drag_and_drop_on
189
188
 
190
189
  element_call(:wait_for_present) do
191
190
  driver.action.
@@ -206,8 +205,6 @@ module Watir
206
205
  #
207
206
 
208
207
  def drag_and_drop_by(right_by, down_by)
209
- assert_has_input_devices_for :drag_and_drop_by
210
-
211
208
  element_call(:wait_for_present) do
212
209
  driver.action.
213
210
  drag_and_drop_by(@element, right_by, down_by).
@@ -345,18 +342,6 @@ module Watir
345
342
  element_call { execute_atom :fireEvent, @element, event_name }
346
343
  end
347
344
 
348
- #
349
- # Returns parent element of current element.
350
- #
351
-
352
- def parent
353
- e = element_call { execute_atom :getParentElement, @element }
354
-
355
- if e.kind_of?(Selenium::WebDriver::Element)
356
- Watir.element_class_for(e.tag_name.downcase).new(@query_scope, element: e)
357
- end
358
- end
359
-
360
345
  #
361
346
  # @api private
362
347
  #
@@ -488,6 +473,10 @@ module Watir
488
473
  true
489
474
  end
490
475
 
476
+ def reset!
477
+ @element = nil
478
+ end
479
+
491
480
  protected
492
481
 
493
482
  def wait_for_exists
@@ -505,7 +494,7 @@ module Watir
505
494
  warn message
506
495
  end
507
496
  raise unknown_exception, "timed out after #{Watir.default_timeout} seconds, "\
508
- "waiting for #{selector_string} to be located"
497
+ "waiting for #{inspect} to be located"
509
498
  end
510
499
  end
511
500
 
@@ -534,7 +523,7 @@ module Watir
534
523
  begin
535
524
  wait_until(&:enabled?)
536
525
  rescue Watir::Wait::TimeoutError
537
- message = "element present, but timed out after #{Watir.default_timeout} seconds, waiting for #{selector_string} to be enabled"
526
+ message = "element present, but timed out after #{Watir.default_timeout} seconds, waiting for #{inspect} to be enabled"
538
527
  raise ObjectDisabledException, message
539
528
  end
540
529
  end
@@ -546,7 +535,7 @@ module Watir
546
535
  begin
547
536
  wait_until { !respond_to?(:readonly?) || !readonly? }
548
537
  rescue Watir::Wait::TimeoutError
549
- message = "element present and enabled, but timed out after #{Watir.default_timeout} seconds, waiting for #{selector_string} to not be readonly"
538
+ message = "element present and enabled, but timed out after #{Watir.default_timeout} seconds, waiting for #{inspect} to not be readonly"
550
539
  raise ObjectReadOnlyException, message
551
540
  end
552
541
  end
@@ -555,7 +544,7 @@ module Watir
555
544
  def assert_exists
556
545
  if @element && @selector.empty?
557
546
  ensure_context
558
- @element = nil if stale?
547
+ @element.reset! if stale?
559
548
  elsif @element && !stale?
560
549
  return
561
550
  else
@@ -567,7 +556,7 @@ module Watir
567
556
 
568
557
  def assert_element_found
569
558
  unless @element
570
- raise unknown_exception, "unable to locate element, using #{selector_string}"
559
+ raise unknown_exception, "unable to locate element: #{inspect}"
571
560
  end
572
561
  end
573
562
 
@@ -625,7 +614,7 @@ module Watir
625
614
 
626
615
  def assert_enabled
627
616
  unless element_call { @element.enabled? }
628
- raise ObjectDisabledException, "object is disabled #{selector_string}"
617
+ raise ObjectDisabledException, "object is disabled #{inspect}"
629
618
  end
630
619
  end
631
620
 
@@ -633,13 +622,7 @@ module Watir
633
622
  assert_enabled
634
623
 
635
624
  if respond_to?(:readonly?) && readonly?
636
- raise ObjectReadOnlyException, "object is read only #{selector_string}"
637
- end
638
- end
639
-
640
- def assert_has_input_devices_for(name)
641
- unless driver.kind_of? Selenium::WebDriver::DriverExtensions::HasInputDevices
642
- raise NotImplementedError, "#{self.class}##{name} is not supported by this driver"
625
+ raise ObjectReadOnlyException, "object is read only #{inspect}"
643
626
  end
644
627
  end
645
628
 
@@ -121,7 +121,7 @@ module Watir
121
121
  timeout = deprecated_timeout
122
122
  message = deprecated_message
123
123
  end
124
- message ||= "waiting for true condition on #{selector_string}"
124
+ message ||= "waiting for true condition on #{inspect}"
125
125
  Wait.until(timeout: timeout, message: message, interval: interval, object: self, &blk)
126
126
 
127
127
  self
@@ -147,7 +147,7 @@ module Watir
147
147
  timeout = deprecated_timeout
148
148
  message = deprecated_message
149
149
  end
150
- message ||= "waiting for false condition on #{selector_string}"
150
+ message ||= "waiting for false condition on #{inspect}"
151
151
  Wait.while(timeout: timeout, message: message, interval: interval, object: self, &blk)
152
152
 
153
153
  self
@@ -190,7 +190,10 @@ module Watir
190
190
  warn "Instead of passing arguments into #wait_while_present method, use keywords"
191
191
  timeout = deprecated_timeout
192
192
  end
193
- wait_while(timeout: timeout, &:present?)
193
+ wait_while(timeout: timeout) do
194
+ self.reset! if self.is_a? Watir::Element
195
+ self.present?
196
+ end
194
197
  end
195
198
 
196
199
  end # Waitable
@@ -76,7 +76,7 @@ describe Watir::Element do
76
76
 
77
77
  watir_element = browser.div(id: "text")
78
78
 
79
- # simulate element going stale after assert_exists and before action taken, but not when block retried
79
+ # simulate element going stale after assert_exists and before action taken, but not when block retried
80
80
  allow(watir_element).to receive(:text) do
81
81
  watir_element.send(:element_call) do
82
82
  @already_stale ||= false
@@ -106,33 +106,54 @@ describe Watir::Element do
106
106
  end
107
107
  end
108
108
 
109
- describe "#selector_string" do
110
- it "displays selector string for regular element" do
111
- browser.goto(WatirSpec.url_for("wait.html"))
109
+ describe "#inspect" do
110
+ before(:each) { browser.goto(WatirSpec.url_for("nested_iframes.html")) }
111
+
112
+ it "does displays specified element type" do
113
+ expect(browser.div.inspect).to include('Watir::Div')
114
+ end
115
+
116
+ it "does not display element type if not specified" do
117
+ element = browser.element(index: 4)
118
+ expect(element.inspect).to include('Watir::HTMLElement')
119
+ end
120
+
121
+ it "displays keyword if specified" do
122
+ element = browser.h3
123
+ element.keyword = 'foo'
124
+ expect(element.inspect).to include('keyword: foo')
125
+ end
126
+
127
+ it "does not display keyword if not specified" do
128
+ element = browser.h3
129
+ expect(element.inspect).to_not include('keyword')
130
+ end
131
+
132
+ it "locate is false when not located" do
112
133
  element = browser.div(:id, 'not_present')
113
- error = 'timed out after 0 seconds, waiting for true condition on {:id=>"not_present", :tag_name=>"div"}'
114
- expect { element.wait_until_present(timeout: 0) }.to raise_exception(Watir::Wait::TimeoutError, error)
134
+ expect(element.inspect).to include('located: false')
135
+ end
136
+
137
+ it "locate is true when located" do
138
+ element = browser.h3
139
+ element.exists?
140
+ expect(element.inspect).to include('located: true')
115
141
  end
116
142
 
117
143
  it "displays selector string for element from colection" do
118
- browser.goto(WatirSpec.url_for("wait.html"))
119
- element = browser.divs.last
120
- error = 'timed out after 0 seconds, waiting for true condition on {:tag_name=>"div", :index=>5}'
121
- expect { element.wait_until_present(timeout: 0) }.to raise_exception(Watir::Wait::TimeoutError, error)
144
+ elements = browser.frames
145
+ expect(elements.last.inspect).to include '{:tag_name=>"frame", :index=>-1}'
122
146
  end
123
147
 
124
148
  it "displays selector string for nested element" do
125
149
  browser.goto(WatirSpec.url_for("wait.html"))
126
- element = browser.div(index: -1).div(:id, 'foo')
127
- error = 'timed out after 0 seconds, waiting for true condition on {:index=>-1, :tag_name=>"div"} --> {:id=>"foo", :tag_name=>"div"}'
128
- expect { element.wait_until_present(timeout: 0) }.to raise_exception(Watir::Wait::TimeoutError, error)
150
+ element = browser.div(index: 1).div(id: 'div2')
151
+ expect(element.inspect).to include '{:index=>1, :tag_name=>"div"} --> {:id=>"div2", :tag_name=>"div"}'
129
152
  end
130
153
 
131
154
  it "displays selector string for nested element under frame" do
132
- browser.goto(WatirSpec.url_for("nested_iframes.html"))
133
- element = browser.iframe(id: 'one').iframe(:id, 'three')
134
- error = 'unable to locate iframe using {:id=>"one", :tag_name=>"iframe"} --> {:id=>"three", :tag_name=>"iframe"}'
135
- expect { element.wait_until_present(timeout: 0) }.to raise_exception(Watir::Exception::UnknownFrameException, error)
155
+ element = browser.iframe(id: 'one').iframe(id: 'three')
156
+ expect(element.inspect).to include '{:id=>"one", :tag_name=>"iframe"} --> {:id=>"three", :tag_name=>"iframe"}'
136
157
  end
137
158
  end
138
159
  end
@@ -14,14 +14,7 @@ if ENV['RELAXED_LOCATE'] == "false"
14
14
  Watir.relaxed_locate = false
15
15
  end
16
16
 
17
- if ENV['TRAVIS']
18
- ENV['DISPLAY'] = ":99.0"
19
-
20
- if ENV['WATIR_BROWSER'] == "chrome"
21
- ENV['WATIR_CHROME_BINARY'] = File.expand_path "chrome-linux/chrome"
22
- ENV['WATIR_CHROME_DRIVER'] = File.expand_path "chrome-linux/chromedriver"
23
- end
24
- end
17
+ ENV['DISPLAY'] = ':99.0' if ENV['TRAVIS']
25
18
 
26
19
  if Selenium::WebDriver::Platform.linux? && ENV['DISPLAY'].nil?
27
20
  raise "DISPLAY not set"
@@ -0,0 +1,164 @@
1
+ require "watirspec_helper"
2
+
3
+ describe "Adjacent Elements" do
4
+ before(:all) do
5
+ browser.goto(WatirSpec.url_for("nested_elements.html"))
6
+ end
7
+
8
+ describe "#parent" do
9
+ it "gets immediate parent of an element by default" do
10
+ expect(browser.div(id: "first_sibling").parent.id).to eq 'parent'
11
+ expect(browser.div(id: "first_sibling").parent).to be_a Watir::HTMLElement
12
+ end
13
+
14
+ it "accepts index argument" do
15
+ expect(browser.div(id: "first_sibling").parent(index: 2).id).to eq 'grandparent'
16
+ expect(browser.div(id: "first_sibling").parent(index: 2)).to be_a Watir::HTMLElement
17
+ end
18
+
19
+ it "accepts tag_name argument" do
20
+ expect(browser.div(id: "first_sibling").parent(tag_name: :div).id).to eq 'parent'
21
+ expect(browser.div(id: "first_sibling").parent(tag_name: :div)).to be_a Watir::Div
22
+ end
23
+
24
+ it "accepts index and tag_name arguments" do
25
+ expect(browser.div(id: "first_sibling").parent(tag_name: :div, index: 1).id).to eq 'grandparent'
26
+ expect(browser.div(id: "first_sibling").parent(tag_name: :div, index: 1)).to be_a Watir::Div
27
+ end
28
+
29
+ it "does not error when no parent element of an index exists" do
30
+ expect(browser.body.parent(index: 2)).to_not exist
31
+ end
32
+
33
+ it "does not error when no parent element of a tag_name exists" do
34
+ expect(browser.div(id: "first_sibling").parent(tag_name: :table)).to_not exist
35
+ end
36
+ end
37
+
38
+ describe "#following_sibling" do
39
+ it "gets immediate following sibling of an element by default" do
40
+ expect(browser.div(id: "first_sibling").following_sibling.id).to eq 'between_siblings1'
41
+ expect(browser.div(id: "first_sibling").following_sibling).to be_a Watir::HTMLElement
42
+ end
43
+
44
+ it "accepts index argument" do
45
+ expect(browser.div(id: "first_sibling").following_sibling(index: 2).id).to eq 'between_siblings2'
46
+ expect(browser.div(id: "first_sibling").following_sibling(index: 2)).to be_a Watir::HTMLElement
47
+ end
48
+
49
+ it "accepts tag_name argument" do
50
+ expect(browser.div(id: "first_sibling").following_sibling(tag_name: :div).id).to eq 'second_sibling'
51
+ expect(browser.div(id: "first_sibling").following_sibling(tag_name: :div)).to be_a Watir::Div
52
+ end
53
+
54
+ it "accepts index and tag_name arguments" do
55
+ expect(browser.div(id: "first_sibling").following_sibling(tag_name: :div, index: 1).id).to eq 'third_sibling'
56
+ expect(browser.div(id: "first_sibling").following_sibling(tag_name: :div, index: 1)).to be_a Watir::Div
57
+ end
58
+
59
+ it "does not error when no next sibling of an index exists" do
60
+ expect(browser.body.following_sibling(index: 1)).to_not exist
61
+ end
62
+
63
+ it "does not error when no next sibling of a tag_name exists" do
64
+ expect(browser.div(id: "first_sibling").following_sibling(tag_name: :table)).to_not exist
65
+ end
66
+ end
67
+
68
+ describe "#following_siblings" do
69
+ it "gets collection of subsequent siblings of an element by default" do
70
+ expect(browser.div(id: "second_sibling").following_siblings).to be_a Watir::HTMLElementCollection
71
+ expect(browser.div(id: "second_sibling").following_siblings.size).to eq 2
72
+ end
73
+
74
+ it "accepts tag_name argument" do
75
+ expect(browser.div(id: "second_sibling").following_siblings(tag_name: :div).size).to eq 1
76
+ expect(browser.div(id: "second_sibling").following_siblings(tag_name: :div).first).to be_a Watir::Div
77
+ end
78
+ end
79
+
80
+ describe "#previous_sibling" do
81
+ it "gets immediate preceeding sibling of an element by default" do
82
+ expect(browser.div(id: "third_sibling").previous_sibling.id).to eq 'between_siblings2'
83
+ expect(browser.div(id: "third_sibling").previous_sibling).to be_a Watir::HTMLElement
84
+ end
85
+
86
+ it "accepts index argument" do
87
+ expect(browser.div(id: "third_sibling").previous_sibling(index: 2).id).to eq 'between_siblings1'
88
+ expect(browser.div(id: "third_sibling").previous_sibling(index: 2)).to be_a Watir::HTMLElement
89
+ end
90
+
91
+ it "accepts tag_name argument" do
92
+ expect(browser.div(id: "third_sibling").previous_sibling(tag_name: :div).id).to eq 'second_sibling'
93
+ expect(browser.div(id: "third_sibling").previous_sibling(tag_name: :div)).to be_a Watir::Div
94
+ end
95
+
96
+ it "accepts index and tag_name arguments" do
97
+ expect(browser.div(id: "third_sibling").previous_sibling(tag_name: :div, index: 1).id).to eq 'first_sibling'
98
+ expect(browser.div(id: "third_sibling").previous_sibling(tag_name: :div, index: 1)).to be_a Watir::Div
99
+ end
100
+
101
+ it "does not error when no next sibling of an index exists" do
102
+ expect(browser.body.previous_sibling(index: 1)).to_not exist
103
+ end
104
+
105
+ it "does not error when no next sibling of a tag_name exists" do
106
+ expect(browser.div(id: "third_sibling").previous_sibling(tag_name: :table)).to_not exist
107
+ end
108
+ end
109
+
110
+ describe "#previous_siblings" do
111
+ it "gets collection of previous siblings of an element by default" do
112
+ expect(browser.div(id: "second_sibling").previous_siblings).to be_a Watir::HTMLElementCollection
113
+ expect(browser.div(id: "second_sibling").previous_siblings.size).to eq 2
114
+ end
115
+
116
+ it "accepts tag_name argument" do
117
+ expect(browser.div(id: "second_sibling").previous_siblings(tag_name: :div).size).to eq 1
118
+ expect(browser.div(id: "second_sibling").previous_siblings(tag_name: :div).first).to be_a Watir::Div
119
+ end
120
+ end
121
+
122
+ describe "#child" do
123
+ it "gets immediate child of an element by default" do
124
+ expect(browser.div(id: "parent").child.id).to eq 'first_sibling'
125
+ expect(browser.div(id: "parent").child).to be_a Watir::HTMLElement
126
+ end
127
+
128
+ it "accepts index argument" do
129
+ expect(browser.div(id: "parent").child(index: 2).id).to eq 'second_sibling'
130
+ expect(browser.div(id: "parent").child(index: 2)).to be_a Watir::HTMLElement
131
+ end
132
+
133
+ it "accepts tag_name argument" do
134
+ expect(browser.div(id: "parent").child(tag_name: :span).id).to eq 'between_siblings1'
135
+ expect(browser.div(id: "parent").child(tag_name: :span)).to be_a Watir::Span
136
+ end
137
+
138
+ it "accepts index and tag_name arguments" do
139
+ expect(browser.div(id: "parent").child(tag_name: :div, index: 1).id).to eq 'second_sibling'
140
+ expect(browser.div(id: "parent").child(tag_name: :div, index: 1)).to be_a Watir::Div
141
+ end
142
+
143
+ it "does not error when no next sibling of an index exists" do
144
+ expect(browser.div(id: "second_sibling").child(index: 1)).to_not exist
145
+ end
146
+
147
+ it "does not error when no next sibling of a tag_name exists" do
148
+ expect(browser.div(id: "parent").child(tag_name: :table)).to_not exist
149
+ end
150
+ end
151
+
152
+ describe "#children" do
153
+ it "gets collection of children of an element by default" do
154
+ expect(browser.div(id: "parent").children).to be_a Watir::HTMLElementCollection
155
+ expect(browser.div(id: "parent").children.size).to eq 5
156
+ end
157
+
158
+ it "accepts tag_name argument" do
159
+ children = browser.div(id: "parent").children(tag_name: :div)
160
+ expect(children.size).to eq 3
161
+ expect(children.all? { |child| child.is_a? Watir::Div }).to eq true
162
+ end
163
+ end
164
+ end
@@ -2,15 +2,26 @@ require "watirspec_helper"
2
2
 
3
3
  describe "Collections" do
4
4
 
5
- before :each do
6
- browser.goto(WatirSpec.url_for("collections.html"))
7
- end
8
-
9
5
  it "returns inner elements of parent element having different html tag" do
6
+ browser.goto(WatirSpec.url_for("collections.html"))
10
7
  expect(browser.span(id: "a_span").divs.size).to eq 2
11
8
  end
12
9
 
13
10
  it "returns inner elements of parent element having same html tag" do
11
+ browser.goto(WatirSpec.url_for("collections.html"))
14
12
  expect(browser.span(id: "a_span").spans.size).to eq 2
15
13
  end
14
+
15
+ it "returns correct subtype of elements" do
16
+ browser.goto(WatirSpec.url_for("collections.html"))
17
+ collection = browser.span(id: "a_span").spans.to_a
18
+ expect(collection.all? { |el| el.is_a? Watir::Span}).to eq true
19
+ end
20
+
21
+ it "can contain more than one type of element" do
22
+ browser.goto(WatirSpec.url_for("nested_elements.html"))
23
+ collection = browser.div(id: "parent").children
24
+ expect(collection.any? { |el| el.is_a? Watir::Span}).to eq true
25
+ expect(collection.any? { |el| el.is_a? Watir::Div}).to eq true
26
+ end
16
27
  end
@@ -182,23 +182,13 @@ describe "Element" do
182
182
  end
183
183
  end
184
184
 
185
- describe "#parent" do
186
- it "gets the parent of this element" do
187
- expect(browser.text_field(id: "new_user_email").parent).to be_instance_of(Watir::FieldSet)
188
- end
189
-
190
- it "returns nil if the element has no parent" do
191
- expect(browser.body.parent.parent).to be_nil
192
- end
193
- end
194
-
195
185
  describe "#visible?" do
196
186
  it "returns true if the element is visible" do
197
187
  expect(browser.text_field(id: "new_user_email")).to be_visible
198
188
  end
199
189
 
200
190
  it "raises UnknownObjectException exception if the element does not exist" do
201
- expect {browser.text_field(id: "no_such_id").visible?}.to raise_unknown_object_exception
191
+ expect { browser.text_field(id: "no_such_id").visible? }.to raise_unknown_object_exception
202
192
  end
203
193
 
204
194
  it "raises UnknownObjectException exception if the element is stale" do
@@ -12,4 +12,25 @@ describe "Elements" do
12
12
  end
13
13
  end
14
14
  end
15
+
16
+ describe "#eq and #eql?" do
17
+ before { browser.goto WatirSpec.url_for("forms_with_input_elements.html") }
18
+
19
+ it "returns true if the two collections have the same Watir Elements" do
20
+ a = browser.select_list(name: "new_user_languages").options
21
+ b = browser.select_list(id: "new_user_languages").options
22
+
23
+ expect(a).to eq b
24
+ expect(a).to eql(b)
25
+ end
26
+
27
+ it "returns false if the two collections are not the same" do
28
+ a = browser.select_list(name: "new_user_languages").options
29
+ b = browser.select_list(id: "new_user_role").options
30
+
31
+ expect(a).to_not eq b
32
+ expect(a).to_not eql(b)
33
+ end
34
+ end
35
+
15
36
  end
@@ -0,0 +1,34 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
+ <html lang="en">
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
+ <title>Nested Elements</title>
6
+ </head>
7
+
8
+ <body>
9
+ <span id="grandparent_span">
10
+ <div id="grandparent">
11
+ <span id="parent_span">
12
+ <div id="parent">
13
+ <div id="first_sibling">
14
+ <span id="child_span">
15
+ <div id="oldest_child">
16
+ <span id="grandson_span">
17
+ <div id="first_grandson"></div>
18
+ <div id="second_grandson"></div>
19
+ </span>
20
+ </div>
21
+ <div id="middle_child"></div>
22
+ <div id="youngest_child"></div>
23
+ </span>
24
+ </div>
25
+ <span id="between_siblings1"></span>
26
+ <div id="second_sibling"></div>
27
+ <span id="between_siblings2"></span>
28
+ <div id="third_sibling"></div>
29
+ </div>
30
+ </span>
31
+ </div>
32
+ </span>
33
+ </body>
34
+ </html>
@@ -6,4 +6,8 @@
6
6
  <h3>Top Layer</h3>
7
7
  <iframe id="one" src="nested_frame_1.html"></iframe>
8
8
  <iframe id="two" src="nested_iframe_2.html"></iframe>
9
+
10
+ <div id="div1">
11
+ <div id="div2"></div>
12
+ </div>
9
13
  </html>
@@ -40,6 +40,10 @@
40
40
  document.getElementById(id).disabled = disabled;
41
41
  }, timeout);
42
42
  }
43
+
44
+ function changeName(id) {
45
+ document.getElementById(id).name = 'different';
46
+ }
43
47
  </script>
44
48
  </head>
45
49
 
@@ -59,7 +63,8 @@
59
63
  </a>
60
64
  </div>
61
65
  <div>
62
- <a id="add_select" href="#" onclick="setTimeoutDisplay('languages', 'block', 500);">show select list</a>
66
+ <a id="change_select" href="#" onclick="changeName('add_select');">change select list</a>
67
+ <a id="add_select" name="add_select" href="#" onclick="setTimeoutDisplay('languages', 'block', 500);">show select list</a>
63
68
  </div>
64
69
  <form>
65
70
  <fieldset>
@@ -54,10 +54,10 @@ describe 'Watir#relaxed_locate?' do
54
54
  it 'fails first for parent not existing' do
55
55
  begin
56
56
  Watir.default_timeout = 0
57
- selector = "{:id=>\"no_parent\", :tag_name=>\"div\"}"
57
+ inspected = '#<Watir::Div: located: false; {:id=>"no_parent", :tag_name=>"div"}>'
58
58
  element = browser.div(id: 'no_parent').div(id: 'no_child')
59
59
  error = Watir::Exception::UnknownObjectException
60
- message = "timed out after #{Watir.default_timeout} seconds, waiting for #{selector} to be located"
60
+ message = "timed out after #{Watir.default_timeout} seconds, waiting for #{inspected} to be located"
61
61
  expect { element.click }.to raise_exception(error, message)
62
62
  ensure
63
63
  Watir.default_timeout = 30
@@ -67,10 +67,10 @@ describe 'Watir#relaxed_locate?' do
67
67
  it 'fails for child not existing if parent exists' do
68
68
  begin
69
69
  Watir.default_timeout = 0
70
- selector = "{:id=>\"buttons\", :tag_name=>\"div\"} --> {:id=>\"no_child\", :tag_name=>\"div\"}"
70
+ inspected = '#<Watir::Div: located: false; {:id=>"buttons", :tag_name=>"div"} --> {:id=>"no_child", :tag_name=>"div"}>'
71
71
  element = browser.div(id: 'buttons').div(id: 'no_child')
72
72
  error = Watir::Exception::UnknownObjectException
73
- message = "timed out after #{Watir.default_timeout} seconds, waiting for #{selector} to be located"
73
+ message = "timed out after #{Watir.default_timeout} seconds, waiting for #{inspected} to be located"
74
74
  expect { element.click }.to raise_exception(error, message)
75
75
  ensure
76
76
  Watir.default_timeout = 30
@@ -80,10 +80,10 @@ describe 'Watir#relaxed_locate?' do
80
80
  it 'fails for parent not present if child exists' do
81
81
  begin
82
82
  Watir.default_timeout = 0.5
83
- selector = "{:id=>\"also_hidden\", :tag_name=>\"div\"}"
83
+ inspected = '#<Watir::Div: located: true; {:id=>"also_hidden", :tag_name=>"div"}>'
84
84
  element = browser.div(id: 'also_hidden').div(id: 'hidden_child')
85
85
  error = Watir::Exception::UnknownObjectException
86
- message = "element located, but timed out after #{Watir.default_timeout} seconds, waiting for true condition on #{selector}"
86
+ message = "element located, but timed out after #{Watir.default_timeout} seconds, waiting for true condition on #{inspected}"
87
87
  allow($stderr).to receive(:write).twice
88
88
  expect { element.click }.to raise_exception(error, message)
89
89
  ensure
@@ -94,10 +94,10 @@ describe 'Watir#relaxed_locate?' do
94
94
  it 'fails for child not present if parent is present' do
95
95
  begin
96
96
  Watir.default_timeout = 0.5
97
- selector = "{:id=>\"buttons\", :tag_name=>\"div\"} --> {:id=>\"btn2\", :tag_name=>\"button\"}"
97
+ inspected = '#<Watir::Button: located: true; {:id=>"buttons", :tag_name=>"div"} --> {:id=>"btn2", :tag_name=>"button"}>'
98
98
  element = browser.div(id: 'buttons').button(id: 'btn2')
99
99
  error = Watir::Exception::UnknownObjectException
100
- message = "element located, but timed out after #{Watir.default_timeout} seconds, waiting for true condition on #{selector}"
100
+ message = "element located, but timed out after #{Watir.default_timeout} seconds, waiting for true condition on #{inspected}"
101
101
  allow($stderr).to receive(:write).twice
102
102
  expect { element.click }.to raise_exception(error, message)
103
103
  ensure
@@ -109,10 +109,10 @@ describe 'Watir#relaxed_locate?' do
109
109
  browser.goto(WatirSpec.url_for("forms_with_input_elements.html"))
110
110
  begin
111
111
  Watir.default_timeout = 0.5
112
- selector = "{:id=>\"new_user\", :tag_name=>\"form\"} --> {:id=>\"good_luck\", :tag_name=>\"input or textarea\", :type=>\"(any text type)\"}"
112
+ inspected = '#<Watir::TextField: located: true; {:id=>"new_user", :tag_name=>"form"} --> {:id=>"good_luck", :tag_name=>"input or textarea", :type=>"(any text type)"}>'
113
113
  element = browser.form(id: 'new_user').text_field(id: 'good_luck')
114
114
  error = Watir::Exception::ObjectDisabledException
115
- message = "element present, but timed out after #{Watir.default_timeout} seconds, waiting for #{selector} to be enabled"
115
+ message = "element present, but timed out after #{Watir.default_timeout} seconds, waiting for #{inspected} to be enabled"
116
116
  expect { element.set('foo') }.to raise_exception(error, message)
117
117
  ensure
118
118
  Watir.default_timeout = 30
@@ -123,10 +123,10 @@ describe 'Watir#relaxed_locate?' do
123
123
  browser.goto(WatirSpec.url_for("forms_with_input_elements.html"))
124
124
  begin
125
125
  Watir.default_timeout = 0.5
126
- selector = "{:id=>\"new_user\", :tag_name=>\"form\"} --> {:id=>\"new_user_code\", :tag_name=>\"input or textarea\", :type=>\"(any text type)\"}"
126
+ inspected = '#<Watir::TextField: located: true; {:id=>"new_user", :tag_name=>"form"} --> {:id=>"new_user_code", :tag_name=>"input or textarea", :type=>"(any text type)"}>'
127
127
  element = browser.form(id: 'new_user').text_field(id: 'new_user_code')
128
128
  error = Watir::Exception::ObjectReadOnlyException
129
- message = "element present and enabled, but timed out after #{Watir.default_timeout} seconds, waiting for #{selector} to not be readonly"
129
+ message = "element present and enabled, but timed out after #{Watir.default_timeout} seconds, waiting for #{inspected} to not be readonly"
130
130
  expect { element.set('foo') }.to raise_exception(error, message)
131
131
  ensure
132
132
  Watir.default_timeout = 30
@@ -9,14 +9,15 @@ if defined?(RSpec)
9
9
  }.freeze
10
10
 
11
11
  TIMING_EXCEPTIONS.each do |matcher, exception|
12
- RSpec::Matchers.define matcher do |_expected|
12
+ RSpec::Matchers.define matcher do |message|
13
13
  match do |actual|
14
14
  original_timeout = Watir.default_timeout
15
15
  Watir.default_timeout = 0
16
16
  begin
17
17
  actual.call
18
18
  false
19
- rescue exception
19
+ rescue exception => ex
20
+ raise exception, "expected '#{message}' to be included in: '#{ex.message}'" unless message.nil? || ex.message.include?(message)
20
21
  true
21
22
  ensure
22
23
  Watir.default_timeout = original_timeout
@@ -167,8 +167,11 @@ not_compliant_on :safari do
167
167
  end
168
168
 
169
169
  it "times out" do
170
- message = /^timed out after 1 seconds, waiting for true condition on (\{:id=>"btn", :tag_name=>"button"\}|\{:tag_name=>"button", :id=>"btn"\})$/
171
- expect { browser.button(id: 'btn').wait_until(timeout: 1, &:enabled?).click }.to raise_error(Watir::Wait::TimeoutError, message)
170
+ error = Watir::Wait::TimeoutError
171
+ inspected = '#<Watir::Button: located: false; {:id=>"btn", :tag_name=>"button"}>'
172
+ message = "timed out after 1 seconds, waiting for true condition on #{inspected}"
173
+ element = browser.button(id: 'btn')
174
+ expect { element.wait_until(timeout: 1, &:enabled?).click }.to raise_error(error, message)
172
175
  end
173
176
 
174
177
  it "responds to Element methods" do
@@ -196,8 +199,11 @@ not_compliant_on :safari do
196
199
  end
197
200
 
198
201
  it "times out if the element doesn't appear" do
199
- message = /^timed out after 1 seconds, waiting for true condition on (\{:id=>"bar", :tag_name=>"div"\}|\{:tag_name=>"div", :id=>"bar"\})$/
200
- expect { browser.div(id: 'bar').wait_until_present(timeout: 1) }.to raise_error(Watir::Wait::TimeoutError, message)
202
+ inspected = '#<Watir::Div: located: false; {:id=>"bar", :tag_name=>"div"}>'
203
+ error = Watir::Wait::TimeoutError
204
+ message = "timed out after 1 seconds, waiting for true condition on #{inspected}"
205
+
206
+ expect { browser.div(id: 'bar').wait_until_present(timeout: 1) }.to raise_error(error, message)
201
207
  end
202
208
 
203
209
  it "uses provided interval" do
@@ -225,7 +231,7 @@ not_compliant_on :safari do
225
231
  expect { select_list.select('No') }.to raise_error Watir::Exception::NoValueFoundException
226
232
  expect(::Time.now - start_time).to be > 1
227
233
  ensure
228
- Watir.default_timeout = 1
234
+ Watir.default_timeout = 30
229
235
  end
230
236
  end
231
237
  end
@@ -237,8 +243,10 @@ not_compliant_on :safari do
237
243
  end
238
244
 
239
245
  it "times out if the element doesn't disappear" do
240
- message = /^timed out after 1 seconds, waiting for false condition on (\{:id=>"foo", :tag_name=>"div"\}|\{:tag_name=>"div", :id=>"foo"\})$/
241
- expect { browser.div(id: 'foo').wait_while_present(timeout: 1) }.to raise_error(Watir::Wait::TimeoutError, message)
246
+ error = Watir::Wait::TimeoutError
247
+ inspected = '#<Watir::Div: located: false; {:id=>"foo", :tag_name=>"div"}>'
248
+ message = "timed out after 1 seconds, waiting for false condition on #{inspected}"
249
+ expect { browser.div(id: 'foo').wait_while_present(timeout: 1) }.to raise_error(error, message)
242
250
  end
243
251
 
244
252
  it "uses provided interval" do
@@ -267,6 +275,17 @@ not_compliant_on :safari do
267
275
  expect { element.wait_while_present(timeout: 1) }.to_not raise_exception
268
276
  end
269
277
 
278
+ it "waits until the selector no longer matches" do
279
+ Watir.default_timeout = 1
280
+ element = browser.link(name: 'add_select').wait_until(&:exists?)
281
+ begin
282
+ start_time = ::Time.now
283
+ browser.link(id: 'change_select').click
284
+ expect { element.wait_while_present }.not_to raise_error
285
+ ensure
286
+ Watir.default_timeout = 30
287
+ end
288
+ end
270
289
  end
271
290
 
272
291
  describe "#wait_until" do
@@ -74,9 +74,4 @@ YARD::Doctest.configure do |doctest|
74
74
  end
75
75
  end
76
76
 
77
- if ENV['TRAVIS']
78
- ENV['DISPLAY'] = ':99.0'
79
-
80
- Selenium::WebDriver::Chrome.path = File.expand_path 'chrome-linux/chrome'
81
- Selenium::WebDriver::Chrome.driver_path = File.expand_path 'chrome-linux/chromedriver'
82
- end
77
+ ENV['DISPLAY'] = ':99.0' if ENV['TRAVIS']
@@ -11,20 +11,12 @@ if [[ "$RAKE_TASK" = "yard:doctest" ]]; then
11
11
  fi
12
12
 
13
13
  if [[ "$RAKE_TASK" = "spec:chrome" ]] || [[ "$RAKE_TASK" = "yard:doctest" ]]; then
14
- # https://omahaproxy.appspot.com
15
- # https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Linux_x64/
16
- # CHROME_REVISION=`curl -s http://commondatastorage.googleapis.com/chromium-browser-snapshots/Linux_x64/LAST_CHANGE`
17
- CHROME_REVISION=417841
18
-
19
- curl -L -O "http://commondatastorage.googleapis.com/chromium-browser-snapshots/Linux_x64/${CHROME_REVISION}/chrome-linux.zip"
20
- unzip chrome-linux.zip
21
-
22
14
  CHROMEDRIVER_VERSION=$(curl -s http://chromedriver.storage.googleapis.com/LATEST_RELEASE)
23
15
  curl -L -O "http://chromedriver.storage.googleapis.com/${CHROMEDRIVER_VERSION}/chromedriver_linux64.zip"
24
16
  unzip chromedriver_linux64.zip
25
17
 
26
- mv chromedriver chrome-linux/chromedriver
27
- chmod +x chrome-linux/chromedriver
18
+ mv chromedriver travis-drivers/chromedriver
19
+ chmod +x travis-drivers/chromedriver
28
20
  fi
29
21
 
30
22
  if [[ "$RAKE_TASK" = "spec:firefox" ]]; then
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'watir'
5
- s.version = '6.1.0'
5
+ s.version = '6.2.0'
6
6
  s.platform = Gem::Platform::RUBY
7
7
  s.authors = ['Alex Rodionov', 'Titus Fortner']
8
8
  s.email = ['p0deje@gmail.com', 'titusfortner@gmail.com']
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: watir
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.0
4
+ version: 6.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Rodionov
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-01-04 00:00:00.000000000 Z
12
+ date: 2017-02-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: selenium-webdriver
@@ -186,6 +186,7 @@ files:
186
186
  - appveyor.yml
187
187
  - lib/watir-webdriver.rb
188
188
  - lib/watir.rb
189
+ - lib/watir/adjacent.rb
189
190
  - lib/watir/after_hooks.rb
190
191
  - lib/watir/alert.rb
191
192
  - lib/watir/aliases.rb
@@ -194,7 +195,6 @@ files:
194
195
  - lib/watir/atoms/fireEvent.js
195
196
  - lib/watir/atoms/getInnerHtml.js
196
197
  - lib/watir/atoms/getOuterHtml.js
197
- - lib/watir/atoms/getParentElement.js
198
198
  - lib/watir/atoms/selectText.js
199
199
  - lib/watir/attribute_helper.rb
200
200
  - lib/watir/browser.rb
@@ -291,6 +291,7 @@ files:
291
291
  - spec/locator_spec_helper.rb
292
292
  - spec/spec_helper.rb
293
293
  - spec/special_chars_spec.rb
294
+ - spec/watirspec/adjacent_spec.rb
294
295
  - spec/watirspec/after_hooks_spec.rb
295
296
  - spec/watirspec/alert_spec.rb
296
297
  - spec/watirspec/browser_spec.rb
@@ -417,6 +418,7 @@ files:
417
418
  - spec/watirspec/html/keylogger.html
418
419
  - spec/watirspec/html/modal_dialog.html
419
420
  - spec/watirspec/html/multiple_ids.html
421
+ - spec/watirspec/html/nested_elements.html
420
422
  - spec/watirspec/html/nested_frame_1.html
421
423
  - spec/watirspec/html/nested_frame_2.html
422
424
  - spec/watirspec/html/nested_frame_3.html
@@ -480,6 +482,7 @@ test_files:
480
482
  - spec/locator_spec_helper.rb
481
483
  - spec/spec_helper.rb
482
484
  - spec/special_chars_spec.rb
485
+ - spec/watirspec/adjacent_spec.rb
483
486
  - spec/watirspec/after_hooks_spec.rb
484
487
  - spec/watirspec/alert_spec.rb
485
488
  - spec/watirspec/browser_spec.rb
@@ -606,6 +609,7 @@ test_files:
606
609
  - spec/watirspec/html/keylogger.html
607
610
  - spec/watirspec/html/modal_dialog.html
608
611
  - spec/watirspec/html/multiple_ids.html
612
+ - spec/watirspec/html/nested_elements.html
609
613
  - spec/watirspec/html/nested_frame_1.html
610
614
  - spec/watirspec/html/nested_frame_2.html
611
615
  - spec/watirspec/html/nested_frame_3.html
@@ -1,17 +0,0 @@
1
- // Copyright 2011 Software Freedom Conservatory
2
- // Licensed under the Apache License, Version 2.0 (the "License");
3
- // you may not use this file except in compliance with the License.
4
- // You may obtain a copy of the License at
5
- //
6
- // http://www.apache.org/licenses/LICENSE-2.0
7
- //
8
- // Unless required by applicable law or agreed to in writing, software
9
- // distributed under the License is distributed on an "AS IS" BASIS,
10
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
- // See the License for the specific language governing permissions and
12
- // limitations under the License.
13
-
14
- function(){return function(){var d=this;function e(a,b){function c(){}c.prototype=b.prototype;a.g=b.prototype;a.prototype=new c};function g(a){for(var b=1;b<arguments.length;b++)var c=String(arguments[b]).replace(/\$/g,"$$$$"),a=a.replace(/\%s/,c);return a}function h(a,b){if(a<b)return-1;else if(a>b)return 1;return 0};var i,l,m,n;function o(){return d.navigator?d.navigator.userAgent:null}n=m=l=i=!1;var p;if(p=o()){var q=d.navigator;i=p.indexOf("Opera")==0;l=!i&&p.indexOf("MSIE")!=-1;m=!i&&p.indexOf("WebKit")!=-1;n=!i&&!m&&q.product=="Gecko"}var r=l,s=n,v=m,w;
15
- a:{var x="",y;if(i&&d.opera)var z=d.opera.version,x=typeof z=="function"?z():z;else if(s?y=/rv\:([^\);]+)(\)|;)/:r?y=/MSIE\s+([^\);]+)(\)|;)/:v&&(y=/WebKit\/(\S+)/),y)var A=y.exec(o()),x=A?A[1]:"";if(r){var B,C=d.document;B=C?C.documentMode:void 0;if(B>parseFloat(x)){w=String(B);break a}}w=x}var D={};
16
- function E(a){var b;if(!(b=D[a])){b=0;for(var c=String(w).replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),f=String(a).replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),t=Math.max(c.length,f.length),u=0;b==0&&u<t;u++){var L=c[u]||"",M=f[u]||"",N=RegExp("(\\d*)(\\D*)","g"),O=RegExp("(\\d*)(\\D*)","g");do{var j=N.exec(L)||["","",""],k=O.exec(M)||["","",""];if(j[0].length==0&&k[0].length==0)break;b=h(j[1].length==0?0:parseInt(j[1],10),k[1].length==0?0:parseInt(k[1],10))||h(j[2].length==0,k[2].length==0)||
17
- h(j[2],k[2])}while(b==0)}b=D[a]=b>=0}return b};function F(a){this.stack=Error().stack||"";if(a)this.message=String(a)}e(F,Error);e(function(a,b){b.unshift(a);F.call(this,g.apply(null,b));b.shift();this.f=a},F);!r||E("9");!s&&!r||r&&E("9")||s&&E("1.9.1");r&&E("9");function G(a,b,c,f,t){this.b=!!b;if(a&&(this.a=a))this.c=typeof f=="number"?f:this.a.nodeType!=1?0:this.b?-1:1;this.d=t!=void 0?t:this.c||0;this.b&&(this.d*=-1);this.e=!c}e(G,function(){});G.prototype.a=null;G.prototype.c=0;e(function(a,b,c,f){G.call(this,a,b,c,null,f)},G);function H(a){for(a=a.parentNode;a&&a.nodeType!=1&&a.nodeType!=9&&a.nodeType!=11;)a=a.parentNode;return a&&a.nodeType==1?a:null}var I="_".split("."),J=d;!(I[0]in J)&&J.execScript&&J.execScript("var "+I[0]);for(var K;I.length&&(K=I.shift());)!I.length&&H!==void 0?J[K]=H:J=J[K]?J[K]:J[K]={};; return this._.apply(null,arguments);}.apply({navigator:typeof window!='undefined'?window.navigator:null}, arguments);}