Sha256: e2ecf0f6c63f6ca5db2b8bcf5379da7979a21e38d07f7a60928d438686e09020

Contents?: true

Size: 1.67 KB

Versions: 5

Compression:

Stored size: 1.67 KB

Contents

module OperaWatir
  module Compat
    module Window
      include Deprecated

      #
      # Checks whether the body has the given text in it.
      #
      # @param [String] str Text to search for.
      # @return [Boolean] true if the body contains the given text,
      #   false otherwise
      #

      def contains_text(str)
        text.index(str)
      end


      #
      # Find elements that match the given XPath.
      #
      # @param [String] value The XPath expression to search for.
      # @return [OperaWatir::Collection] A collection of matching
      #   elements.
      #

      def elements_by_xpath(value)
        find_by_xpath(value)
      end

      alias_method :element_by_xpath, :elements_by_xpath


      #
      # Opera specific
      #

      def get_hash
        visual_hash
      end

      deprecated :get_hash, 'browser.visual_hash'


      #
      # TODO This is a relic from the old OperaWatir implementation,
      # tests should be updated.
      #

      def frame(selector, argument)
        case selector
        when :name
          driver.switch_to.frame(argument)
        when :index
          driver.switch_to.frame(argument.to_i - 1)  # index starts from 1 in Watir
        else
          raise OperaWatir::Exceptions::NotImplementedException,
            "We do not support the `#{selector}' selector yet"
        end
      end


      def switch_to_default
        driver.switch_to.default_content
      end

      
      def show_frames
        frames = driver.list_frames
        puts "There are #{frames.length.to_s} frames"
        frames.each_with_index { |frame, i| puts "frame index: #{(i.to_i + 1).to_s} name: #{frame.to_s}" }
      end

    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
operawatir-0.4.3.pre1-jruby lib/operawatir/compat/window.rb
operawatir-0.4.2-jruby lib/operawatir/compat/window.rb
operawatir-0.4.1-jruby lib/operawatir/compat/window.rb
operawatir-0.4.1.pre7-jruby lib/operawatir/compat/window.rb
operawatir-0.4.1.pre6-jruby lib/operawatir/compat/window.rb