watir 6.14.0 → 6.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +24 -6
- data/CHANGES.md +10 -0
- data/Gemfile +0 -2
- data/README.md +1 -1
- data/Rakefile +2 -2
- data/lib/watir.rb +2 -3
- data/lib/watir/adjacent.rb +2 -2
- data/lib/watir/alert.rb +5 -9
- data/lib/watir/attribute_helper.rb +2 -3
- data/lib/watir/browser.rb +5 -17
- data/lib/watir/capabilities.rb +11 -0
- data/lib/watir/cell_container.rb +2 -2
- data/lib/watir/container.rb +7 -8
- data/lib/watir/cookies.rb +2 -12
- data/lib/watir/element_collection.rb +2 -2
- data/lib/watir/elements/button.rb +2 -11
- data/lib/watir/elements/element.rb +43 -25
- data/lib/watir/elements/hidden.rb +1 -1
- data/lib/watir/elements/iframe.rb +7 -5
- data/lib/watir/elements/option.rb +2 -13
- data/lib/watir/elements/select.rb +6 -22
- data/lib/watir/elements/table.rb +2 -2
- data/lib/watir/exception.rb +1 -2
- data/lib/watir/generator/base/idl_sorter.rb +1 -1
- data/lib/watir/generator/base/spec_extractor.rb +2 -2
- data/lib/watir/generator/base/visitor.rb +1 -1
- data/lib/watir/generator/html/generator.rb +0 -1
- data/lib/watir/generator/html/spec_extractor.rb +1 -1
- data/lib/watir/generator/html/visitor.rb +1 -1
- data/lib/watir/generator/svg/spec_extractor.rb +1 -1
- data/lib/watir/generator/svg/visitor.rb +1 -1
- data/lib/watir/js_execution.rb +11 -0
- data/lib/watir/js_snippets.rb +1 -1
- data/lib/watir/js_snippets/elementObscured.js +14 -0
- data/lib/watir/js_snippets/selectedText.js +17 -0
- data/lib/watir/legacy_wait.rb +5 -5
- data/lib/watir/locators.rb +16 -5
- data/lib/watir/locators/anchor/selector_builder.rb +38 -0
- data/lib/watir/locators/button/locator.rb +14 -12
- data/lib/watir/locators/button/selector_builder.rb +0 -22
- data/lib/watir/locators/button/selector_builder/xpath.rb +67 -12
- data/lib/watir/locators/button/validator.rb +2 -1
- data/lib/watir/locators/cell/selector_builder.rb +0 -14
- data/lib/watir/locators/cell/selector_builder/xpath.rb +21 -0
- data/lib/watir/locators/element/locator.rb +60 -153
- data/lib/watir/locators/element/selector_builder.rb +103 -84
- data/lib/watir/locators/element/selector_builder/regexp_disassembler.rb +66 -0
- data/lib/watir/locators/element/selector_builder/xpath.rb +195 -82
- data/lib/watir/locators/element/selector_builder/xpath_support.rb +27 -0
- data/lib/watir/locators/element/validator.rb +2 -9
- data/lib/watir/locators/row/selector_builder.rb +5 -22
- data/lib/watir/locators/row/selector_builder/xpath.rb +53 -0
- data/lib/watir/locators/text_area/selector_builder.rb +1 -1
- data/lib/watir/locators/text_area/selector_builder/xpath.rb +19 -0
- data/lib/watir/locators/text_field/locator.rb +11 -8
- data/lib/watir/locators/text_field/selector_builder.rb +0 -23
- data/lib/watir/locators/text_field/selector_builder/xpath.rb +33 -4
- data/lib/watir/locators/text_field/validator.rb +4 -4
- data/lib/watir/radio_set.rb +5 -5
- data/lib/watir/row_container.rb +2 -2
- data/lib/watir/user_editable.rb +2 -2
- data/lib/watir/version.rb +1 -1
- data/lib/watir/wait.rb +24 -37
- data/lib/watir/window.rb +11 -8
- data/lib/watirspec/remote_server.rb +3 -1
- data/spec/locator_spec_helper.rb +1 -1
- data/spec/spec_helper.rb +25 -1
- data/spec/unit/anchor_locator_spec.rb +68 -0
- data/spec/unit/capabilities_spec.rb +27 -0
- data/spec/unit/element_locator_spec.rb +184 -101
- data/spec/unit/logger_spec.rb +5 -0
- data/spec/watirspec/adjacent_spec.rb +34 -34
- data/spec/watirspec/after_hooks_spec.rb +78 -35
- data/spec/watirspec/alert_spec.rb +10 -0
- data/spec/watirspec/browser_spec.rb +27 -1
- data/spec/watirspec/element_hidden_spec.rb +6 -0
- data/spec/watirspec/elements/button_spec.rb +5 -11
- data/spec/watirspec/elements/buttons_spec.rb +1 -1
- data/spec/watirspec/elements/checkbox_spec.rb +2 -15
- data/spec/watirspec/elements/date_time_field_spec.rb +6 -1
- data/spec/watirspec/elements/dd_spec.rb +0 -17
- data/spec/watirspec/elements/del_spec.rb +0 -14
- data/spec/watirspec/elements/div_spec.rb +0 -18
- data/spec/watirspec/elements/dl_spec.rb +0 -17
- data/spec/watirspec/elements/dt_spec.rb +0 -17
- data/spec/watirspec/elements/element_spec.rb +177 -17
- data/spec/watirspec/elements/elements_spec.rb +7 -6
- data/spec/watirspec/elements/em_spec.rb +0 -13
- data/spec/watirspec/elements/filefield_spec.rb +0 -11
- data/spec/watirspec/elements/form_spec.rb +6 -0
- data/spec/watirspec/elements/hn_spec.rb +0 -14
- data/spec/watirspec/elements/iframe_spec.rb +15 -0
- data/spec/watirspec/elements/ins_spec.rb +0 -14
- data/spec/watirspec/elements/labels_spec.rb +1 -1
- data/spec/watirspec/elements/li_spec.rb +0 -14
- data/spec/watirspec/elements/link_spec.rb +22 -14
- data/spec/watirspec/elements/links_spec.rb +13 -0
- data/spec/watirspec/elements/list_spec.rb +15 -0
- data/spec/watirspec/elements/ol_spec.rb +0 -14
- data/spec/watirspec/elements/option_spec.rb +0 -10
- data/spec/watirspec/elements/p_spec.rb +0 -14
- data/spec/watirspec/elements/pre_spec.rb +0 -14
- data/spec/watirspec/elements/radio_spec.rb +0 -14
- data/spec/watirspec/elements/select_list_spec.rb +0 -10
- data/spec/watirspec/elements/span_spec.rb +4 -15
- data/spec/watirspec/elements/strong_spec.rb +4 -15
- data/spec/watirspec/elements/table_nesting_spec.rb +1 -1
- data/spec/watirspec/elements/table_spec.rb +7 -0
- data/spec/watirspec/elements/text_field_spec.rb +10 -2
- data/spec/watirspec/elements/text_fields_spec.rb +1 -1
- data/spec/watirspec/elements/tr_spec.rb +1 -1
- data/spec/watirspec/elements/ul_spec.rb +0 -14
- data/spec/watirspec/html/closeable.html +8 -0
- data/spec/watirspec/html/forms_with_input_elements.html +28 -23
- data/spec/watirspec/html/nested_elements.html +9 -9
- data/spec/watirspec/html/obscured.html +34 -0
- data/spec/watirspec/html/tables.html +13 -13
- data/spec/watirspec/radio_set_spec.rb +5 -0
- data/spec/watirspec/selector_builder/button_spec.rb +254 -0
- data/spec/watirspec/selector_builder/cell_spec.rb +93 -0
- data/spec/watirspec/selector_builder/element_spec.rb +639 -0
- data/spec/watirspec/selector_builder/row_spec.rb +150 -0
- data/spec/watirspec/selector_builder/text_spec.rb +170 -0
- data/spec/watirspec/support/rspec_matchers.rb +6 -1
- data/spec/watirspec/user_editable_spec.rb +4 -0
- data/spec/watirspec/wait_spec.rb +65 -14
- data/spec/watirspec/window_switching_spec.rb +54 -1
- data/spec/watirspec_helper.rb +2 -0
- data/watir.gemspec +7 -1
- metadata +86 -8
- data/lib/watir/locators/text_area/locator.rb +0 -13
- data/lib/watir/xpath_support.rb +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d985e9510a911174b9ba60c5d3174eb67fc612b5
|
4
|
+
data.tar.gz: f7a5ba01ad7bea4f7fe8222c55f571e5340d8725
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ba1c06f7bfeaa9c8ac573ca2b023a23dc5222741d925db41d77e72bfaeb46d5a7f217560337d1afbf8e8d9204b050dcded5ff50218ba5129ba48ceff3adf3db
|
7
|
+
data.tar.gz: 98e3d14ab62868105c6e7af9108fbfd341fbc6f181baae28235b2aca8bafdad9c0c9e9b5c664c809a69bb84b80320e08adfd217751df0f4a87f2c30b794b5a04
|
data/.rubocop.yml
CHANGED
@@ -53,28 +53,42 @@ Metrics/ModuleLength:
|
|
53
53
|
# Configuration parameters: CountComments.
|
54
54
|
Metrics/MethodLength:
|
55
55
|
Max: 18
|
56
|
+
Exclude:
|
57
|
+
- 'lib/watir/locators/element/selector_builder.rb'
|
58
|
+
- 'lib/watir/locators/element/selector_builder/xpath.rb'
|
59
|
+
- 'lib/watir/locators/element/selector_builder/regexp_disassembler.rb'
|
56
60
|
|
57
61
|
# Configuration parameters: CountComments.
|
58
62
|
Metrics/ClassLength:
|
59
|
-
Max:
|
63
|
+
Max: 95
|
60
64
|
Exclude:
|
65
|
+
- 'lib/watir/capabilities.rb'
|
61
66
|
- 'lib/watir/locators/element/locator.rb'
|
67
|
+
- 'lib/watir/locators/element/selector_builder.rb'
|
68
|
+
- 'lib/watir/locators/element/selector_builder/xpath.rb'
|
62
69
|
- 'lib/watir/browser.rb'
|
70
|
+
- 'lib/watir/window.rb'
|
63
71
|
- 'lib/watir/elements/element.rb'
|
64
72
|
- 'lib/watir/elements/select.rb'
|
73
|
+
- 'lib/watir/generator/base/spec_extractor.rb'
|
65
74
|
|
66
75
|
Metrics/PerceivedComplexity:
|
67
|
-
Max:
|
76
|
+
Max: 10
|
68
77
|
|
69
78
|
Metrics/CyclomaticComplexity:
|
70
|
-
Max:
|
79
|
+
Max: 8
|
80
|
+
Exclude:
|
81
|
+
- 'lib/watir/locators/element/selector_builder.rb'
|
71
82
|
|
72
|
-
# Offense count: 28
|
73
83
|
Metrics/AbcSize:
|
74
|
-
Max:
|
84
|
+
Max: 20
|
75
85
|
Exclude:
|
76
86
|
- 'lib/watir/locators/element/selector_builder.rb'
|
87
|
+
- 'lib/watir/locators/element/selector_builder/regexp_disassembler.rb'
|
88
|
+
- 'lib/watir/locators/element/selector_builder/xpath.rb'
|
89
|
+
- 'lib/watir/locators/element/locator.rb'
|
77
90
|
- 'lib/watir/generator/base/generator.rb'
|
91
|
+
- 'lib/watir/generator/base/visitor.rb'
|
78
92
|
|
79
93
|
# TODO: fix with Watir 7
|
80
94
|
# Configuration parameters: CountKeywordArgs.
|
@@ -107,6 +121,10 @@ Style/GlobalVars:
|
|
107
121
|
AllowedVariables:
|
108
122
|
- $browser
|
109
123
|
|
124
|
+
Style/RegexpLiteral:
|
125
|
+
Exclude:
|
126
|
+
- 'spec/watirspec/selector_builder/element_spec.rb'
|
127
|
+
|
110
128
|
### Cop supports --auto-correct.
|
111
129
|
### Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
|
112
130
|
## SupportedStyles: single_quotes, double_quotes
|
@@ -124,7 +142,7 @@ Style/MethodCallWithoutArgsParentheses:
|
|
124
142
|
Style/FormatStringToken:
|
125
143
|
Exclude:
|
126
144
|
- 'lib/watir/browser.rb'
|
127
|
-
- 'lib/watir/locators/text_field/selector_builder.rb'
|
145
|
+
- 'lib/watir/locators/text_field/selector_builder/xpath.rb'
|
128
146
|
- 'lib/watir/window.rb'
|
129
147
|
|
130
148
|
Style/Documentation:
|
data/CHANGES.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
### 6.15.0 (2018-11-07)
|
2
|
+
|
3
|
+
* Add `Element#selected_text`
|
4
|
+
* Add `Element#classes`
|
5
|
+
* Add `Element#obscured?`
|
6
|
+
* Deprecate `#wait_until_present` and `#wait_while_present`
|
7
|
+
* Improved Locator classes to reduce wire calls when using multiple/complex locators
|
8
|
+
* Fix bug with IE options
|
9
|
+
* Allow time values in yaml files for cookies (thanks Ryan Baumann)
|
10
|
+
|
1
11
|
### 6.14.0 (2018-09-13)
|
2
12
|
|
3
13
|
* HTML Element attribute support updated to HTML 5.2
|
data/Gemfile
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
source 'http://rubygems.org'
|
2
2
|
|
3
|
-
gem 'simplecov', '>= 0.3.5', platform: :ruby_19 unless ENV['TRAVIS']
|
4
|
-
|
5
3
|
gem 'webidl', path: File.expand_path('../webidl') if ENV['LOCAL_WEBIDL']
|
6
4
|
|
7
5
|
gem 'selenium-webdriver', path: File.expand_path('../selenium/build/rb') if ENV['LOCAL_SELENIUM']
|
data/README.md
CHANGED
@@ -6,7 +6,7 @@ Watir Powered By Selenium!
|
|
6
6
|
[![Travis Status](https://travis-ci.org/watir/watir.svg?branch=master)](https://travis-ci.org/watir/watir)
|
7
7
|
[![AppVeyor status](https://ci.appveyor.com/api/projects/status/9vbb7pp5p4uyoott/branch/master?svg=true)](https://ci.appveyor.com/project/p0deje/watir)
|
8
8
|
[![Code Climate](https://codeclimate.com/github/watir/watir.svg)](https://codeclimate.com/github/watir/watir)
|
9
|
-
[![Coverage Status](https://coveralls.io/repos/watir/watir/badge.svg?branch=master)](https://coveralls.io/
|
9
|
+
[![Coverage Status](https://coveralls.io/repos/github/watir/watir/badge.svg?branch=master)](https://coveralls.io/github/watir/watir?branch=master)
|
10
10
|
|
11
11
|
## Using Watir
|
12
12
|
|
data/Rakefile
CHANGED
@@ -41,7 +41,7 @@ end
|
|
41
41
|
|
42
42
|
File.open(spec_path, 'w') do |io|
|
43
43
|
io << "<!-- downloaded from #{spec_uri} on #{Time.now} -->\n"
|
44
|
-
io << data = URI.
|
44
|
+
io << data = URI.parse(spec_uri).read
|
45
45
|
downloaded_bytes = data.bytesize
|
46
46
|
end
|
47
47
|
|
@@ -73,7 +73,7 @@ end
|
|
73
73
|
generator.generate(spec_path, file)
|
74
74
|
end
|
75
75
|
|
76
|
-
system "diff -Naut #{old_file} #{old_file}.new
|
76
|
+
system "diff -Naut #{old_file} #{old_file}.new" if File.exist?(old_file)
|
77
77
|
end
|
78
78
|
|
79
79
|
desc "Move #{type}.rb.new to #{type}.rb"
|
data/lib/watir.rb
CHANGED
@@ -4,7 +4,6 @@ require 'time'
|
|
4
4
|
require 'watir/legacy_wait'
|
5
5
|
require 'watir/wait'
|
6
6
|
require 'watir/exception'
|
7
|
-
require 'watir/xpath_support'
|
8
7
|
require 'watir/window'
|
9
8
|
require 'watir/has_window'
|
10
9
|
require 'watir/adjacent'
|
@@ -55,7 +54,7 @@ module Watir
|
|
55
54
|
end
|
56
55
|
|
57
56
|
#
|
58
|
-
# Whether or not Watir should prefer CSS when translating the Watir
|
57
|
+
# Whether or not Watir should prefer CSS when translating the Watir selector to Selenium.
|
59
58
|
#
|
60
59
|
|
61
60
|
def prefer_css?
|
@@ -104,7 +103,7 @@ module Watir
|
|
104
103
|
#
|
105
104
|
|
106
105
|
def self.logger
|
107
|
-
@logger ||=
|
106
|
+
@logger ||= Logger.new
|
108
107
|
end
|
109
108
|
end
|
110
109
|
require 'watir/locators'
|
data/lib/watir/adjacent.rb
CHANGED
@@ -59,7 +59,7 @@ module Watir
|
|
59
59
|
#
|
60
60
|
# @example
|
61
61
|
# browser.text_field(name: "new_user_first_name").following_siblings.size
|
62
|
-
# #=>
|
62
|
+
# #=> 55
|
63
63
|
#
|
64
64
|
|
65
65
|
def following_siblings(opt = {})
|
@@ -74,7 +74,7 @@ module Watir
|
|
74
74
|
#
|
75
75
|
# @example
|
76
76
|
# browser.text_field(name: "new_user_first_name").siblings.size
|
77
|
-
# #=>
|
77
|
+
# #=> 59
|
78
78
|
#
|
79
79
|
|
80
80
|
def siblings(opt = {})
|
data/lib/watir/alert.rb
CHANGED
@@ -2,6 +2,7 @@ module Watir
|
|
2
2
|
class Alert
|
3
3
|
include EventuallyPresent
|
4
4
|
include Waitable
|
5
|
+
include Exception
|
5
6
|
|
6
7
|
def initialize(browser)
|
7
8
|
@browser = browser
|
@@ -79,13 +80,14 @@ module Watir
|
|
79
80
|
def exists?
|
80
81
|
assert_exists
|
81
82
|
true
|
82
|
-
rescue
|
83
|
+
rescue UnknownObjectException
|
83
84
|
false
|
84
85
|
end
|
85
86
|
alias present? exists?
|
86
87
|
|
87
88
|
#
|
88
89
|
# @api private
|
90
|
+
# @see Watir::Wait
|
89
91
|
#
|
90
92
|
|
91
93
|
def selector_string
|
@@ -97,7 +99,7 @@ module Watir
|
|
97
99
|
def assert_exists
|
98
100
|
@alert = @browser.driver.switch_to.alert
|
99
101
|
rescue Selenium::WebDriver::Error::NoSuchAlertError
|
100
|
-
raise
|
102
|
+
raise UnknownObjectException, 'unable to locate alert'
|
101
103
|
end
|
102
104
|
|
103
105
|
def wait_for_exists
|
@@ -106,13 +108,7 @@ module Watir
|
|
106
108
|
begin
|
107
109
|
wait_until(message: 'waiting for alert', &:exists?)
|
108
110
|
rescue Wait::TimeoutError
|
109
|
-
|
110
|
-
message = 'This code has slept for the duration of the default timeout '
|
111
|
-
message << 'waiting for an Alert to exist. If the test is still passing, '
|
112
|
-
message << 'consider using Alert#exists? instead of rescuing UnknownObjectException'
|
113
|
-
Watir.logger.warn message, ids: [:wait_for_alert]
|
114
|
-
end
|
115
|
-
raise Exception::UnknownObjectException, 'unable to locate alert'
|
111
|
+
raise UnknownObjectException, 'unable to locate alert'
|
116
112
|
end
|
117
113
|
end
|
118
114
|
end # Alert
|
@@ -52,8 +52,6 @@ module Watir
|
|
52
52
|
|
53
53
|
def define_attribute(type, name, attr)
|
54
54
|
case type.to_s
|
55
|
-
when 'String'
|
56
|
-
define_string_attribute(name, attr)
|
57
55
|
when 'Boolean'
|
58
56
|
define_boolean_attribute(name, attr)
|
59
57
|
when 'Integer'
|
@@ -61,7 +59,7 @@ module Watir
|
|
61
59
|
when 'Float'
|
62
60
|
define_float_attribute(name, attr)
|
63
61
|
else
|
64
|
-
|
62
|
+
define_string_attribute(name, attr)
|
65
63
|
end
|
66
64
|
end
|
67
65
|
|
@@ -87,6 +85,7 @@ module Watir
|
|
87
85
|
def define_float_attribute(mname, aname)
|
88
86
|
define_method mname do
|
89
87
|
value = attribute_value(aname)
|
88
|
+
value = nil if value == 'NaN'
|
90
89
|
value && Float(value)
|
91
90
|
end
|
92
91
|
end
|
data/lib/watir/browser.rb
CHANGED
@@ -8,6 +8,7 @@ module Watir
|
|
8
8
|
include HasWindow
|
9
9
|
include Waitable
|
10
10
|
include Navigation
|
11
|
+
include Exception
|
11
12
|
|
12
13
|
attr_writer :default_context, :original_window, :locator_namespace
|
13
14
|
attr_reader :driver, :after_hooks
|
@@ -40,7 +41,7 @@ module Watir
|
|
40
41
|
def initialize(browser = :chrome, *args)
|
41
42
|
case browser
|
42
43
|
when ::Symbol, String
|
43
|
-
selenium_args =
|
44
|
+
selenium_args = Capabilities.new(browser, *args).to_args
|
44
45
|
@driver = Selenium::WebDriver.for(*selenium_args)
|
45
46
|
when Selenium::WebDriver::Driver
|
46
47
|
@driver = browser
|
@@ -212,7 +213,7 @@ module Watir
|
|
212
213
|
#
|
213
214
|
|
214
215
|
def execute_script(script, *args)
|
215
|
-
args.map! { |e| e.is_a?(
|
216
|
+
args.map! { |e| e.is_a?(Element) ? e.wd : e }
|
216
217
|
|
217
218
|
wrap_elements_in(self, @driver.execute_script(script, *args))
|
218
219
|
end
|
@@ -252,21 +253,8 @@ module Watir
|
|
252
253
|
end
|
253
254
|
alias exists? exist?
|
254
255
|
|
255
|
-
#
|
256
|
-
# Protocol shared with Watir::Element
|
257
|
-
#
|
258
|
-
# @api private
|
259
|
-
#
|
260
|
-
|
261
|
-
def assert_exists
|
262
|
-
locate
|
263
|
-
return if window.present?
|
264
|
-
|
265
|
-
raise Exception::NoMatchingWindowFoundException, 'browser window was closed'
|
266
|
-
end
|
267
|
-
|
268
256
|
def locate
|
269
|
-
raise
|
257
|
+
raise Error, 'browser was closed' if @closed
|
270
258
|
|
271
259
|
ensure_context
|
272
260
|
end
|
@@ -298,7 +286,7 @@ module Watir
|
|
298
286
|
#
|
299
287
|
|
300
288
|
def locator_namespace
|
301
|
-
@locator_namespace ||=
|
289
|
+
@locator_namespace ||= Locators
|
302
290
|
end
|
303
291
|
|
304
292
|
#
|
data/lib/watir/capabilities.rb
CHANGED
@@ -113,6 +113,17 @@ module Watir
|
|
113
113
|
if @browser == :safari && @options.delete(:technology_preview)
|
114
114
|
@options['safari.options'] = {'technologyPreview' => true}
|
115
115
|
end
|
116
|
+
when :ie
|
117
|
+
if @options.key?(:args)
|
118
|
+
browser_options ||= {}
|
119
|
+
browser_options[:args] = @options.delete(:args).dup
|
120
|
+
end
|
121
|
+
unless browser_options.is_a? Selenium::WebDriver::IE::Options
|
122
|
+
ie_caps = browser_options.select { |k| Selenium::WebDriver::IE::Options::CAPABILITIES.include?(k) }
|
123
|
+
browser_options = Selenium::WebDriver::IE::Options.new(browser_options)
|
124
|
+
ie_caps.each { |k, v| browser_options.add_option(k, v) }
|
125
|
+
end
|
126
|
+
@selenium_opts[:options] = browser_options
|
116
127
|
end
|
117
128
|
end
|
118
129
|
# rubocop:enable Metrics/AbcSize
|
data/lib/watir/cell_container.rb
CHANGED
@@ -7,7 +7,7 @@ module Watir
|
|
7
7
|
#
|
8
8
|
|
9
9
|
def cell(*args)
|
10
|
-
Cell.new(self, extract_selector(args)
|
10
|
+
Cell.new(self, extract_selector(args))
|
11
11
|
end
|
12
12
|
|
13
13
|
#
|
@@ -17,7 +17,7 @@ module Watir
|
|
17
17
|
#
|
18
18
|
|
19
19
|
def cells(*args)
|
20
|
-
CellCollection.new(self, extract_selector(args)
|
20
|
+
CellCollection.new(self, extract_selector(args))
|
21
21
|
end
|
22
22
|
end # CellContainer
|
23
23
|
end # Watir
|
data/lib/watir/container.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
module Watir
|
2
2
|
module Container
|
3
|
-
include XpathSupport
|
4
3
|
include JSSnippets
|
5
4
|
|
6
5
|
#
|
@@ -33,22 +32,22 @@ module Watir
|
|
33
32
|
# @api private
|
34
33
|
#
|
35
34
|
|
36
|
-
def extract_selector(
|
37
|
-
case
|
35
|
+
def extract_selector(selector)
|
36
|
+
case selector.size
|
38
37
|
when 2
|
39
|
-
msg = "Using ordered parameters to locate elements (:#{
|
38
|
+
msg = "Using ordered parameters to locate elements (:#{selector.first}, #{selector.last.inspect})"
|
40
39
|
Watir.logger.deprecate msg,
|
41
|
-
"{#{
|
40
|
+
"{#{selector.first}: #{selector.last.inspect}}",
|
42
41
|
ids: [:selector_parameters]
|
43
|
-
return {
|
42
|
+
return {selector[0] => selector[1]}
|
44
43
|
when 1
|
45
|
-
obj =
|
44
|
+
obj = selector.first
|
46
45
|
return obj if obj.is_a? Hash
|
47
46
|
when 0
|
48
47
|
return {}
|
49
48
|
end
|
50
49
|
|
51
|
-
raise ArgumentError, "expected Hash, got #{
|
50
|
+
raise ArgumentError, "expected Hash, got #{selector.inspect}"
|
52
51
|
end
|
53
52
|
end # Container
|
54
53
|
end # Watir
|
data/lib/watir/cookies.rb
CHANGED
@@ -18,7 +18,7 @@ module Watir
|
|
18
18
|
|
19
19
|
def to_a
|
20
20
|
@control.all_cookies.map do |e|
|
21
|
-
e.merge(expires: e[:expires] ?
|
21
|
+
e.merge(expires: e[:expires] ? e[:expires].to_time : nil)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
@@ -115,19 +115,9 @@ module Watir
|
|
115
115
|
#
|
116
116
|
|
117
117
|
def load(file = '.cookies')
|
118
|
-
YAML.safe_load(IO.read(file), [::Symbol]).each do |c|
|
118
|
+
YAML.safe_load(IO.read(file), [::Symbol, ::Time]).each do |c|
|
119
119
|
add(c.delete(:name), c.delete(:value), c)
|
120
120
|
end
|
121
121
|
end
|
122
|
-
|
123
|
-
private
|
124
|
-
|
125
|
-
def to_time(time)
|
126
|
-
if time.respond_to?(:to_time)
|
127
|
-
time.to_time
|
128
|
-
else
|
129
|
-
::Time.local time.year, time.month, time.day, time.hour, time.min, time.sec
|
130
|
-
end
|
131
|
-
end
|
132
122
|
end # Cookies
|
133
123
|
end # Watir
|
@@ -90,8 +90,8 @@ module Watir
|
|
90
90
|
selector = @selector.merge(element: e)
|
91
91
|
selector[:index] = idx
|
92
92
|
element = element_class.new(@query_scope, selector)
|
93
|
-
if [
|
94
|
-
tag_name = @selector[:tag_name] || element.tag_name
|
93
|
+
if [HTMLElement, Input].include? element.class
|
94
|
+
tag_name = @selector[:tag_name] || element.tag_name
|
95
95
|
hash[tag_name] ||= 0
|
96
96
|
hash[tag_name] += 1
|
97
97
|
selector[:index] = hash[tag_name] - 1
|
@@ -6,7 +6,7 @@ module Watir
|
|
6
6
|
#
|
7
7
|
|
8
8
|
class Button < HTMLElement
|
9
|
-
inherit_attributes_from
|
9
|
+
inherit_attributes_from Input
|
10
10
|
|
11
11
|
VALID_TYPES = %w[button reset submit image].freeze
|
12
12
|
|
@@ -20,16 +20,7 @@ module Watir
|
|
20
20
|
#
|
21
21
|
|
22
22
|
def text
|
23
|
-
|
24
|
-
|
25
|
-
case tn
|
26
|
-
when 'input'
|
27
|
-
value
|
28
|
-
when 'button'
|
29
|
-
super
|
30
|
-
else
|
31
|
-
raise Exception::Error, "unknown tag name for button: #{tn}"
|
32
|
-
end
|
23
|
+
tag_name == 'input' ? value : super
|
33
24
|
end
|
34
25
|
end # Button
|
35
26
|
end # Watir
|