def when_present(timeout = nil)
      msg = '#when_present'
      repl_msg = '#wait_until_present if a wait is still needed'
      Watir.logger.deprecate msg, repl_msg, ids: [:when_present]

      timeout ||= Watir.default_timeout
      message = "waiting for #{selector_string} to become present"

      if block_given?
        Wait.until(timeout, message) { present? }
        yield self
      else
        WhenPresentDecorator.new(self, timeout, message)
      end
    end
def when_present(timeout = nil)
      msg = '#when_present'
      repl_msg = '#wait_until_present if a wait is still needed'
      Watir.logger.deprecate msg, repl_msg, ids: [:when_present]

      timeout ||= Watir.default_timeout
      message = "waiting for #{selector_string} to become present"

      if block_given?
        Wait.until(timeout, message) { present? }
        yield self
      else
        WhenPresentDecorator.new(self, timeout, message)
      end
    end
Waits until the element is present.

 @example
   browser.text_field(name: "new_user_first_name").when_present.click
   browser.text_field(name: "new_user_first_name").when_present { |field| field.set "Watir" }
   browser.text_field(name: "new_user_first_name").when_present(60).text

 @param [Integer] timeout seconds to wait before timing out

 @see Watir::Wait
 @see Watir::Element#present?