lib/watir/locators/element/locator.rb in watir-6.16.1 vs lib/watir/locators/element/locator.rb in watir-6.16.2

- old
+ new

@@ -12,19 +12,19 @@ @element_matcher = element_matcher end def locate(built) @built = built.dup - @driver_scope = (@built.delete(:scope) || @query_scope.browser).wd + @driver_scope = locator_scope.wd matching_elements(@built, :first) rescue Selenium::WebDriver::Error::NoSuchElementError nil end def locate_all(built) @built = built.dup - @driver_scope = (@built.delete(:scope) || @query_scope.browser).wd + @driver_scope = locator_scope.wd raise ArgumentError, "can't locate all elements by :index" if built.key?(:index) [matching_elements(@built, :all)].flatten end @@ -48,9 +48,13 @@ sleep 0.5 retry unless retries > 2 target = filter == :all ? 'element collection' : 'element' raise LocatorException, "Unable to locate #{target} from #{@selector} due to changing page" end + end + + def locator_scope + @built.delete(:scope) || @query_scope.browser end def locate_element(how, what, scope = driver_scope) scope.find_element(how, what) end