Class: IEgrip::IE
- Inherits:
-
GripWrapper
- Object
- GripWrapper
- IEgrip::IE
- Defined in:
- lib/iegrip.rb
Overview
IE Application
Constant Summary collapse
- COMPLETE_STATE =
4
Instance Attribute Summary collapse
-
#timeout ⇒ Object
Returns the value of attribute timeout.
Instance Method Summary collapse
- #document ⇒ Object
- #export(href, filename) ⇒ Object
-
#initialize ⇒ IE
constructor
A new instance of IE.
- #navigate(url) ⇒ Object
- #version ⇒ Object
- #wait_stable ⇒ Object
Methods inherited from GripWrapper
#inspect, #ole_methodNames, #raw
Constructor Details
#initialize ⇒ IE
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
#timeout ⇒ Object
Returns the value of attribute timeout.
27 28 29 |
# File 'lib/iegrip.rb', line 27 def timeout @timeout end |
Instance Method Details
#document ⇒ Object
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 |
#navigate(url) ⇒ Object
37 38 39 40 |
# File 'lib/iegrip.rb', line 37 def navigate(url) @raw_object.navigate(url) wait_stable() end |
#version ⇒ Object
29 30 31 |
# File 'lib/iegrip.rb', line 29 def version @majorVersion end |
#wait_stable ⇒ Object
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 |