lib/watir.rb in watir-6.0.0.beta5 vs lib/watir.rb in watir-6.0.0

- old
+ new

@@ -1,7 +1,8 @@ require 'selenium-webdriver' +require 'watir/legacy_wait' require 'watir/wait' require 'watir/exception' require 'watir/xpath_support' require 'watir/window' require 'watir/has_window' @@ -13,30 +14,40 @@ require 'watir/screenshot' require 'watir/after_hooks' module Watir + @relaxed_locate = true + class << self + attr_writer :relaxed_locate, :always_locate, :default_timeout, :prefer_css, :locator_namespace + # + # Whether or not Watir should wait for an element to be found or present + # before taking an action. + # Defaults to true. + # + + def relaxed_locate? + @relaxed_locate + end + + # # Whether or not Watir should re-locate a stale Element on use. # def always_locate? always_locate_message true end - def always_locate=(_bool) - always_locate_message - end - def always_locate_message warn <<-EOS Watir#always_locate is deprecated; elements are always cached and will always be re-located if they go stale before use. -Use Element#stale? or Element#wait_until_stale if needed for flow control. +Use Element#stale? or Element#wait_until(&:stale?) if needed for flow control. EOS end # # Whether or not Watir should prefer CSS when translating the Watir selectors to Selenium. @@ -45,44 +56,32 @@ def prefer_css? prefer_css_message false end - def prefer_css=(_bool) - prefer_css_message - end - def prefer_css_message warn <<-EOS Watir#prefer_css is deprecated; all elements that can not be passed directly as Selenium locators will be translated to XPath. To continue using CSS Selectors require the watir_css gem - https://github.com/watir/watir_css EOS end - def default_timeout - @default_timeout ||= 30 - end - # # Default wait time for wait methods. # - def default_timeout=(value) - @default_timeout = value + def default_timeout + @default_timeout ||= 30 end - def locator_namespace - @locator_namespace ||= Watir::Locators - end - # # Whether the locators should be used from a different namespace. # Defaults to Watir::Locators. # - def locator_namespace=(mod) - @locator_namespace = mod + def locator_namespace + @locator_namespace ||= Watir::Locators end # # @api private #