watir 6.16.2 → 6.16.3
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 +4 -4
- data/CHANGES.md +4 -0
- data/lib/watir/locators/element/locator.rb +15 -11
- data/lib/watir/locators/text_field/matcher.rb +1 -1
- data/lib/watir/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b416cb3a4dcc8350fc8f8b5994f9b58e8b3fb1c0
|
|
4
|
+
data.tar.gz: 6fd65f2eda2bafd7993789c311852258481f7199
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 767c776aa67bb214410cf07040fcc5531ee0f8bdee073f8535fe18b6eaeba2fe723eb8f48cdfb5394ff9258b0a898130a9881e140cdc22ebd550e34f15428e01
|
|
7
|
+
data.tar.gz: 0da908dc00c76f593dce7e7547505541b805cd031d1c17158ef268b03498d2d1133ae1115ea2e65ca30e0939f7c455d21791f89bad5bb014888b2daab033c03b
|
data/CHANGES.md
CHANGED
|
@@ -15,7 +15,8 @@ module Watir
|
|
|
15
15
|
def locate(built)
|
|
16
16
|
@built = built.dup
|
|
17
17
|
@driver_scope = locator_scope.wd
|
|
18
|
-
|
|
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
|
-
|
|
27
|
+
@filter = :all
|
|
27
28
|
|
|
28
|
-
[matching_elements
|
|
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
|
|
34
|
-
return locate_element(
|
|
36
|
+
def matching_elements
|
|
37
|
+
return locate_element(*@built.to_a.flatten) if @built.size == 1 && @filter == :first
|
|
35
38
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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)
|
data/lib/watir/version.rb
CHANGED
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.
|
|
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-
|
|
13
|
+
date: 2018-12-25 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: selenium-webdriver
|