lib/watir.rb in watir-6.0.0.beta3 vs lib/watir.rb in watir-6.0.0.beta4

- old
+ new

@@ -12,48 +12,64 @@ require 'watir/browser' require 'watir/screenshot' require 'watir/after_hooks' module Watir - @always_locate = true class << self - def always_locate? - @always_locate - end # - # Whether or not Watir should cache element references or always re-locate an Element on use. - # Defaults to true. + # Whether or not Watir should re-locate a stale Element on use. # - def always_locate=(bool) - @always_locate = bool + def always_locate? + always_locate_message + true end - def default_timeout - @default_timeout ||= 30 + 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. + EOS + end + # - # Default wait time for wait methods. + # Whether or not Watir should prefer CSS when translating the Watir selectors to Selenium. # - def default_timeout=(value) - @default_timeout = value + def prefer_css? + prefer_css_message + false end - def prefer_css? - @prefer_css + 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 + # - # Whether or not Watir should prefer CSS when translating the Watir selectors to Selenium. - # Defaults to false. + # Default wait time for wait methods. # - def prefer_css=(bool) - @prefer_css = bool + def default_timeout=(value) + @default_timeout = value end def locator_namespace @locator_namespace ||= Watir::Locators end