Sha256: a017345a2a6e145f777a07efd7fb96301936e5b2ba03e1fbbe4bb4758bf20f55
Contents?: true
Size: 916 Bytes
Versions: 3
Compression:
Stored size: 916 Bytes
Contents
require 'net/telnet' module Caculo class Firefox < Browser def initialize super @telnet = Net::Telnet::new("Host" => "localhost","Port" => 9997, "Prompt" => /[$%#>] /n) 10.times { socket_send "\n" } socket_send 'window = getWindows()[getWindows().length-1].getBrowser().contentWindow.window' socket_send( "window.location = 'about:blank'" ) wait_until { page_loaded? } end def send_command cmd socket_send( cmd ) end def page_loaded? result = socket_send( "#{browser}.webProgress.isLoadingDocument" ) return result =~ /false/ end private def browser "getWindows()[getWindows().length-1].getBrowser()" end def window browser+".contentWindow" end def socket_send cmd @telnet.cmd( " " ) @telnet.cmd( cmd.to_s ).gsub( /\n> $/,"" ) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
cohitre-caculo-0.0.4 | lib/caculo/firefox.rb |
cohitre-caculo-0.0.6 | lib/caculo/firefox.rb |
cohitre-caculo-0.0.7 | lib/caculo/firefox.rb |