watir 6.8.2 → 6.8.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +5 -1
- data/lib/watir.rb +1 -1
- data/lib/watir/element_collection.rb +1 -22
- data/lib/watir/elements/element.rb +4 -22
- data/lib/watir/locators.rb +37 -0
- data/lib/watir/locators/element/locator.rb +3 -2
- data/spec/element_locator_spec.rb +2 -2
- data/spec/watirspec/elements/element_spec.rb +1 -1
- data/spec/watirspec/elements/filefield_spec.rb +2 -2
- data/watir.gemspec +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: f82528cb00ff57b97bbc4e8960b4ed829d64b397
|
4
|
+
data.tar.gz: 923b153593c0e8585dea3ba7b8666f23a384d329
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56daeb06087a30354f7f3ee8efd2a8b3c13f1fc89ddd20b7717db4dd9ac137b9dc7258c927fc96974ce2514fa11610c0990d0dcb9d574c94860a185085d0bdb7
|
7
|
+
data.tar.gz: 82ae8b170360fe4dd60793dc2a80271b4fd3acd08f96a91e0b6f691f0cf06e1d295baf5b2a8edc67dead5bdc55904e3e0f2f7708a3b5855c49e0c0b8e8951345
|
data/CHANGES.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
### 6.8.3 (2017-09-07)
|
2
|
+
|
3
|
+
* Fix bug with non-interactable elements not being waited on (#636)
|
4
|
+
|
1
5
|
### 6.8.2 (2017-09-06)
|
2
6
|
|
3
7
|
* Fix bug to prevent after_hooks from running when an alert is present
|
@@ -6,7 +10,7 @@
|
|
6
10
|
### 6.8.1 (2017-09-05)
|
7
11
|
|
8
12
|
* Ignore index locator when value is zero
|
9
|
-
* Fix bug with `Select#select!` doing partial string matches
|
13
|
+
* Fix bug with `Select#select!` doing partial string matches (thanks Justin Ko )
|
10
14
|
|
11
15
|
### 6.8.0 (2017-08-28)
|
12
16
|
|
data/lib/watir.rb
CHANGED
@@ -115,6 +115,7 @@ require the watir_css gem - https://github.com/watir/watir_css
|
|
115
115
|
end
|
116
116
|
|
117
117
|
end
|
118
|
+
require 'watir/locators'
|
118
119
|
|
119
120
|
require 'watir/attribute_helper'
|
120
121
|
require 'watir/row_container'
|
@@ -152,7 +153,6 @@ require 'watir/elements/text_field'
|
|
152
153
|
require 'watir/elements/input'
|
153
154
|
require 'watir/radio_set'
|
154
155
|
|
155
|
-
require 'watir/locators'
|
156
156
|
require 'watir/aliases'
|
157
157
|
|
158
158
|
Watir.tag_to_class.freeze
|
@@ -6,6 +6,7 @@ module Watir
|
|
6
6
|
|
7
7
|
class ElementCollection
|
8
8
|
include Enumerable
|
9
|
+
include Locators::ClassHelpers
|
9
10
|
|
10
11
|
def initialize(query_scope, selector)
|
11
12
|
@query_scope = query_scope
|
@@ -129,28 +130,6 @@ module Watir
|
|
129
130
|
@elements ||= locator.locate_all
|
130
131
|
end
|
131
132
|
|
132
|
-
def locator_class
|
133
|
-
Kernel.const_get("#{Watir.locator_namespace}::#{element_class_name}::Locator")
|
134
|
-
rescue NameError
|
135
|
-
Kernel.const_get("#{Watir.locator_namespace}::Element::Locator")
|
136
|
-
end
|
137
|
-
|
138
|
-
def element_validator_class
|
139
|
-
Kernel.const_get("#{Watir.locator_namespace}::#{element_class_name}::Validator")
|
140
|
-
rescue NameError
|
141
|
-
Kernel.const_get("#{Watir.locator_namespace}::Element::Validator")
|
142
|
-
end
|
143
|
-
|
144
|
-
def selector_builder_class
|
145
|
-
Kernel.const_get("#{Watir.locator_namespace}::#{element_class_name}::SelectorBuilder")
|
146
|
-
rescue NameError
|
147
|
-
Kernel.const_get("#{Watir.locator_namespace}::Element::SelectorBuilder")
|
148
|
-
end
|
149
|
-
|
150
|
-
def element_class_name
|
151
|
-
element_class.to_s.split('::').last
|
152
|
-
end
|
153
|
-
|
154
133
|
def element_class
|
155
134
|
Kernel.const_get(self.class.name.sub(/Collection$/, ''))
|
156
135
|
end
|
@@ -13,6 +13,7 @@ module Watir
|
|
13
13
|
include Waitable
|
14
14
|
include Adjacent
|
15
15
|
include JSExecution
|
16
|
+
include Locators::ClassHelpers
|
16
17
|
|
17
18
|
attr_accessor :keyword
|
18
19
|
attr_reader :selector
|
@@ -625,26 +626,8 @@ module Watir
|
|
625
626
|
raise unknown_exception, "element located, but timed out after #{Watir.default_timeout} seconds, waiting for #{inspect} to be present"
|
626
627
|
end
|
627
628
|
|
628
|
-
def
|
629
|
-
|
630
|
-
rescue NameError
|
631
|
-
Kernel.const_get("#{Watir.locator_namespace}::Element::Locator")
|
632
|
-
end
|
633
|
-
|
634
|
-
def element_validator_class
|
635
|
-
Kernel.const_get("#{Watir.locator_namespace}::#{element_class_name}::Validator")
|
636
|
-
rescue NameError
|
637
|
-
Kernel.const_get("#{Watir.locator_namespace}::Element::Validator")
|
638
|
-
end
|
639
|
-
|
640
|
-
def selector_builder_class
|
641
|
-
Kernel.const_get("#{Watir.locator_namespace}::#{element_class_name}::SelectorBuilder")
|
642
|
-
rescue NameError
|
643
|
-
Kernel.const_get("#{Watir.locator_namespace}::Element::SelectorBuilder")
|
644
|
-
end
|
645
|
-
|
646
|
-
def element_class_name
|
647
|
-
self.class.name.split('::').last
|
629
|
+
def element_class
|
630
|
+
self.class
|
648
631
|
end
|
649
632
|
|
650
633
|
def attribute?(attribute_name)
|
@@ -682,10 +665,9 @@ module Watir
|
|
682
665
|
raise_present unless Wait.timer.remaining_time > 0
|
683
666
|
raise_present unless exist_check == :wait_for_present || exist_check == :wait_for_enabled
|
684
667
|
retry
|
685
|
-
rescue Selenium::WebDriver::Error::InvalidElementStateError
|
668
|
+
rescue Selenium::WebDriver::Error::InvalidElementStateError
|
686
669
|
raise_disabled unless Wait.timer.remaining_time > 0
|
687
670
|
raise_disabled unless exist_check == :wait_for_writable || exist_check == :wait_for_enabled
|
688
|
-
raise_disabled unless ex.message.include?('user-editable')
|
689
671
|
retry
|
690
672
|
rescue Selenium::WebDriver::Error::NoSuchWindowError
|
691
673
|
raise Exception::NoMatchingWindowFoundException, "browser window was closed"
|
data/lib/watir/locators.rb
CHANGED
@@ -21,3 +21,40 @@ require 'watir/locators/text_field/locator'
|
|
21
21
|
require 'watir/locators/text_field/selector_builder'
|
22
22
|
require 'watir/locators/text_field/selector_builder/xpath'
|
23
23
|
require 'watir/locators/text_field/validator'
|
24
|
+
|
25
|
+
module Watir
|
26
|
+
module Locators
|
27
|
+
module ClassHelpers
|
28
|
+
def locator_class
|
29
|
+
class_from_string("#{Watir.locator_namespace}::#{element_class_name}::Locator") ||
|
30
|
+
class_from_string("Watir::Locators::#{element_class_name}::Locator") ||
|
31
|
+
class_from_string("#{Watir.locator_namespace}::Element::Locator") ||
|
32
|
+
Watir::Locators::Element::Locator
|
33
|
+
end
|
34
|
+
|
35
|
+
def element_validator_class
|
36
|
+
class_from_string("#{Watir.locator_namespace}::#{element_class_name}::Validator") ||
|
37
|
+
class_from_string("Watir::Locators::#{element_class_name}::Validator") ||
|
38
|
+
class_from_string("#{Watir.locator_namespace}::Element::Validator") ||
|
39
|
+
Watir::Locators::Element::Validator
|
40
|
+
end
|
41
|
+
|
42
|
+
def selector_builder_class
|
43
|
+
class_from_string("#{Watir.locator_namespace}::#{element_class_name}::SelectorBuilder") ||
|
44
|
+
class_from_string("Watir::Locators::#{element_class_name}::SelectorBuilder") ||
|
45
|
+
class_from_string("#{Watir.locator_namespace}::Element::SelectorBuilder") ||
|
46
|
+
Watir::Locators::Element::SelectorBuilder
|
47
|
+
end
|
48
|
+
|
49
|
+
def class_from_string(string)
|
50
|
+
Kernel.const_get(string)
|
51
|
+
rescue NameError
|
52
|
+
nil
|
53
|
+
end
|
54
|
+
|
55
|
+
def element_class_name
|
56
|
+
element_class.to_s.split('::').last
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -19,7 +19,7 @@ module Watir
|
|
19
19
|
]
|
20
20
|
|
21
21
|
# Regular expressions that can be reliably converted to xpath `contains`
|
22
|
-
# expressions in order to optimize the .
|
22
|
+
# expressions in order to optimize the locator.
|
23
23
|
CONVERTABLE_REGEXP = %r{
|
24
24
|
\A
|
25
25
|
([^\[\]\\^$.|?*+()]*) # leading literal characters
|
@@ -139,6 +139,7 @@ module Watir
|
|
139
139
|
else
|
140
140
|
wd_find_by_regexp_selector(selector, :select)
|
141
141
|
end
|
142
|
+
return [] if found.nil?
|
142
143
|
filter_elements found, visible, nil, :multiple
|
143
144
|
end
|
144
145
|
|
@@ -181,7 +182,7 @@ module Watir
|
|
181
182
|
|
182
183
|
if rx_selector.key?(:label) && selector_builder.should_use_label_element?
|
183
184
|
label = label_from_text(rx_selector.delete(:label)) || return
|
184
|
-
if (id = label.attribute(
|
185
|
+
if (id = label.attribute('for'))
|
185
186
|
selector[:id] = id
|
186
187
|
else
|
187
188
|
query_scope = label
|
@@ -249,8 +249,8 @@ describe Watir::Locators::Element::Locator do
|
|
249
249
|
|
250
250
|
it "handles :label => /regexp/ selector" do
|
251
251
|
label_elements = [
|
252
|
-
element(tag_name: "label", text: "foo", attributes: { for
|
253
|
-
element(tag_name: "label", text: "foob", attributes: { for
|
252
|
+
element(tag_name: "label", text: "foo", attributes: { 'for' => "bar"}),
|
253
|
+
element(tag_name: "label", text: "foob", attributes: { 'for' => "baz"})
|
254
254
|
]
|
255
255
|
div_elements = [element(tag_name: "div")]
|
256
256
|
|
@@ -98,7 +98,7 @@ describe "Element" do
|
|
98
98
|
expect(browser.elements(xpath: "//a").length).to eq 1
|
99
99
|
end
|
100
100
|
|
101
|
-
it "finds
|
101
|
+
it "finds several elements by arbitrary attribute" do
|
102
102
|
expect(browser.elements(id: /^new_user/).length).to eq 33
|
103
103
|
end
|
104
104
|
|
@@ -162,9 +162,9 @@ describe "FileField" do
|
|
162
162
|
not_compliant_on :internet_explorer, %i(chrome windows) do
|
163
163
|
bug "Raises InvalidArgumentError: File not found", :firefox do
|
164
164
|
it "does not alter its argument" do
|
165
|
-
value = File.expand_path '
|
165
|
+
value = File.expand_path '.travis.yml'
|
166
166
|
browser.file_field.value = value
|
167
|
-
expect(value).to match
|
167
|
+
expect(value).to match /\.travis\.yml$/
|
168
168
|
end
|
169
169
|
end
|
170
170
|
end
|
data/watir.gemspec
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.8.
|
4
|
+
version: 6.8.3
|
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: 2017-09-
|
12
|
+
date: 2017-09-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: selenium-webdriver
|