Sha256: 2ad95976f5adb68f690d3629fa2611ad7d2209ffeffc92565c06fe7390be8073

Contents?: true

Size: 844 Bytes

Versions: 3

Compression:

Stored size: 844 Bytes

Contents

require 'rubygems'
require 'rbosa'


module Caculo
  class Safari < Browser

    def page_loaded?
      result = @application.do_javascript( 'document.readyState' , @window.document )
      return result == "complete"
    end

    def initialize
      super
      @application = OSA.app('safari')
      # puts @application
      @application.make(OSA::Safari::Document)      
      @window = @application.windows[-1]
      
      @application.do_javascript( 'window.location=\'about:config\'' , @window.document )      
      wait_until { page_loaded? }
    end

    def send_command( cmd )       
      @application.do_javascript( cmd , @window.document ).to_s
    end

    def location= url
      @window.document.url = url
    end

    def location
      @window.document.url
    end

    def current_window
      "window"
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cohitre-caculo-0.0.4 lib/caculo/safari.rb
cohitre-caculo-0.0.6 lib/caculo/safari.rb
cohitre-caculo-0.0.7 lib/caculo/safari.rb