watir 6.16.1 → 6.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +32 -107
- data/.travis.yml +24 -21
- data/CHANGES.md +34 -0
- data/Gemfile +3 -1
- data/Rakefile +3 -3
- data/appveyor.yml +2 -1
- data/lib/watir-webdriver.rb +1 -1
- data/lib/watir.rb +0 -1
- data/lib/watir/adjacent.rb +8 -10
- data/lib/watir/after_hooks.rb +6 -3
- data/lib/watir/browser.rb +5 -13
- data/lib/watir/capabilities.rb +9 -6
- data/lib/watir/cookies.rb +1 -1
- data/lib/watir/element_collection.rb +1 -1
- data/lib/watir/elements/element.rb +59 -59
- data/lib/watir/elements/file_field.rb +1 -0
- data/lib/watir/elements/iframe.rb +6 -9
- data/lib/watir/elements/link.rb +0 -9
- data/lib/watir/elements/radio.rb +1 -1
- data/lib/watir/elements/select.rb +2 -2
- data/lib/watir/generator/base/spec_extractor.rb +4 -4
- data/lib/watir/js_execution.rb +1 -1
- data/lib/watir/legacy_wait.rb +1 -1
- data/lib/watir/locators/button/matcher.rb +2 -2
- data/lib/watir/locators/cell/selector_builder.rb +1 -1
- data/lib/watir/locators/element/locator.rb +27 -13
- data/lib/watir/locators/element/matcher.rb +5 -2
- data/lib/watir/locators/element/selector_builder.rb +31 -25
- data/lib/watir/locators/element/selector_builder/xpath.rb +42 -13
- data/lib/watir/locators/row/selector_builder.rb +2 -2
- data/lib/watir/locators/text_field/matcher.rb +4 -3
- data/lib/watir/locators/text_field/selector_builder/xpath.rb +3 -1
- data/lib/watir/logger.rb +5 -2
- data/lib/watir/version.rb +1 -1
- data/lib/watir/window.rb +1 -1
- data/lib/watirspec.rb +1 -1
- data/lib/watirspec/guards.rb +1 -1
- data/lib/watirspec/rake_tasks.rb +2 -0
- data/lib/watirspec/runner.rb +4 -0
- data/spec/unit/container_spec.rb +1 -1
- data/spec/unit/logger_spec.rb +5 -7
- data/spec/unit/selector_builder/button_spec.rb +16 -15
- data/spec/unit/selector_builder/element_spec.rb +83 -14
- data/spec/unit/selector_builder/text_field_spec.rb +14 -14
- data/spec/watirspec/after_hooks_spec.rb +66 -88
- data/spec/watirspec/alert_spec.rb +69 -79
- data/spec/watirspec/browser_spec.rb +48 -46
- data/spec/watirspec/cookies_spec.rb +52 -37
- data/spec/watirspec/drag_and_drop_spec.rb +14 -38
- data/spec/watirspec/elements/button_spec.rb +2 -0
- data/spec/watirspec/elements/buttons_spec.rb +1 -1
- data/spec/watirspec/elements/checkbox_spec.rb +24 -18
- data/spec/watirspec/elements/date_field_spec.rb +18 -9
- data/spec/watirspec/elements/date_time_field_spec.rb +3 -4
- data/spec/watirspec/elements/div_spec.rb +64 -54
- data/spec/watirspec/elements/element_spec.rb +60 -78
- data/spec/watirspec/elements/elements_spec.rb +12 -3
- data/spec/watirspec/elements/filefield_spec.rb +25 -50
- data/spec/watirspec/elements/form_spec.rb +6 -8
- data/spec/watirspec/elements/frame_spec.rb +10 -13
- data/spec/watirspec/elements/iframe_spec.rb +18 -14
- data/spec/watirspec/elements/iframes_spec.rb +2 -2
- data/spec/watirspec/elements/link_spec.rb +18 -9
- data/spec/watirspec/elements/links_spec.rb +11 -3
- data/spec/watirspec/elements/option_spec.rb +15 -17
- data/spec/watirspec/elements/select_list_spec.rb +66 -80
- data/spec/watirspec/elements/text_field_spec.rb +8 -4
- data/spec/watirspec/elements/tr_spec.rb +0 -9
- data/spec/watirspec/html/forms_with_input_elements.html +1 -0
- data/spec/watirspec/html/iframes.html +3 -0
- data/spec/watirspec/html/non_control_elements.html +4 -4
- data/spec/watirspec/html/right_click.html +12 -0
- data/spec/watirspec/html/wait.html +1 -1
- data/spec/watirspec/relaxed_locate_spec.rb +16 -20
- data/spec/watirspec/support/rspec_matchers.rb +7 -6
- data/spec/watirspec/user_editable_spec.rb +1 -1
- data/spec/watirspec/wait_spec.rb +13 -17
- data/spec/watirspec/window_switching_spec.rb +162 -163
- data/spec/watirspec_helper.rb +7 -5
- data/watir.gemspec +4 -5
- metadata +14 -16
- data/lib/watir/elements/area.rb +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c587621e41c1ab878d2e9ff3cfd6c5166c5df9dc66cd02c0719d492aaba48d1e
|
4
|
+
data.tar.gz: 509ba43afa0272d7b154eb5885e403578e2bc3956ab93803123b519093e7b430
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5215ff9fc1cfce6fa050532583167e6ed16be6f74b0d305b8d186b83361162c711ae9b63689a00882bf60d559783508ea2369ed9e8d5e25b504688eb2914db01
|
7
|
+
data.tar.gz: 1b0ba276ea5c83f217151c125b0f645aab7011d86d9049ea7850ea83af4fbeeb9bdfa14ca60d7205c55bee3c0d6f817143bd9f979c7dc5adc368af446367ab8a
|
data/.rubocop.yml
CHANGED
@@ -1,46 +1,36 @@
|
|
1
|
-
|
2
|
-
# Cop supports --auto-correct.
|
3
|
-
# Configuration parameters: AllowAdjacentOneLineDefs, NumberOfEmptyLines.
|
4
|
-
Layout/EmptyLineBetweenDefs:
|
5
|
-
Exclude:
|
6
|
-
- 'lib/watir/elements/html_elements.rb'
|
7
|
-
- 'lib/watir/elements/svg_elements.rb'
|
1
|
+
inherit_from: .rubocop_todo.yml
|
8
2
|
|
9
|
-
|
10
|
-
|
11
|
-
|
3
|
+
AllCops:
|
4
|
+
TargetRubyVersion: 2.5.8
|
5
|
+
NewCops: enable
|
12
6
|
Exclude:
|
13
7
|
- 'lib/watir/elements/html_elements.rb'
|
14
8
|
- 'lib/watir/elements/svg_elements.rb'
|
15
9
|
|
16
|
-
|
17
|
-
|
18
|
-
# Configuration parameters: EnforcedStyle.
|
19
|
-
# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines
|
20
|
-
Layout/EmptyLinesAroundModuleBody:
|
21
|
-
Exclude:
|
22
|
-
- 'lib/watir/elements/html_elements.rb'
|
23
|
-
- 'lib/watir/elements/svg_elements.rb'
|
10
|
+
Layout/LineLength:
|
11
|
+
Max: 120
|
24
12
|
|
25
|
-
# Offense count: 85
|
26
|
-
# Cop supports --auto-correct.
|
27
|
-
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
|
28
|
-
# SupportedStyles: space, no_space, compact
|
29
|
-
# SupportedStylesForEmptyBraces: space, no_space
|
30
13
|
Layout/SpaceInsideHashLiteralBraces:
|
31
14
|
EnforcedStyle: no_space
|
32
15
|
|
33
|
-
# Offense count: 1
|
34
|
-
Lint/HandleExceptions:
|
35
|
-
Exclude:
|
36
|
-
- 'lib/watirspec.rb'
|
37
|
-
|
38
16
|
Lint/UnifiedInteger:
|
39
17
|
Exclude:
|
40
18
|
- 'lib/watir/locators/element/selector_builder.rb'
|
41
19
|
|
42
|
-
#
|
43
|
-
|
20
|
+
# Default: 17
|
21
|
+
Metrics/AbcSize:
|
22
|
+
Max: 20
|
23
|
+
Exclude:
|
24
|
+
- 'lib/watir/capabilities.rb'
|
25
|
+
- 'lib/watir/locators/element/selector_builder.rb'
|
26
|
+
- 'lib/watir/locators/element/selector_builder/regexp_disassembler.rb'
|
27
|
+
- 'lib/watir/locators/element/selector_builder/xpath.rb'
|
28
|
+
- 'lib/watir/locators/element/locator.rb'
|
29
|
+
- 'lib/watir/generator/base/generator.rb'
|
30
|
+
- 'lib/watir/generator/base/visitor.rb'
|
31
|
+
- 'spec/locator_spec_helper.rb'
|
32
|
+
- 'spec/watirspec_helper.rb'
|
33
|
+
|
44
34
|
Metrics/BlockLength:
|
45
35
|
Exclude:
|
46
36
|
- 'spec/**/*'
|
@@ -48,21 +38,6 @@ Metrics/BlockLength:
|
|
48
38
|
- 'watir.gemspec'
|
49
39
|
- 'Rakefile'
|
50
40
|
|
51
|
-
## Configuration parameters: CountComments.
|
52
|
-
Metrics/ModuleLength:
|
53
|
-
Exclude:
|
54
|
-
- 'lib/watir/elements/html_elements.rb'
|
55
|
-
- 'lib/watir/elements/svg_elements.rb'
|
56
|
-
|
57
|
-
# Configuration parameters: CountComments.
|
58
|
-
Metrics/MethodLength:
|
59
|
-
Max: 18
|
60
|
-
Exclude:
|
61
|
-
- 'lib/watir/locators/element/selector_builder.rb'
|
62
|
-
- 'lib/watir/locators/element/selector_builder/xpath.rb'
|
63
|
-
- 'lib/watir/locators/element/selector_builder/regexp_disassembler.rb'
|
64
|
-
|
65
|
-
# Configuration parameters: CountComments.
|
66
41
|
Metrics/ClassLength:
|
67
42
|
Max: 93
|
68
43
|
Exclude:
|
@@ -77,42 +52,24 @@ Metrics/ClassLength:
|
|
77
52
|
- 'lib/watir/generator/base/spec_extractor.rb'
|
78
53
|
- 'lib/watir/element_collection.rb'
|
79
54
|
|
80
|
-
|
81
|
-
Max: 10
|
82
|
-
|
55
|
+
# Default: 7
|
83
56
|
Metrics/CyclomaticComplexity:
|
84
|
-
Max:
|
57
|
+
Max: 9
|
85
58
|
Exclude:
|
86
|
-
|
59
|
+
- 'lib/watir/locators/element/selector_builder.rb'
|
87
60
|
|
88
|
-
|
89
|
-
|
61
|
+
# Configuration parameters: CountComments.
|
62
|
+
Metrics/MethodLength:
|
63
|
+
Max: 18
|
90
64
|
Exclude:
|
91
65
|
- 'lib/watir/locators/element/selector_builder.rb'
|
92
|
-
- 'lib/watir/locators/element/selector_builder/regexp_disassembler.rb'
|
93
66
|
- 'lib/watir/locators/element/selector_builder/xpath.rb'
|
94
|
-
- 'lib/watir/locators/element/
|
95
|
-
- 'lib/watir/generator/base/generator.rb'
|
96
|
-
- 'lib/watir/generator/base/visitor.rb'
|
97
|
-
- 'spec/locator_spec_helper.rb'
|
98
|
-
|
99
|
-
# TODO: fix with Watir 7
|
100
|
-
# Configuration parameters: CountKeywordArgs.
|
101
|
-
Metrics/ParameterLists:
|
102
|
-
Exclude:
|
103
|
-
- 'lib/watir/wait.rb'
|
67
|
+
- 'lib/watir/locators/element/selector_builder/regexp_disassembler.rb'
|
104
68
|
|
105
|
-
#
|
106
|
-
|
107
|
-
|
108
|
-
Max: 120
|
69
|
+
# Default: 8
|
70
|
+
Metrics/PerceivedComplexity:
|
71
|
+
Max: 10
|
109
72
|
|
110
|
-
# Cop supports --auto-correct.
|
111
|
-
# Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, IgnoredMethods.
|
112
|
-
# SupportedStyles: line_count_based, semantic, braces_for_chaining
|
113
|
-
# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
|
114
|
-
# FunctionalMethods: let, let!, subject, watch
|
115
|
-
# IgnoredMethods: lambda, proc, it
|
116
73
|
Style/BlockDelimiters:
|
117
74
|
EnforcedStyle: braces_for_chaining
|
118
75
|
|
@@ -122,44 +79,12 @@ Style/CommentedKeyword:
|
|
122
79
|
Style/DoubleNegation:
|
123
80
|
Enabled: false
|
124
81
|
|
125
|
-
## Configuration parameters: AllowedVariables.
|
126
82
|
Style/GlobalVars:
|
127
83
|
AllowedVariables:
|
128
84
|
- $browser
|
129
85
|
|
130
|
-
Style/
|
131
|
-
Exclude:
|
132
|
-
- 'spec/watirspec/selector_builder/element_spec.rb'
|
133
|
-
|
134
|
-
### Cop supports --auto-correct.
|
135
|
-
### Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
|
136
|
-
## SupportedStyles: single_quotes, double_quotes
|
137
|
-
Style/StringLiterals:
|
138
|
-
Exclude:
|
139
|
-
- 'lib/watir/elements/html_elements.rb'
|
140
|
-
- 'lib/watir/elements/svg_elements.rb'
|
141
|
-
|
142
|
-
Style/MethodCallWithoutArgsParentheses:
|
86
|
+
Style/HashEachMethods:
|
143
87
|
Enabled: false
|
144
88
|
|
145
|
-
|
146
|
-
## Configuration parameters: EnforcedStyle.
|
147
|
-
## SupportedStyles: annotated, template, unannotated
|
148
|
-
Style/FormatStringToken:
|
149
|
-
Exclude:
|
150
|
-
- 'lib/watir/browser.rb'
|
151
|
-
- 'lib/watir/locators/text_field/selector_builder/xpath.rb'
|
152
|
-
- 'lib/watir/window.rb'
|
153
|
-
|
154
|
-
Style/Documentation:
|
89
|
+
Style/OptionalBooleanParameter:
|
155
90
|
Enabled: false
|
156
|
-
|
157
|
-
# Cop supports --auto-correct.
|
158
|
-
# Configuration parameters: EnforcedStyle.
|
159
|
-
# SupportedStyles: when_needed, always, never
|
160
|
-
Style/FrozenStringLiteralComment:
|
161
|
-
Enabled: false
|
162
|
-
|
163
|
-
Naming/FileName:
|
164
|
-
Exclude:
|
165
|
-
- 'lib/watir-webdriver.rb'
|
data/.travis.yml
CHANGED
@@ -18,15 +18,15 @@ before_script:
|
|
18
18
|
script: bundle exec rake $RAKE_TASK
|
19
19
|
|
20
20
|
_version:
|
21
|
-
|
21
|
+
five: &five
|
22
22
|
language: ruby
|
23
|
-
rvm: 2.
|
24
|
-
|
23
|
+
rvm: 2.5.8
|
24
|
+
six: &six
|
25
25
|
language: ruby
|
26
|
-
rvm: 2.
|
27
|
-
|
26
|
+
rvm: 2.6.6
|
27
|
+
seven: &seven
|
28
28
|
language: ruby
|
29
|
-
rvm: 2.
|
29
|
+
rvm: 2.7.1
|
30
30
|
|
31
31
|
_browsers:
|
32
32
|
firefox: &firefox-latest
|
@@ -39,46 +39,49 @@ _browsers:
|
|
39
39
|
matrix:
|
40
40
|
include:
|
41
41
|
- env: RAKE_TASK=spec:remote_firefox
|
42
|
-
<<: *
|
42
|
+
<<: *seven
|
43
43
|
<<: *firefox-latest
|
44
44
|
- env: RAKE_TASK=spec:remote_chrome
|
45
|
-
<<: *
|
45
|
+
<<: *seven
|
46
46
|
<<: *chrome
|
47
47
|
- env: RAKE_TASK=spec:firefox RELAXED_LOCATE=false
|
48
|
-
<<: *
|
48
|
+
<<: *seven
|
49
49
|
<<: *firefox-latest
|
50
50
|
- env: RAKE_TASK=spec:firefox
|
51
|
-
<<: *
|
51
|
+
<<: *seven
|
52
52
|
<<: *firefox-latest
|
53
53
|
- env: RAKE_TASK=spec:firefox
|
54
|
-
<<: *
|
54
|
+
<<: *six
|
55
55
|
<<: *firefox-latest
|
56
56
|
- env: RAKE_TASK=spec:firefox
|
57
|
-
<<: *
|
57
|
+
<<: *five
|
58
58
|
<<: *firefox-latest
|
59
59
|
- env: RAKE_TASK=spec:chrome
|
60
|
-
<<: *
|
60
|
+
<<: *seven
|
61
61
|
<<: *chrome
|
62
62
|
- env: RAKE_TASK=spec:chrome
|
63
|
-
<<: *
|
63
|
+
<<: *six
|
64
64
|
<<: *chrome
|
65
65
|
- env: RAKE_TASK=spec:chrome
|
66
|
-
<<: *
|
66
|
+
<<: *five
|
67
67
|
<<: *chrome
|
68
68
|
- env: RAKE_TASK=spec:chrome RELAXED_LOCATE=false
|
69
|
-
<<: *
|
69
|
+
<<: *seven
|
70
|
+
<<: *chrome
|
71
|
+
- env: RAKE_TASK=spec:chrome W3C=true
|
72
|
+
<<: *seven
|
70
73
|
<<: *chrome
|
71
74
|
- env: RAKE_TASK=spec:chrome HEADLESS=true
|
72
|
-
<<: *
|
75
|
+
<<: *seven
|
73
76
|
<<: *chrome
|
74
77
|
- env: RAKE_TASK=spec:unit
|
75
|
-
<<: *
|
78
|
+
<<: *seven
|
76
79
|
- env: RAKE_TASK=spec:stats
|
77
|
-
<<: *
|
80
|
+
<<: *seven
|
78
81
|
<<: *chrome
|
79
82
|
- env: RAKE_TASK=yard:doctest
|
80
|
-
<<: *
|
83
|
+
<<: *seven
|
81
84
|
<<: *chrome
|
82
85
|
- env: RAKE_TASK=rubocop
|
83
|
-
<<: *
|
86
|
+
<<: *five
|
84
87
|
<<: *chrome
|
data/CHANGES.md
CHANGED
@@ -1,3 +1,37 @@
|
|
1
|
+
### 6.17.0 (2020-08-27)
|
2
|
+
* Require Ruby > 2.5
|
3
|
+
* Implement Logger#selenium= to set selenium level from Watir
|
4
|
+
* Implement FileField#upload
|
5
|
+
* Fix bug with staleness handling in #exist and #present? (#853 & #852)
|
6
|
+
* Fix bug when locating elements by text with RegExp (#866 #871)
|
7
|
+
* Implement modifiers for `Element#right_click` (thanks Lakshya Kapoor #861)
|
8
|
+
* Updated locator code to adhere to spec on what attributes are case sensitive (#507 #856)
|
9
|
+
* Fix locating bug when iframe is nested under another element (thanks Matthew Mazaika #885 #886)
|
10
|
+
* Deprecate Element#scroll_into_view in favor of the new Scroll methods (#884)
|
11
|
+
* Fix threading bugs by allowing each Browser instance its own Timer (#881)
|
12
|
+
* Allow adjacent locators to return Input subtype when applicable (#878)
|
13
|
+
* Removed unnecessary reference to rubyforge (thanks olleolleolle #874)
|
14
|
+
* Removed deprecated Selenium classes (thanks joesho112358 #867)
|
15
|
+
* Add support for :service parameter for initializing Browser
|
16
|
+
|
17
|
+
### 6.16.5 (2018-12-25)
|
18
|
+
|
19
|
+
* Fix bug with nested elements using scopes (#842)
|
20
|
+
|
21
|
+
### 6.16.4 (2018-12-24)
|
22
|
+
|
23
|
+
* Minor adjustments to support locator extensions
|
24
|
+
|
25
|
+
### 6.16.3 (2018-12-24)
|
26
|
+
|
27
|
+
* Minor adjustments to support locator extensions
|
28
|
+
|
29
|
+
### 6.16.2 (2018-12-24)
|
30
|
+
|
31
|
+
* Fix bug merging scope when locating nested elements with css locator (#841)
|
32
|
+
* Fix bug with IFrame#to_subtype
|
33
|
+
* Improve performance for nested frames
|
34
|
+
|
1
35
|
### 6.16.1 (2018-12-23)
|
2
36
|
|
3
37
|
* Improve collection performance with JavaScript (thanks Lucas Tierney)
|
data/Gemfile
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
-
source '
|
1
|
+
source 'https://rubygems.org'
|
2
2
|
|
3
3
|
gem 'webidl', path: File.expand_path('../webidl') if ENV['LOCAL_WEBIDL']
|
4
4
|
|
5
5
|
gem 'selenium-webdriver', path: File.expand_path('../selenium/build/rb') if ENV['LOCAL_SELENIUM']
|
6
6
|
|
7
|
+
gem 'ffi' if Gem.win_platform? # For selenium-webdriver on Windows
|
8
|
+
|
7
9
|
# Specify your gem's dependencies in watir.gemspec
|
8
10
|
gemspec
|
data/Rakefile
CHANGED
@@ -61,7 +61,7 @@ end
|
|
61
61
|
|
62
62
|
if extractor.errors.any?
|
63
63
|
puts "\n\n<======================= ERRORS =======================>\n\n"
|
64
|
-
puts extractor.errors.join("\n
|
64
|
+
puts extractor.errors.join("\n#{'=' * 80}\n")
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
@@ -93,7 +93,7 @@ YARD::Rake::YardocTask.new do |task|
|
|
93
93
|
task.options = %w[--debug] # this is pretty slow, so nice with some output
|
94
94
|
end
|
95
95
|
|
96
|
-
require 'yard
|
96
|
+
require 'yard/doctest/rake'
|
97
97
|
YARD::Doctest::RakeTask.new do |task|
|
98
98
|
task.doctest_opts = ['-v']
|
99
99
|
end
|
@@ -115,7 +115,7 @@ namespace :changes do
|
|
115
115
|
|
116
116
|
desc 'Print latest diff'
|
117
117
|
task print: :differ do
|
118
|
-
VersionDiffer.new.print_latest(
|
118
|
+
VersionDiffer.new.print_latest($stdout)
|
119
119
|
end
|
120
120
|
end
|
121
121
|
|
data/appveyor.yml
CHANGED
data/lib/watir-webdriver.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
require 'watir'
|
2
|
-
warn Kernel.caller.first
|
2
|
+
warn "#{Kernel.caller.first}: `require 'watir-webdriver'` is deprecated. Please, use `require 'watir'`."
|
data/lib/watir.rb
CHANGED
@@ -114,7 +114,6 @@ require 'watir/elements/element'
|
|
114
114
|
require 'watir/elements/html_elements'
|
115
115
|
require 'watir/elements/svg_elements'
|
116
116
|
|
117
|
-
require 'watir/elements/area'
|
118
117
|
require 'watir/elements/button'
|
119
118
|
require 'watir/elements/cell'
|
120
119
|
require 'watir/elements/checkbox'
|
data/lib/watir/adjacent.rb
CHANGED
@@ -113,16 +113,14 @@ module Watir
|
|
113
113
|
def xpath_adjacent(opt = {})
|
114
114
|
plural = opt.delete(:plural)
|
115
115
|
opt[:index] ||= 0 unless plural || opt.values.any? { |e| e.is_a? Regexp }
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
end
|
125
|
-
klass.new(self, opt)
|
116
|
+
if !plural
|
117
|
+
el = Watir.element_class_for(opt[:tag_name] || '').new(self, opt)
|
118
|
+
el.is_a?(Input) ? el.to_subtype : el
|
119
|
+
elsif opt[:tag_name]
|
120
|
+
Object.const_get("#{Watir.element_class_for(opt[:tag_name])}Collection").new(self, opt)
|
121
|
+
else
|
122
|
+
HTMLElementCollection.new(self, opt)
|
123
|
+
end
|
126
124
|
end
|
127
125
|
end # Adjacent
|
128
126
|
end # Watir
|
data/lib/watir/after_hooks.rb
CHANGED
@@ -65,9 +65,12 @@ module Watir
|
|
65
65
|
#
|
66
66
|
|
67
67
|
def run
|
68
|
-
|
68
|
+
# We can't just rescue exception because Firefox automatically closes alert when exception raised
|
69
|
+
return unless @after_hooks.any? && !@browser.alert.exists?
|
69
70
|
|
70
71
|
each { |after_hook| after_hook.call(@browser) }
|
72
|
+
rescue Selenium::WebDriver::Error::NoSuchWindowError => e
|
73
|
+
Watir.logger.info "Could not execute After Hooks because browser window was closed #{e}"
|
71
74
|
end
|
72
75
|
|
73
76
|
#
|
@@ -96,8 +99,8 @@ module Watir
|
|
96
99
|
# @yieldparam [#call] after_hook Object responding to call
|
97
100
|
#
|
98
101
|
|
99
|
-
def each
|
100
|
-
@after_hooks.each { |after_hook|
|
102
|
+
def each(&blk)
|
103
|
+
@after_hooks.each { |after_hook| blk.call(after_hook) }
|
101
104
|
end
|
102
105
|
|
103
106
|
#
|
data/lib/watir/browser.rb
CHANGED
@@ -11,7 +11,7 @@ module Watir
|
|
11
11
|
include Exception
|
12
12
|
include Scrolling
|
13
13
|
|
14
|
-
attr_writer :default_context, :original_window, :locator_namespace
|
14
|
+
attr_writer :default_context, :original_window, :locator_namespace, :timer
|
15
15
|
attr_reader :driver, :after_hooks
|
16
16
|
alias wd driver # ensures duck typing with Watir::Element
|
17
17
|
|
@@ -270,18 +270,6 @@ module Watir
|
|
270
270
|
after_hooks.run
|
271
271
|
end
|
272
272
|
|
273
|
-
#
|
274
|
-
# @api private
|
275
|
-
#
|
276
|
-
# Always relocate a Browser to ensure proper context switching
|
277
|
-
#
|
278
|
-
# @return [Boolean]
|
279
|
-
#
|
280
|
-
|
281
|
-
def relocate?
|
282
|
-
true
|
283
|
-
end
|
284
|
-
|
285
273
|
def browser
|
286
274
|
self
|
287
275
|
end
|
@@ -312,6 +300,10 @@ module Watir
|
|
312
300
|
end
|
313
301
|
end
|
314
302
|
|
303
|
+
def timer
|
304
|
+
@timer ||= Wait::Timer.new
|
305
|
+
end
|
306
|
+
|
315
307
|
private
|
316
308
|
|
317
309
|
def wrap_element(scope, element)
|