watir 6.0.0.beta3 → 6.0.0.beta4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 415906101dfc75ea43c273284261099c71e45448
4
- data.tar.gz: 5423e34c7bd7ed2aaa931b8c4e3d6c2c36de19de
3
+ metadata.gz: 04b089bcf4e58208a441dedb2d2404b8e20e2967
4
+ data.tar.gz: 1994d0b6cc7f8c5c763da8558447f73bade0d3b9
5
5
  SHA512:
6
- metadata.gz: 73d3a41a599ed85ef1fd8fd16471d740d93781f590d8322eb3c09ad58e9100a914c96832267151fadc9d75e0ae46d69305db648dc951ee9cfdc4c558ce05e6eb
7
- data.tar.gz: 0c073bc094065d5e986cd1d1a7ae38509a966c7845a9189b31b1b0034b782214ae362e3082f1f10a79ddf5ea2b0ce8925b281eabcc95419aa3f85c51c80d0aac
6
+ metadata.gz: 4cdae8a09deebfaab7adb7cf413d5f3a4043485d716fa52c87deadf00d6c4d46e8644d9e16c1b1c285abdc4e6f5fe3104f10ace01264b897332835169d0003d7
7
+ data.tar.gz: b220f0b235362602d735a17967c8e87859f864a65df54145ff87ed1a08ed4b650a07908e64513f2adaf558f1d5713dd2d35cd9e84b0e4b66b4e5edf65e2d8239
@@ -2,7 +2,7 @@ sudo: false
2
2
  rvm:
3
3
  - 2.1
4
4
  - 2.2
5
- - 2.3.0
5
+ - 2.3.1
6
6
  addons:
7
7
  firefox: latest
8
8
  apt:
@@ -24,12 +24,6 @@ before_script:
24
24
  script: bundle exec rake $RAKE_TASK
25
25
  env:
26
26
  - RAKE_TASK=spec:firefox
27
- - RAKE_TASK=spec:firefox ALWAYS_LOCATE=false
28
- - RAKE_TASK=spec:firefox PREFER_CSS=1 SELECTOR_STATS=1
29
27
  - RAKE_TASK=spec:chrome
30
- - RAKE_TASK=spec:chrome ALWAYS_LOCATE=false
31
- - RAKE_TASK=spec:chrome PREFER_CSS=1 SELECTOR_STATS=1
32
28
  - RAKE_TASK=spec:phantomjs
33
- - RAKE_TASK=spec:phantomjs ALWAYS_LOCATE=false
34
- - RAKE_TASK=spec:phantomjs PREFER_CSS=1 SELECTOR_STATS=1
35
29
  - RAKE_TASK=yard:doctest
data/CHANGES.md CHANGED
@@ -1,3 +1,11 @@
1
+ ### 6.0.0.beta4 (2016-09-12)
2
+
3
+ * Deprecate Watir#prefer_css setting
4
+ * Deprecate Watir#always_locate setting
5
+ * Add `Element#stale?`
6
+ * Add `Element#wait_until_stale`
7
+ * Allow locating date/time/etc. input types with `#text_field` (#295)
8
+
1
9
  ### 6.0.0.beta3 (2016-08-07)
2
10
 
3
11
  * Deprecate `require "watir-webdriver"` in favor of `require "watir"`
@@ -14,45 +14,61 @@ require 'watir/screenshot'
14
14
  require 'watir/after_hooks'
15
15
 
16
16
  module Watir
17
- @always_locate = true
18
17
 
19
18
  class << self
20
- def always_locate?
21
- @always_locate
22
- end
23
19
 
24
20
  #
25
- # Whether or not Watir should cache element references or always re-locate an Element on use.
26
- # Defaults to true.
21
+ # Whether or not Watir should re-locate a stale Element on use.
27
22
  #
28
23
 
29
- def always_locate=(bool)
30
- @always_locate = bool
24
+ def always_locate?
25
+ always_locate_message
26
+ true
31
27
  end
32
28
 
33
- def default_timeout
34
- @default_timeout ||= 30
29
+ def always_locate=(_bool)
30
+ always_locate_message
31
+ end
32
+
33
+ def always_locate_message
34
+ warn <<-EOS
35
+ Watir#always_locate is deprecated; elements are always cached and will always
36
+ be re-located if they go stale before use.
37
+ Use Element#stale? or Element#wait_until_stale if needed for flow control.
38
+ EOS
35
39
  end
36
40
 
37
41
  #
38
- # Default wait time for wait methods.
42
+ # Whether or not Watir should prefer CSS when translating the Watir selectors to Selenium.
39
43
  #
40
44
 
41
- def default_timeout=(value)
42
- @default_timeout = value
45
+ def prefer_css?
46
+ prefer_css_message
47
+ false
43
48
  end
44
49
 
45
- def prefer_css?
46
- @prefer_css
50
+ def prefer_css=(_bool)
51
+ prefer_css_message
52
+ end
53
+
54
+ def prefer_css_message
55
+ warn <<-EOS
56
+ Watir#prefer_css is deprecated; all elements that can not be passed directly
57
+ as Selenium locators will be translated to XPath. To continue using CSS Selectors
58
+ require the watir_css gem - https://github.com/watir/watir_css
59
+ EOS
60
+ end
61
+
62
+ def default_timeout
63
+ @default_timeout ||= 30
47
64
  end
48
65
 
49
66
  #
50
- # Whether or not Watir should prefer CSS when translating the Watir selectors to Selenium.
51
- # Defaults to false.
67
+ # Default wait time for wait methods.
52
68
  #
53
69
 
54
- def prefer_css=(bool)
55
- @prefer_css = bool
70
+ def default_timeout=(value)
71
+ @default_timeout = value
56
72
  end
57
73
 
58
74
  def locator_namespace
@@ -8,7 +8,6 @@ module Watir
8
8
  end
9
9
 
10
10
  load :fireEvent
11
- load :getAttribute
12
11
  load :getOuterHtml
13
12
  load :getInnerHtml
14
13
  load :getParentElement
@@ -152,9 +152,9 @@ module Watir
152
152
  # Returns browser name.
153
153
  #
154
154
  # @example
155
- # browser = Watir::Browser.new :chrome
155
+ # browser = Watir::Browser.new :phantomjs
156
156
  # browser.name
157
- # #=> :chrome
157
+ # #=> :phantomjs
158
158
  #
159
159
  # @return [Symbol]
160
160
  #
@@ -7,8 +7,8 @@ module Watir
7
7
  class ElementCollection
8
8
  include Enumerable
9
9
 
10
- def initialize(parent, selector)
11
- @parent = parent
10
+ def initialize(query_scope, selector)
11
+ @query_scope = query_scope
12
12
  @selector = selector
13
13
  end
14
14
 
@@ -50,7 +50,7 @@ module Watir
50
50
  #
51
51
 
52
52
  def [](idx)
53
- to_a[idx] || element_class.new(@parent, @selector.merge(index: idx))
53
+ to_a[idx] || element_class.new(@query_scope, @selector.merge(index: idx))
54
54
  end
55
55
 
56
56
  #
@@ -81,17 +81,17 @@ module Watir
81
81
 
82
82
  def to_a
83
83
  # TODO: optimize - lazy element_class instance?
84
- @to_a ||= elements.map { |e| element_class.new(@parent, element: e) }
84
+ @to_a ||= elements.map { |e| element_class.new(@query_scope, element: e) }
85
85
  end
86
86
 
87
87
  private
88
88
 
89
89
  def elements
90
- @parent.is_a?(IFrame) ? @parent.switch_to! : @parent.send(:assert_exists)
90
+ @query_scope.is_a?(IFrame) ? @query_scope.switch_to! : @query_scope.send(:assert_exists)
91
91
 
92
92
  element_validator = element_validator_class.new
93
- selector_builder = selector_builder_class.new(@parent, @selector, element_class.attribute_list)
94
- locator = locator_class.new(@parent, @selector, selector_builder, element_validator)
93
+ selector_builder = selector_builder_class.new(@query_scope, @selector, element_class.attribute_list)
94
+ locator = locator_class.new(@query_scope, @selector, selector_builder, element_validator)
95
95
 
96
96
  @elements ||= locator.locate_all
97
97
  end
@@ -22,10 +22,10 @@ module Watir
22
22
  attribute String, :id, :id
23
23
  attribute String, :class_name, :className
24
24
 
25
- def initialize(parent, selector)
26
- @parent = parent
25
+ def initialize(query_scope, selector)
26
+ @query_scope = query_scope
27
27
  @selector = selector
28
- @element = nil
28
+ @element = nil
29
29
 
30
30
  unless @selector.kind_of? Hash
31
31
  raise ArgumentError, "invalid argument: #{selector.inspect}"
@@ -371,7 +371,7 @@ module Watir
371
371
  e = element_call { execute_atom :getParentElement, @element }
372
372
 
373
373
  if e.kind_of?(Selenium::WebDriver::Element)
374
- Watir.element_class_for(e.tag_name.downcase).new(@parent, element: e)
374
+ Watir.element_class_for(e.tag_name.downcase).new(@query_scope, element: e)
375
375
  end
376
376
  end
377
377
 
@@ -380,7 +380,7 @@ module Watir
380
380
  #
381
381
 
382
382
  def driver
383
- @parent.driver
383
+ @query_scope.driver
384
384
  end
385
385
 
386
386
  #
@@ -407,6 +407,7 @@ module Watir
407
407
  # Returns true if this element is present and enabled on the page.
408
408
  #
409
409
  # @return [Boolean]
410
+ # @see Watir::Wait
410
411
  #
411
412
 
412
413
  def enabled?
@@ -480,7 +481,7 @@ module Watir
480
481
  klass = Watir.element_class_for(tag_name)
481
482
  end
482
483
 
483
- klass.new(@parent, element: elem)
484
+ klass.new(@query_scope, element: elem)
484
485
  end
485
486
 
486
487
  #
@@ -490,7 +491,22 @@ module Watir
490
491
  #
491
492
 
492
493
  def browser
493
- @parent.browser
494
+ @query_scope.browser
495
+ end
496
+
497
+ #
498
+ # Returns true if a previously located element is no longer attached to DOM.
499
+ #
500
+ # @return [Boolean]
501
+ # @see Watir::Wait
502
+ #
503
+
504
+ def stale?
505
+ raise Watir::Exception::Error, "Can not check staleness of unused element" unless @element
506
+ @element.enabled? # any wire call will check for staleness
507
+ false
508
+ rescue Selenium::WebDriver::Error::ObsoleteElementError
509
+ true
494
510
  end
495
511
 
496
512
  protected
@@ -508,29 +524,16 @@ module Watir
508
524
  assert_element_found
509
525
  end
510
526
 
511
- # Ensure that the element isn't stale, by relocating if it is (unless always_locate = false)
527
+ # Ensure that the element isn't stale, by relocating if it is
512
528
  def ensure_not_stale
529
+ ensure_context
530
+
513
531
  # Performance shortcut; only need recursive call to ensure context if stale in current context
514
532
  return unless stale?
515
-
516
- ensure_context
517
- if stale?
518
- if Watir.always_locate? && !@selector[:element]
519
- @element = locate
520
- else
521
- reset!
522
- end
523
- end
533
+ @element = @selector.key?(:element) ? nil : locate
524
534
  assert_element_found
525
535
  end
526
536
 
527
- def stale?
528
- @element.enabled? # any wire call will check for staleness
529
- false
530
- rescue Selenium::WebDriver::Error::ObsoleteElementError
531
- true
532
- end
533
-
534
537
  def assert_element_found
535
538
  unless @element
536
539
  raise UnknownObjectException, "unable to locate element, using #{selector_string}"
@@ -545,8 +548,8 @@ module Watir
545
548
  ensure_context
546
549
 
547
550
  element_validator = element_validator_class.new
548
- selector_builder = selector_builder_class.new(@parent, @selector, self.class.attribute_list)
549
- locator = locator_class.new(@parent, @selector, selector_builder, element_validator)
551
+ selector_builder = selector_builder_class.new(@query_scope, @selector, self.class.attribute_list)
552
+ locator = locator_class.new(@query_scope, @selector, selector_builder, element_validator)
550
553
 
551
554
  locator.locate
552
555
  end
@@ -581,14 +584,11 @@ module Watir
581
584
 
582
585
  # Ensure the driver is in the desired browser context
583
586
  def ensure_context
584
- @parent.is_a?(IFrame) ? @parent.switch_to! : @parent.assert_exists
587
+ @query_scope.is_a?(IFrame) ? @query_scope.switch_to! : @query_scope.assert_exists
585
588
  end
586
589
 
587
- def attribute?(attribute)
588
- assert_exists
589
- element_call do
590
- !!execute_atom(:getAttribute, @element, attribute.to_s.downcase)
591
- end
590
+ def attribute?(attribute_name)
591
+ !attribute_value(attribute_name).nil?
592
592
  end
593
593
 
594
594
  def assert_enabled
@@ -620,11 +620,7 @@ module Watir
620
620
  def element_call
621
621
  yield
622
622
  rescue Selenium::WebDriver::Error::StaleElementReferenceError
623
- if Watir.always_locate? && !@selector[:element]
624
- @element = locate
625
- else
626
- reset!
627
- end
623
+ @element = @selector.key?(:element) ? nil : locate
628
624
  assert_element_found
629
625
  retry
630
626
  end
@@ -2,12 +2,12 @@ module Watir
2
2
  class IFrame < HTMLElement
3
3
 
4
4
  def locate
5
- @parent.assert_exists
5
+ @query_scope.assert_exists
6
6
 
7
7
  selector = @selector.merge(tag_name: frame_tag)
8
8
  element_validator = element_validator_class.new
9
- selector_builder = selector_builder_class.new(@parent, selector, self.class.attribute_list)
10
- locator = locator_class.new(@parent, selector, selector_builder, element_validator)
9
+ selector_builder = selector_builder_class.new(@query_scope, selector, self.class.attribute_list)
10
+ locator = locator_class.new(@query_scope, selector, selector_builder, element_validator)
11
11
 
12
12
  element = locator.locate
13
13
  element or raise UnknownFrameException, "unable to locate #{@selector[:tag_name]} using #{selector_string}"
@@ -69,7 +69,7 @@ module Watir
69
69
  # index will return nil. That's why `#all_elements` should always
70
70
  # be called after `#elements.`
71
71
  element_indexes = elements.map { |el| all_elements.index(el) }
72
- element_indexes.map { |idx| element_class.new(@parent, tag_name: @selector[:tag_name], index: idx) }
72
+ element_indexes.map { |idx| element_class.new(@query_scope, tag_name: @selector[:tag_name], index: idx) }
73
73
  end
74
74
 
75
75
  private
@@ -78,8 +78,8 @@ module Watir
78
78
  selector = { tag_name: @selector[:tag_name] }
79
79
 
80
80
  element_validator = element_validator_class.new
81
- selector_builder = selector_builder_class.new(@parent, selector, element_class.attribute_list)
82
- locator = locator_class.new(@parent, selector, selector_builder, element_validator)
81
+ selector_builder = selector_builder_class.new(@query_scope, selector, element_class.attribute_list)
82
+ locator = locator_class.new(@query_scope, selector, selector_builder, element_validator)
83
83
 
84
84
  locator.locate_all
85
85
  end
@@ -2,7 +2,7 @@ module Watir
2
2
  class TextField < Input
3
3
  include UserEditable
4
4
 
5
- NON_TEXT_TYPES = %w[file radio checkbox submit reset image button hidden datetime date month week time datetime-local range color]
5
+ NON_TEXT_TYPES = %w[file radio checkbox submit reset image button hidden range color]
6
6
 
7
7
  inherit_attributes_from Watir::TextArea
8
8
  remove_method :type # we want Input#type here, which was overriden by TextArea's attributes
@@ -1,5 +1,6 @@
1
1
  require 'watir/locators/element/locator'
2
2
  require 'watir/locators/element/selector_builder'
3
+ require 'watir/locators/element/selector_builder/xpath'
3
4
  require 'watir/locators/element/validator'
4
5
 
5
6
  require 'watir/locators/button/locator'
@@ -28,8 +28,8 @@ module Watir
28
28
  \z
29
29
  }x
30
30
 
31
- def initialize(parent, selector, selector_builder, element_validator)
32
- @parent = parent # either element or browser
31
+ def initialize(query_scope, selector, selector_builder, element_validator)
32
+ @query_scope = query_scope # either element or browser
33
33
  @selector = selector.dup
34
34
  @selector_builder = selector_builder
35
35
  @element_validator = element_validator
@@ -72,7 +72,7 @@ module Watir
72
72
  tag_name = selector.delete(:tag_name)
73
73
  return unless selector.empty? # multiple attributes
74
74
 
75
- element = @parent.wd.find_element(:id, id)
75
+ element = @query_scope.wd.find_element(:id, id)
76
76
  return if tag_name && !element_validator.validate(element, selector)
77
77
 
78
78
  element
@@ -98,9 +98,9 @@ module Watir
98
98
  if how
99
99
  # could build xpath/css for selector
100
100
  if idx
101
- @parent.wd.find_elements(how, what)[idx]
101
+ @query_scope.wd.find_elements(how, what)[idx]
102
102
  else
103
- @parent.wd.find_element(how, what)
103
+ @query_scope.wd.find_element(how, what)
104
104
  end
105
105
  else
106
106
  # can't use xpath, probably a regexp in there
@@ -132,7 +132,7 @@ module Watir
132
132
 
133
133
  how, what = selector_builder.build(selector)
134
134
  if how
135
- @parent.wd.find_elements(how, what)
135
+ @query_scope.wd.find_elements(how, what)
136
136
  else
137
137
  wd_find_by_regexp_selector(selector, :select)
138
138
  end
@@ -140,7 +140,7 @@ module Watir
140
140
 
141
141
  def wd_find_all_by(how, what)
142
142
  if what.is_a? String
143
- @parent.wd.find_elements(how, what)
143
+ @query_scope.wd.find_elements(how, what)
144
144
  else
145
145
  all_elements.select { |element| fetch_value(element, how) =~ what }
146
146
  end
@@ -160,19 +160,19 @@ module Watir
160
160
  end
161
161
 
162
162
  def all_elements
163
- @parent.wd.find_elements(xpath: ".//*")
163
+ @query_scope.wd.find_elements(xpath: ".//*")
164
164
  end
165
165
 
166
166
  def wd_find_first_by(how, what)
167
167
  if what.is_a? String
168
- @parent.wd.find_element(how, what)
168
+ @query_scope.wd.find_element(how, what)
169
169
  else
170
170
  all_elements.find { |element| fetch_value(element, how) =~ what }
171
171
  end
172
172
  end
173
173
 
174
174
  def wd_find_by_regexp_selector(selector, method = :find)
175
- parent = @parent.wd
175
+ query_scope = @query_scope.wd
176
176
  rx_selector = delete_regexps_from(selector)
177
177
 
178
178
  if rx_selector.key?(:label) && selector_builder.should_use_label_element?
@@ -180,7 +180,7 @@ module Watir
180
180
  if (id = label.attribute(:for))
181
181
  selector[:id] = id
182
182
  else
183
- parent = label
183
+ query_scope = label
184
184
  end
185
185
  end
186
186
 
@@ -199,7 +199,7 @@ module Watir
199
199
  end
200
200
  end
201
201
 
202
- elements = parent.find_elements(how, what)
202
+ elements = query_scope.find_elements(how, what)
203
203
  elements.__send__(method) { |el| matches_selector?(el, rx_selector) }
204
204
  end
205
205
 
@@ -217,7 +217,7 @@ module Watir
217
217
 
218
218
  def label_from_text(label_exp)
219
219
  # TODO: this won't work correctly if @wd is a sub-element
220
- @parent.wd.find_elements(:tag_name, 'label').find do |el|
220
+ @query_scope.wd.find_elements(:tag_name, 'label').find do |el|
221
221
  matches_selector?(el, text: label_exp)
222
222
  end
223
223
  end
@@ -1,6 +1,3 @@
1
- require 'watir/locators/element/selector_builder/css'
2
- require 'watir/locators/element/selector_builder/xpath'
3
-
4
1
  module Watir
5
2
  module Locators
6
3
  class Element
@@ -8,8 +5,8 @@ module Watir
8
5
  VALID_WHATS = [String, Regexp]
9
6
  WILDCARD_ATTRIBUTE = /^(aria|data)_(.+)$/
10
7
 
11
- def initialize(parent, selector, valid_attributes)
12
- @parent = parent # either element or browser
8
+ def initialize(query_scope, selector, valid_attributes)
9
+ @query_scope = query_scope # either element or browser
13
10
  @selector = selector
14
11
  @valid_attributes = valid_attributes
15
12
  end
@@ -98,9 +95,8 @@ module Watir
98
95
  end
99
96
 
100
97
  def build_wd_selector(selectors)
101
- unless selectors.values.any? { |e| e.is_a? Regexp }
102
- build_css(selectors) || build_xpath(selectors)
103
- end
98
+ return if selectors.values.any? { |e| e.is_a? Regexp }
99
+ build_xpath(selectors)
104
100
  end
105
101
 
106
102
  def valid_attribute?(attribute)
@@ -122,25 +118,12 @@ module Watir
122
118
  xpath_builder.build(selectors)
123
119
  end
124
120
 
125
- def build_css(selectors)
126
- css_builder.build(selectors)
127
- end
128
-
129
121
  def xpath_builder_class
130
122
  Kernel.const_get("#{self.class.name}::XPath")
131
123
  rescue
132
124
  XPath
133
125
  end
134
126
 
135
- def css_builder
136
- @css_builder ||= css_builder_class.new
137
- end
138
-
139
- def css_builder_class
140
- Kernel.const_get("#{self.class.name}::CSS")
141
- rescue
142
- CSS
143
- end
144
127
  end
145
128
  end
146
129
  end
@@ -7,7 +7,7 @@ module Watir
7
7
  selectors.delete(:tag_name) || raise("internal error: no tag_name?!")
8
8
 
9
9
  expressions = %w[./tr]
10
- unless %w[tbody tfoot thead].include?(@parent.tag_name.downcase)
10
+ unless %w[tbody tfoot thead].include?(@query_scope.tag_name.downcase)
11
11
  expressions += %w[./tbody/tr ./thead/tr ./tfoot/tr]
12
12
  end
13
13
 
@@ -242,8 +242,24 @@ module Watir
242
242
  timeout ||= Watir.default_timeout
243
243
  message = "waiting for #{selector_string} to disappear"
244
244
  Watir::Wait.while(timeout, message) { present? }
245
- rescue Selenium::WebDriver::Error::StaleElementReferenceError
246
- # it's not present
245
+ end
246
+
247
+ #
248
+ # Waits until the element is stale.
249
+ #
250
+ # @example
251
+ # browser.text_field(name: "abrakadbra").wait_until_stale
252
+ #
253
+ # @param [Fixnum] timeout seconds to wait before timing out
254
+ #
255
+ # @see Watir::Wait
256
+ # @see Watir::Element#stale?
257
+ #
258
+
259
+ def wait_until_stale(timeout = nil)
260
+ timeout ||= Watir.default_timeout
261
+ message = "waiting for #{selector_string} to become stale"
262
+ Watir::Wait.until(timeout, message) { stale? }
247
263
  end
248
264
 
249
265
  end # EventuallyPresent
@@ -46,24 +46,22 @@ describe Watir::Browser do
46
46
  end
47
47
  end
48
48
 
49
- bug "https://bugzilla.mozilla.org/show_bug.cgi?id=1260233", :firefox do
50
- describe "#send_key{,s}" do
51
- it "sends keystrokes to the active element" do
52
- browser.goto WatirSpec.url_for "forms_with_input_elements.html"
49
+ describe "#send_key{,s}" do
50
+ it "sends keystrokes to the active element" do
51
+ browser.goto WatirSpec.url_for "forms_with_input_elements.html"
53
52
 
54
- browser.send_keys "hello"
55
- expect(browser.text_field(id: "new_user_first_name").value).to eq "hello"
56
- end
53
+ browser.send_keys "hello"
54
+ expect(browser.text_field(id: "new_user_first_name").value).to eq "hello"
55
+ end
57
56
 
58
- it "sends keys to a frame" do
59
- browser.goto WatirSpec.url_for "frames.html"
60
- tf = browser.frame.text_field(id: "senderElement")
61
- tf.clear
57
+ it "sends keys to a frame" do
58
+ browser.goto WatirSpec.url_for "frames.html"
59
+ tf = browser.frame.text_field(id: "senderElement")
60
+ tf.clear
62
61
 
63
- browser.frame.send_keys "hello"
62
+ browser.frame.send_keys "hello"
64
63
 
65
- expect(tf.value).to eq "hello"
66
- end
64
+ expect(tf.value).to eq "hello"
67
65
  end
68
66
  end
69
67
 
@@ -15,42 +15,26 @@ describe Watir::Locators::Element::Locator do
15
15
 
16
16
  describe "with selectors not supported by Selenium" do
17
17
  it "handles selector with tag name and a single attribute" do
18
- if Watir.prefer_css?
19
- expect_one :css, 'div[title="foo"]'
20
- else
21
- expect_one :xpath, ".//div[@title='foo']"
22
- end
18
+ expect_one :xpath, ".//div[@title='foo']"
23
19
 
24
20
  locate_one tag_name: "div",
25
21
  title: "foo"
26
22
  end
27
23
 
28
24
  it "handles selector with no tag name and and a single attribute" do
29
- if Watir.prefer_css?
30
- expect_one :css, '[title="foo"]'
31
- else
32
- expect_one :xpath, ".//*[@title='foo']"
33
- end
25
+ expect_one :xpath, ".//*[@title='foo']"
34
26
 
35
27
  locate_one title: "foo"
36
28
  end
37
29
 
38
30
  it "handles single quotes in the attribute string" do
39
- if Watir.prefer_css?
40
- expect_one :css, %{[title="foo and 'bar'"]}
41
- else
42
- expect_one :xpath, %{.//*[@title=concat('foo and ',"'",'bar',"'",'')]}
43
- end
31
+ expect_one :xpath, %{.//*[@title=concat('foo and ',"'",'bar',"'",'')]}
44
32
 
45
33
  locate_one title: "foo and 'bar'"
46
34
  end
47
35
 
48
36
  it "handles selector with tag name and multiple attributes" do
49
- if Watir.prefer_css?
50
- expect_one :css, 'div[title="foo"][dir="bar"]'
51
- else
52
- expect_one :xpath, ".//div[@title='foo' and @dir='bar']"
53
- end
37
+ expect_one :xpath, ".//div[@title='foo' and @dir='bar']"
54
38
 
55
39
  locate_one [:tag_name, "div",
56
40
  :title , "foo",
@@ -58,11 +42,7 @@ describe Watir::Locators::Element::Locator do
58
42
  end
59
43
 
60
44
  it "handles selector with no tag name and multiple attributes" do
61
- if Watir.prefer_css?
62
- expect_one :css, '[dir="foo"][title="bar"]'
63
- else
64
- expect_one :xpath, ".//*[@dir='foo' and @title='bar']"
65
- end
45
+ expect_one :xpath, ".//*[@dir='foo' and @title='bar']"
66
46
 
67
47
  locate_one [:dir, "foo",
68
48
  :title, "bar"]
@@ -84,44 +64,28 @@ describe Watir::Locators::Element::Locator do
84
64
  end
85
65
 
86
66
  it "translates :class_name to :class" do
87
- if Watir.prefer_css?
88
- expect_one :css, "div.foo"
89
- else
90
- expect_one :xpath, ".//div[contains(concat(' ', @class, ' '), ' foo ')]"
91
- end
67
+ expect_one :xpath, ".//div[contains(concat(' ', @class, ' '), ' foo ')]"
92
68
 
93
69
  locate_one tag_name: "div",
94
70
  class_name: "foo"
95
71
  end
96
72
 
97
73
  it "handles data-* attributes" do
98
- if Watir.prefer_css?
99
- expect_one :css, 'div[data-name="foo"]'
100
- else
101
- expect_one :xpath, ".//div[@data-name='foo']"
102
- end
74
+ expect_one :xpath, ".//div[@data-name='foo']"
103
75
 
104
76
  locate_one tag_name: "div",
105
77
  data_name: "foo"
106
78
  end
107
79
 
108
80
  it "handles aria-* attributes" do
109
- if Watir.prefer_css?
110
- expect_one :css, 'div[aria-label="foo"]'
111
- else
112
- expect_one :xpath, ".//div[@aria-label='foo']"
113
- end
81
+ expect_one :xpath, ".//div[@aria-label='foo']"
114
82
 
115
83
  locate_one tag_name: "div",
116
84
  aria_label: "foo"
117
85
  end
118
86
 
119
87
  it "normalizes space for the :href attribute" do
120
- if Watir.prefer_css?
121
- expect_one :css, 'a[href~="foo"]'
122
- else
123
- expect_one :xpath, ".//a[normalize-space(@href)='foo']"
124
- end
88
+ expect_one :xpath, ".//a[normalize-space(@href)='foo']"
125
89
 
126
90
  selector = {
127
91
  tag_name: "a",
@@ -164,11 +128,7 @@ describe Watir::Locators::Element::Locator do
164
128
  end
165
129
 
166
130
  it "translates ruby attribute names to content attribute names" do
167
- if Watir.prefer_css?
168
- expect_one :css, 'meta[http-equiv="foo"]'
169
- else
170
- expect_one :xpath, ".//meta[@http-equiv='foo']"
171
- end
131
+ expect_one :xpath, ".//meta[@http-equiv='foo']"
172
132
 
173
133
  selector = {
174
134
  tag_name: "meta",
@@ -188,11 +148,7 @@ describe Watir::Locators::Element::Locator do
188
148
  element(tag_name: "div", attributes: { class: "foob"})
189
149
  ]
190
150
 
191
- if Watir.prefer_css?
192
- expect_all(:css, "div").and_return(elements)
193
- else
194
- expect_all(:xpath, "(.//div)[contains(@class, 'oob')]").and_return(elements)
195
- end
151
+ expect_all(:xpath, "(.//div)[contains(@class, 'oob')]").and_return(elements)
196
152
 
197
153
  expect(locate_one(tag_name: "div", class: /oob/)).to eq elements[1]
198
154
  end
@@ -203,11 +159,7 @@ describe Watir::Locators::Element::Locator do
203
159
  element(tag_name: "div", attributes: { class: "foo" })
204
160
  ]
205
161
 
206
- if Watir.prefer_css?
207
- expect_all(:css, "div").and_return(elements)
208
- else
209
- expect_all(:xpath, "(.//div)[contains(@class, 'foo')]").and_return(elements)
210
- end
162
+ expect_all(:xpath, "(.//div)[contains(@class, 'foo')]").and_return(elements)
211
163
 
212
164
  selector = {
213
165
  tag_name: "div",
@@ -256,11 +208,7 @@ describe Watir::Locators::Element::Locator do
256
208
  element(tag_name: "div", attributes: { dir: "foo", title: "baz" })
257
209
  ]
258
210
 
259
- if Watir.prefer_css?
260
- expect_all(:css, 'div[dir="foo"]').and_return(elements)
261
- else
262
- expect_all(:xpath, "(.//div[@dir='foo'])[contains(@title, 'baz')]").and_return(elements)
263
- end
211
+ expect_all(:xpath, "(.//div[@dir='foo'])[contains(@title, 'baz')]").and_return(elements)
264
212
 
265
213
  selector = {
266
214
  tag_name: "div",
@@ -277,12 +225,7 @@ describe Watir::Locators::Element::Locator do
277
225
  element(tag_name: "div", attributes: { :'data-automation-id' => "bar" })
278
226
  ]
279
227
 
280
- if Watir.prefer_css?
281
- expect_all(:css, 'div').and_return(elements)
282
- else
283
- expect_all(:xpath, "(.//div)[contains(@data-automation-id, 'bar')]").and_return(elements)
284
- end
285
-
228
+ expect_all(:xpath, "(.//div)[contains(@data-automation-id, 'bar')]").and_return(elements)
286
229
 
287
230
  selector = {
288
231
  tag_name: "div",
@@ -300,13 +243,7 @@ describe Watir::Locators::Element::Locator do
300
243
  div_elements = [element(tag_name: "div")]
301
244
 
302
245
  expect_all(:tag_name, "label").ordered.and_return(label_elements)
303
-
304
- if Watir.prefer_css?
305
- expect_all(:css, 'div[id="baz"]').ordered.and_return(div_elements)
306
- else
307
- expect_all(:xpath, ".//div[@id='baz']").ordered.and_return(div_elements)
308
- end
309
-
246
+ expect_all(:xpath, ".//div[@id='baz']").ordered.and_return(div_elements)
310
247
  expect(locate_one(tag_name: "div", label: /oob/)).to eq div_elements.first
311
248
  end
312
249
 
@@ -323,11 +260,7 @@ describe Watir::Locators::Element::Locator do
323
260
  element(tag_name: "div")
324
261
  ]
325
262
 
326
- if Watir.prefer_css?
327
- expect_all(:css, 'div[dir="foo"]').and_return(elements)
328
- else
329
- expect_all(:xpath, ".//div[@dir='foo']").and_return(elements)
330
- end
263
+ expect_all(:xpath, ".//div[@dir='foo']").and_return(elements)
331
264
 
332
265
  selector = {
333
266
  tag_name: "div",
@@ -382,35 +315,20 @@ describe Watir::Locators::Element::Locator do
382
315
 
383
316
  describe "with an empty selector" do
384
317
  it "finds all when an empty selctor is given" do
385
- if Watir.prefer_css?
386
- expect_all :css, '*'
387
- else
388
- expect_all :xpath, './/*'
389
- end
390
-
318
+ expect_all :xpath, './/*'
391
319
  locate_all({})
392
320
  end
393
321
  end
394
322
 
395
323
  describe "with selectors not supported by Selenium" do
396
324
  it "handles selector with tag name and a single attribute" do
397
- if Watir.prefer_css?
398
- expect_all :css, 'div[dir="foo"]'
399
- else
400
- expect_all :xpath, ".//div[@dir='foo']"
401
- end
402
-
325
+ expect_all :xpath, ".//div[@dir='foo']"
403
326
  locate_all tag_name: "div",
404
327
  dir: "foo"
405
328
  end
406
329
 
407
330
  it "handles selector with tag name and multiple attributes" do
408
- if Watir.prefer_css?
409
- expect_all :css, 'div[dir="foo"][title="bar"]'
410
- else
411
- expect_all :xpath, ".//div[@dir='foo' and @title='bar']"
412
- end
413
-
331
+ expect_all :xpath, ".//div[@dir='foo' and @title='bar']"
414
332
  locate_all [:tag_name, "div",
415
333
  :dir , "foo",
416
334
  :title , 'bar']
@@ -426,12 +344,7 @@ describe Watir::Locators::Element::Locator do
426
344
  element(tag_name: "div", attributes: { class: "noob"})
427
345
  ]
428
346
 
429
- if Watir.prefer_css?
430
- expect_all(:css, "div").and_return(elements)
431
- else
432
- expect_all(:xpath, "(.//div)[contains(@class, 'oob')]").and_return(elements)
433
- end
434
-
347
+ expect_all(:xpath, "(.//div)[contains(@class, 'oob')]").and_return(elements)
435
348
  expect(locate_all(tag_name: "div", class: /oob/)).to eq elements.last(3)
436
349
  end
437
350
 
@@ -442,11 +355,7 @@ describe Watir::Locators::Element::Locator do
442
355
  element(tag_name: "div", attributes: { dir: "foo", title: "bazt"})
443
356
  ]
444
357
 
445
- if Watir.prefer_css?
446
- expect_all(:css, 'div[dir="foo"]').and_return(elements)
447
- else
448
- expect_all(:xpath, "(.//div[@dir='foo'])[contains(@title, 'baz')]").and_return(elements)
449
- end
358
+ expect_all(:xpath, "(.//div[@dir='foo'])[contains(@title, 'baz')]").and_return(elements)
450
359
 
451
360
  selector = {
452
361
  tag_name: "div",
@@ -458,10 +367,6 @@ describe Watir::Locators::Element::Locator do
458
367
  end
459
368
 
460
369
  context "and xpath" do
461
- before do
462
- expect(Watir).to receive(:prefer_css?).and_return(false)
463
- end
464
-
465
370
  it "converts a leading run of regexp literals to a contains() expression" do
466
371
  elements = [
467
372
  element(tag_name: "div", attributes: { class: "foo" }),
@@ -93,11 +93,7 @@ describe Watir::Element do
93
93
  watir_element.send(:element_call) { watir_element.instance_variable_get('@element').text }
94
94
  end
95
95
 
96
- if Watir.always_locate?
97
- expect { watir_element.text }.to_not raise_error
98
- else
99
- expect { watir_element.text }.to raise_error Watir::Exception::UnknownObjectException
100
- end
96
+ expect { watir_element.text }.to_not raise_error
101
97
  end
102
98
 
103
99
  end
@@ -11,14 +11,6 @@ require 'rspec'
11
11
 
12
12
  include Watir
13
13
 
14
- if ENV['ALWAYS_LOCATE'] == "false"
15
- Watir.always_locate = false
16
- end
17
-
18
- if ENV['PREFER_CSS']
19
- Watir.prefer_css = true
20
- end
21
-
22
14
  SELENIUM_SELECTORS = %i(class class_name css id tag_name xpath)
23
15
 
24
16
  if ENV['TRAVIS']
@@ -14,7 +14,9 @@ fi
14
14
  if [[ "$RAKE_TASK" = "spec:chrome" ]] || [[ "$RAKE_TASK" = "yard:doctest" ]]; then
15
15
  # https://omahaproxy.appspot.com
16
16
  # https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Linux_x64/
17
- CHROME_REVISION=386257
17
+ # CHROME_REVISION=`curl -s http://commondatastorage.googleapis.com/chromium-browser-snapshots/Linux_x64/LAST_CHANGE`
18
+ CHROME_REVISION=417841
19
+
18
20
  curl -L -O "http://commondatastorage.googleapis.com/chromium-browser-snapshots/Linux_x64/${CHROME_REVISION}/chrome-linux.zip"
19
21
  unzip chrome-linux.zip
20
22
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'watir'
5
- s.version = '6.0.0.beta3'
5
+ s.version = '6.0.0.beta4'
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.0.0.beta3
4
+ version: 6.0.0.beta4
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: 2016-08-07 00:00:00.000000000 Z
12
+ date: 2016-09-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: selenium-webdriver
@@ -206,7 +206,6 @@ files:
206
206
  - lib/watir/atoms.rb
207
207
  - lib/watir/atoms/README
208
208
  - lib/watir/atoms/fireEvent.js
209
- - lib/watir/atoms/getAttribute.js
210
209
  - lib/watir/atoms/getInnerHtml.js
211
210
  - lib/watir/atoms/getOuterHtml.js
212
211
  - lib/watir/atoms/getParentElement.js
@@ -271,7 +270,6 @@ files:
271
270
  - lib/watir/locators/cell/selector_builder.rb
272
271
  - lib/watir/locators/element/locator.rb
273
272
  - lib/watir/locators/element/selector_builder.rb
274
- - lib/watir/locators/element/selector_builder/css.rb
275
273
  - lib/watir/locators/element/selector_builder/xpath.rb
276
274
  - lib/watir/locators/element/validator.rb
277
275
  - lib/watir/locators/row/locator.rb
@@ -289,7 +287,6 @@ files:
289
287
  - lib/watir/wait/timer.rb
290
288
  - lib/watir/window.rb
291
289
  - lib/watir/xpath_support.rb
292
- - spec/always_locate_spec.rb
293
290
  - spec/browser_spec.rb
294
291
  - spec/click_spec.rb
295
292
  - spec/container_spec.rb
@@ -329,7 +326,6 @@ signing_key:
329
326
  specification_version: 4
330
327
  summary: Watir powered by Selenium
331
328
  test_files:
332
- - spec/always_locate_spec.rb
333
329
  - spec/browser_spec.rb
334
330
  - spec/click_spec.rb
335
331
  - spec/container_spec.rb
@@ -1,18 +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=null,e=this;function f(b,a){function c(){}c.prototype=a.prototype;b.g=a.prototype;b.prototype=new c};function g(b){for(var a=1;a<arguments.length;a++)var c=String(arguments[a]).replace(/\$/g,"$$$$"),b=b.replace(/\%s/,c);return b}function i(b){return b.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")}function j(b,a){if(b<a)return-1;else if(b>a)return 1;return 0};var k,l,m,p;function q(){return e.navigator?e.navigator.userAgent:d}p=m=l=k=!1;var r;if(r=q()){var s=e.navigator;k=r.indexOf("Opera")==0;l=!k&&r.indexOf("MSIE")!=-1;m=!k&&r.indexOf("WebKit")!=-1;p=!k&&!m&&s.product=="Gecko"}var t=l,u=p,x=m,y;
15
- a:{var z="",A;if(k&&e.opera)var B=e.opera.version,z=typeof B=="function"?B():B;else if(u?A=/rv\:([^\);]+)(\)|;)/:t?A=/MSIE\s+([^\);]+)(\)|;)/:x&&(A=/WebKit\/(\S+)/),A)var C=A.exec(q()),z=C?C[1]:"";if(t){var D,E=e.document;D=E?E.documentMode:void 0;if(D>parseFloat(z)){y=String(D);break a}}y=z}var F={};
16
- function G(b){var a;if(!(a=F[b])){a=0;for(var c=i(String(y)).split("."),h=i(String(b)).split("."),v=Math.max(c.length,h.length),w=0;a==0&&w<v;w++){var U=c[w]||"",V=h[w]||"",W=RegExp("(\\d*)(\\D*)","g"),X=RegExp("(\\d*)(\\D*)","g");do{var n=W.exec(U)||["","",""],o=X.exec(V)||["","",""];if(n[0].length==0&&o[0].length==0)break;a=j(n[1].length==0?0:parseInt(n[1],10),o[1].length==0?0:parseInt(o[1],10))||j(n[2].length==0,o[2].length==0)||j(n[2],o[2])}while(a==0)}a=F[b]=a>=0}return a};function H(b){this.stack=Error().stack||"";if(b)this.message=String(b)}f(H,Error);H.prototype.name="CustomError";function I(b,a){H.call(this,a);this.code=b;this.name=J[b]||J[13]}f(I,H);
17
- var J,K={NoSuchElementError:7,NoSuchFrameError:8,UnknownCommandError:9,StaleElementReferenceError:10,ElementNotVisibleError:11,InvalidElementStateError:12,UnknownError:13,ElementNotSelectableError:15,XPathLookupError:19,NoSuchWindowError:23,InvalidCookieDomainError:24,UnableToSetCookieError:25,ModalDialogOpenedError:26,NoModalDialogOpenError:27,ScriptTimeoutError:28,InvalidSelectorError:32,SqlDatabaseError:33,MoveTargetOutOfBoundsError:34},L={},M;for(M in K)L[K[M]]=M;J=L;
18
- I.prototype.toString=function(){return"["+this.name+"] "+this.message};function N(b,a){a.unshift(b);H.call(this,g.apply(d,a));a.shift();this.f=b}f(N,H);N.prototype.name="AssertionError";function O(b){var a=P;if(typeof a=="string"){if(typeof b!="string"||b.length!=1)return-1;return a.indexOf(b,0)}for(var c=0;c<a.length;c++)if(c in a&&a[c]===b)return c;return-1};!t||G("9");!u&&!t||t&&G("9")||u&&G("1.9.1");t&&G("9");function Q(b,a,c,h,v){this.b=!!a;if(b&&(this.a=b))this.c=typeof h=="number"?h:this.a.nodeType!=1?0:this.b?-1:1;this.d=v!=void 0?v:this.c||0;this.b&&(this.d*=-1);this.e=!c}f(Q,function(){});Q.prototype.a=d;Q.prototype.c=0;f(function(b,a,c,h){Q.call(this,b,a,c,d,h)},Q);var P=["async","autofocus","autoplay","checked","compact","complete","controls","declare","defaultchecked","defaultselected","defer","disabled","draggable","ended","formnovalidate","hidden","indeterminate","iscontenteditable","ismap","itemscope","loop","multiple","muted","nohref","noresize","noshade","novalidate","nowrap","open","paused","pubdate","readonly","required","reversed","scoped","seamless","seeking","selected","spellcheck","truespeed","willvalidate"];function R(b,a){if(8==b.nodeType)return d;a=a.toLowerCase();if(a=="style"){var c=i(b.style.cssText).toLowerCase();return c.charAt(c.length-1)==";"?c:c+";"}c=b.getAttributeNode(a);t&&!c&&G(8)&&O(a)>=0&&(c=b[a]);if(!c)return d;if(O(a)>=0)return t&&c.value=="false"?d:"true";return c.specified?c.value:d}var S="_".split("."),T=e;!(S[0]in T)&&T.execScript&&T.execScript("var "+S[0]);for(var Y;S.length&&(Y=S.shift());)!S.length&&R!==void 0?T[Y]=R:T=T[Y]?T[Y]:T[Y]={};; return this._.apply(null,arguments);}.apply({navigator:typeof window!='undefined'?window.navigator:null}, arguments);}
@@ -1,65 +0,0 @@
1
- module Watir
2
- module Locators
3
- class Element
4
- class SelectorBuilder
5
- class CSS
6
- def build(selectors)
7
- return unless use_css?(selectors)
8
-
9
- if selectors.empty?
10
- css = '*'
11
- else
12
- css = ''
13
- css << (selectors.delete(:tag_name) || '')
14
-
15
- klass = selectors.delete(:class)
16
- if klass
17
- if klass.include? ' '
18
- css << %([class="#{css_escape klass}"])
19
- else
20
- css << ".#{klass}"
21
- end
22
- end
23
-
24
- href = selectors.delete(:href)
25
- if href
26
- css << %([href~="#{css_escape href}"])
27
- end
28
-
29
- selectors.each do |key, value|
30
- key = key.to_s.tr("_", "-")
31
- css << %([#{key}="#{css_escape value}"]) # TODO: proper escaping
32
- end
33
- end
34
-
35
- [:css, css]
36
- end
37
-
38
- private
39
-
40
- def use_css?(selectors)
41
- return false unless Watir.prefer_css?
42
-
43
- if selectors.key?(:text) || selectors.key?(:label) || selectors.key?(:index)
44
- return false
45
- end
46
-
47
- if selectors[:tag_name] == 'input' && selectors.key?(:type)
48
- return false
49
- end
50
-
51
- if selectors.key?(:class) && selectors[:class] !~ /^[\w-]+$/ui
52
- return false
53
- end
54
-
55
- true
56
- end
57
-
58
- def css_escape(str)
59
- str.gsub('"', '\\"')
60
- end
61
- end
62
- end
63
- end
64
- end
65
- end
@@ -1,43 +0,0 @@
1
- require File.expand_path('watirspec/spec_helper', File.dirname(__FILE__))
2
-
3
- describe 'Watir' do
4
- describe '#always_locate?' do
5
-
6
- before do
7
- browser.goto WatirSpec.url_for('removed_element.html')
8
- end
9
-
10
- it 'determines whether #exist? returns false for stale element' do
11
- element = browser.div(id: "text")
12
- expect(element.exists?).to be true
13
-
14
- browser.refresh
15
-
16
- expect(element.exists?).to be Watir.always_locate?
17
- end
18
-
19
- it 'allows using cached elements regardless of setting, when element is not stale' do
20
- element = browser.div(id: "text")
21
- expect(element.exists?).to be true
22
-
23
- # exception raised if element is re-looked up
24
- allow(browser.driver).to receive(:find_element).with(:id, 'text') { raise }
25
-
26
- expect { element.exists? }.to_not raise_error
27
- end
28
-
29
- it 'determines whether an exception is raised when taking an action on a stale element' do
30
- element = browser.div(id: "text")
31
- expect(element.exists?).to be true
32
-
33
- browser.refresh
34
- browser.div(id: "text").wait_until_present
35
-
36
- if Watir.always_locate?
37
- expect { element.text }.to_not raise_error
38
- else
39
- expect { element.text }.to raise_error Watir::Exception::UnknownObjectException
40
- end
41
- end
42
- end
43
- end