watir 6.16.2 → 6.16.3

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: d9b4ce5fc3a28e83b85751052967ecdaa6d87b4d
4
- data.tar.gz: 82dc5e6c96e4f259c12865a198503b39674094b7
3
+ metadata.gz: b416cb3a4dcc8350fc8f8b5994f9b58e8b3fb1c0
4
+ data.tar.gz: 6fd65f2eda2bafd7993789c311852258481f7199
5
5
  SHA512:
6
- metadata.gz: f57ef0d029dd2c0bd703d416288a1f65cfd0a1aaab36e33bd79924b54ae5cb796774fa44e2a728e508d1af0cf8e11bb7b595851d0d59b3ee587c5feed42f808e
7
- data.tar.gz: 18f052aaca388fef0191bf23c115cac21bff5aed3f692d6e5c1794ef13cf555f6745f2b8b569f7f3a760a843226844f6ef53dc43ef9c95efb532bf0e6a7e9d67
6
+ metadata.gz: 767c776aa67bb214410cf07040fcc5531ee0f8bdee073f8535fe18b6eaeba2fe723eb8f48cdfb5394ff9258b0a898130a9881e140cdc22ebd550e34f15428e01
7
+ data.tar.gz: 0da908dc00c76f593dce7e7547505541b805cd031d1c17158ef268b03498d2d1133ae1115ea2e65ca30e0939f7c455d21791f89bad5bb014888b2daab033c03b
data/CHANGES.md CHANGED
@@ -1,3 +1,7 @@
1
+ ### 6.16.3 (2018-12-24)
2
+
3
+ * Minor adjustments to support locator extensions
4
+
1
5
  ### 6.16.2 (2018-12-24)
2
6
 
3
7
  * Fix bug merging scope when locating nested elements with css locator (#841)
@@ -15,7 +15,8 @@ module Watir
15
15
  def locate(built)
16
16
  @built = built.dup
17
17
  @driver_scope = locator_scope.wd
18
- matching_elements(@built, :first)
18
+ @filter = :first
19
+ matching_elements
19
20
  rescue Selenium::WebDriver::Error::NoSuchElementError
20
21
  nil
21
22
  end
@@ -23,37 +24,40 @@ module Watir
23
24
  def locate_all(built)
24
25
  @built = built.dup
25
26
  @driver_scope = locator_scope.wd
26
- raise ArgumentError, "can't locate all elements by :index" if built.key?(:index)
27
+ @filter = :all
27
28
 
28
- [matching_elements(@built, :all)].flatten
29
+ return [matching_elements].flatten unless @built.key?(:index)
30
+
31
+ raise ArgumentError, "can't locate all elements by :index"
29
32
  end
30
33
 
31
34
  private
32
35
 
33
- def matching_elements(built, filter)
34
- return locate_element(*built.to_a.flatten) if built.size == 1 && filter == :first
36
+ def matching_elements
37
+ return locate_element(*@built.to_a.flatten) if @built.size == 1 && @filter == :first
35
38
 
36
- wd_locator_key = (Watir::Locators::W3C_FINDERS & built.keys).first
37
- wd_locator = built.select { |k, _v| wd_locator_key == k }
38
- match_values = built.reject { |k, _v| wd_locator_key == k }
39
+ # SelectorBuilder only allows one of these
40
+ wd_locator_key = (Watir::Locators::W3C_FINDERS & @built.keys).first
41
+ wd_locator = @built.select { |k, _v| wd_locator_key == k }
42
+ match_values = @built.reject { |k, _v| wd_locator_key == k }
39
43
 
40
44
  # TODO: Wrap this to continue trying until default timeout
41
45
  retries = 0
42
46
  begin
43
47
  elements = locate_elements(*wd_locator.to_a.flatten)
44
48
 
45
- element_matcher.match(elements, match_values, filter)
49
+ element_matcher.match(elements, match_values, @filter)
46
50
  rescue Selenium::WebDriver::Error::StaleElementReferenceError
47
51
  retries += 1
48
52
  sleep 0.5
49
53
  retry unless retries > 2
50
- target = filter == :all ? 'element collection' : 'element'
54
+ target = @filter == :all ? 'element collection' : 'element'
51
55
  raise LocatorException, "Unable to locate #{target} from #{@selector} due to changing page"
52
56
  end
53
57
  end
54
58
 
55
59
  def locator_scope
56
- @built.delete(:scope) || @query_scope.browser
60
+ @locator_scope ||= @built.delete(:scope) || @query_scope.browser
57
61
  end
58
62
 
59
63
  def locate_element(how, what, scope = driver_scope)
@@ -5,7 +5,7 @@ module Watir
5
5
  private
6
6
 
7
7
  def elements_match?(element, values_to_match)
8
- case element.tag_name.downcase
8
+ case fetch_value(element, :tag_name)
9
9
  when 'input'
10
10
  %i[text label visible_text].each do |key|
11
11
  next unless values_to_match.key?(key)
@@ -1,3 +1,3 @@
1
1
  module Watir
2
- VERSION = '6.16.2'.freeze
2
+ VERSION = '6.16.3'.freeze
3
3
  end
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.16.2
4
+ version: 6.16.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Rodionov
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2018-12-24 00:00:00.000000000 Z
13
+ date: 2018-12-25 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: selenium-webdriver