lib/watir/locators/element/locator.rb in watir-6.8.2 vs lib/watir/locators/element/locator.rb in watir-6.8.3
- old
+ new
@@ -17,11 +17,11 @@
:tag_name,
:xpath
]
# Regular expressions that can be reliably converted to xpath `contains`
- # expressions in order to optimize the .
+ # expressions in order to optimize the locator.
CONVERTABLE_REGEXP = %r{
\A
([^\[\]\\^$.|?*+()]*) # leading literal characters
[^|]*? # do not try to convert expressions with alternates
([^\[\]\\^$.|?*+()]*) # trailing literal characters
@@ -137,10 +137,11 @@
found = if how
locate_elements(how, what)
else
wd_find_by_regexp_selector(selector, :select)
end
+ return [] if found.nil?
filter_elements found, visible, nil, :multiple
end
def wd_find_all_by(how, what)
if what.is_a? String
@@ -179,10 +180,10 @@
query_scope = ensure_scope_context
rx_selector = delete_regexps_from(selector)
if rx_selector.key?(:label) && selector_builder.should_use_label_element?
label = label_from_text(rx_selector.delete(:label)) || return
- if (id = label.attribute(:for))
+ if (id = label.attribute('for'))
selector[:id] = id
else
query_scope = label
end
end