Class: IEgrip::IE

Inherits:
GripWrapper show all
Defined in:
lib/iegrip.rb

Overview

IE Application

Constant Summary collapse

COMPLETE_STATE =
4

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from GripWrapper

#inspect, #ole_methodNames, #raw

Constructor Details

#initializeIE

Returns a new instance of IE.



17
18
19
20
21
22
23
24
25
# File 'lib/iegrip.rb', line 17

def initialize()
  @raw_object = WIN32OLE.new("InternetExplorer.Application")
  @raw_object.visible = true
  fs = FileSystemObject.instance
  ver = fs.GetFileVersion(@raw_object.FullName)
  @majorVersion = ver.split(/\./)[0].to_i
  @urlDownloadToFile = Win32API.new('urlmon', 'URLDownloadToFileA', %w(l p p l l), 'l')
  @timeout = 15
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class IEgrip::GripWrapper

Instance Attribute Details

#timeoutObject

Returns the value of attribute timeout.



27
28
29
# File 'lib/iegrip.rb', line 27

def timeout
  @timeout
end

Instance Method Details

#documentObject



33
34
35
# File 'lib/iegrip.rb', line 33

def document()
  doc = Document.new(@raw_object.Document, self)
end

#export(href, filename) ⇒ Object



50
51
52
# File 'lib/iegrip.rb', line 50

def export(href, filename)
  @urlDownloadToFile.call(0, href, filename, 0, 0)
end


37
38
39
40
# File 'lib/iegrip.rb', line 37

def navigate(url)
  @raw_object.navigate(url)
  wait_stable()
end

#versionObject



29
30
31
# File 'lib/iegrip.rb', line 29

def version
  @majorVersion
end

#wait_stableObject



43
44
45
46
47
48
# File 'lib/iegrip.rb', line 43

def wait_stable()
  loop do
    break if (@raw_object.Busy != true) and (@raw_object.ReadyState == COMPLETE_STATE)
    sleep 0.5
  end
end