vapir-ie 1.7.0.rc1 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -341,18 +341,19 @@ module Vapir
341
341
 
342
342
  begin
343
343
  win=container.document_object.parentWindow
344
+ document_object=win.document # I don't know why container.document_object != container.document_object.parentWindow.document
345
+
346
+ # we need a javascript function to test equality because comparing two WIN32OLEs always returns false (unless they have the same object_id, which these don't)
347
+ win.execScript("__watir_javascript_equals__=function(a, b){return a==b;}")
344
348
  rescue WIN32OLERuntimeError
345
- # if the document_object no longer has a parentWindow, we don't exist. if that's not the error, it's unexpected; raise.
346
- if $!.message =~ /unknown property or method `parentWindow'/
349
+ # if a call to these methods from the above block raised this exception, we don't exist.
350
+ # if that's not the error, it's unexpected; raise.
351
+ if $!.message =~ /unknown property or method `(parentWindow|contentWindow|document|execScript)'/
347
352
  return false
348
353
  else
349
354
  raise
350
355
  end
351
356
  end
352
- document_object=win.document # I don't know why container.document_object != container.document_object.parentWindow.document
353
-
354
- # we need a javascript function to test equality because comparing two WIN32OLEs always returns false (unless they have the same object_id, which these don't)
355
- win.execScript("__watir_javascript_equals__=function(a, b){return a==b;}")
356
357
 
357
358
  current_node=@element_object
358
359
  while current_node
@@ -7,6 +7,19 @@ module Vapir
7
7
  include Frame
8
8
  include IE::PageContainer
9
9
 
10
+ # waiting on a Frame should carry on upwards to the browser - the sorts of operations that we wait after
11
+ # (clicking a link or whatever) tend to affect other frames too; waiting on just this frame doesn't
12
+ # make sense.
13
+ def wait(options={}) # :nodoc:
14
+ if browser # prefer to wait on the browser
15
+ browser.wait(options)
16
+ elsif container # if we don't have the browser, wait on the container (presumably this exists)
17
+ container.wait(options)
18
+ else # but if we don't have a container either, just call to PageContainer#wait (by this alias)
19
+ page_container_wait(options)
20
+ end
21
+ end
22
+
10
23
  def content_window_object
11
24
  element_object.contentWindow
12
25
  end
@@ -337,6 +337,7 @@ module Vapir
337
337
  { '0x800706ba' => 'The RPC server is unavailable',
338
338
  '0x80010108' => 'The object invoked has disconnected from its clients.',
339
339
  '0x800706be' => 'The remote procedure call failed.',
340
+ '0x800706b5' => 'The interface is unknown.',
340
341
  }.keys.join('|'), Regexp::IGNORECASE)
341
342
 
342
343
  # Are we attached to an open browser?
@@ -124,19 +124,29 @@ module Vapir
124
124
  [WebBrowserReadyState::Interactive, WebBrowserReadyState::Complete].include?(browser_object.readyState)
125
125
  end
126
126
  end
127
+ # if the document object is gone, then we want to just return.
128
+ # in subsequent code where we want the document object, we will call this proc
129
+ # so that we don't have to deal with checking for error / returning every time.
130
+ doc_or_ret = proc do
131
+ begin
132
+ document_object
133
+ rescue WIN32OLERuntimeError
134
+ return
135
+ end
136
+ end
127
137
  ::Waiter.try_for(options[:timeout]-(Time.now-start_load_time), :interval => options[:interval], :exception => "The browser's document was still not defined at the end of the specified interval") do
128
138
  return unless exists?
129
- document_object
139
+ doc_or_ret.call
130
140
  end
131
141
  urls=[]
132
142
  all_frames_complete_result=::Waiter.try_for(options[:timeout]-(Time.now-start_load_time), :interval => options[:interval], :exception => nil, :condition => proc{|result| result==true }) do
133
143
  return unless exists?
134
- all_frames_complete?(document_object, urls)
144
+ all_frames_complete?(doc_or_ret.call, urls)
135
145
  end
136
146
  case all_frames_complete_result
137
147
  when false
138
148
  raise "A frame on the browser did not come into readyState complete by the end of the specified interval"
139
- when Exception
149
+ when ::Exception
140
150
  message = "A frame on the browser encountered an error.\n"
141
151
  if all_frames_complete_result.message =~ /0x80070005/
142
152
  message += "An 'Access is denied' error might be fixed by adding the domain of the site to your 'Trusted Sites'.\n"
@@ -157,6 +167,7 @@ module Vapir
157
167
  sleep @pause_after_wait if options[:sleep]
158
168
  @down_load_time
159
169
  end
170
+ alias page_container_wait wait # alias this so that Frame can clobber the #wait method
160
171
 
161
172
  private
162
173
  # this returns true if all frames are complete.
@@ -172,7 +183,7 @@ module Vapir
172
183
  urls << document.location.href
173
184
  end
174
185
  frames=document.frames
175
- return document.readyState=='complete' && (0...frames.length).all? do |i|
186
+ return ['complete', 'interactive'].include?(document.readyState) && (0...frames.length).all? do |i|
176
187
  frame=document.frames[i.to_s]
177
188
  frame_document=begin
178
189
  frame.document
@@ -1,5 +1,5 @@
1
1
  module Vapir
2
2
  class IE
3
- VERSION = '1.7.0.rc1'
3
+ VERSION = '1.7.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vapir-ie
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0.rc1
4
+ prerelease: false
5
+ segments:
6
+ - 1
7
+ - 7
8
+ - 0
9
+ version: 1.7.0
5
10
  platform: ruby
6
11
  authors:
7
12
  - Ethan
@@ -9,49 +14,77 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2010-04-30 00:00:00 -04:00
17
+ date: 2010-06-02 00:00:00 -04:00
13
18
  default_executable:
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: win32-process
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
20
24
  requirements:
21
25
  - - ">="
22
26
  - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ - 5
30
+ - 5
23
31
  version: 0.5.5
24
- version:
32
+ type: :runtime
33
+ version_requirements: *id001
25
34
  - !ruby/object:Gem::Dependency
26
35
  name: windows-pr
27
- type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
30
38
  requirements:
31
39
  - - ">="
32
40
  - !ruby/object:Gem::Version
41
+ segments:
42
+ - 0
43
+ - 6
44
+ - 6
33
45
  version: 0.6.6
34
- version:
46
+ type: :runtime
47
+ version_requirements: *id002
35
48
  - !ruby/object:Gem::Dependency
36
49
  name: vapir-common
37
- type: :runtime
38
- version_requirement:
39
- version_requirements: !ruby/object:Gem::Requirement
50
+ prerelease: false
51
+ requirement: &id003 !ruby/object:Gem::Requirement
40
52
  requirements:
41
53
  - - "="
42
54
  - !ruby/object:Gem::Version
43
- version: 1.7.0.rc1
44
- version:
55
+ segments:
56
+ - 1
57
+ - 7
58
+ - 0
59
+ version: 1.7.0
60
+ type: :runtime
61
+ version_requirements: *id003
45
62
  - !ruby/object:Gem::Dependency
46
63
  name: nokogiri
47
- type: :runtime
48
- version_requirement:
49
- version_requirements: !ruby/object:Gem::Requirement
64
+ prerelease: false
65
+ requirement: &id004 !ruby/object:Gem::Requirement
50
66
  requirements:
51
67
  - - ">="
52
68
  - !ruby/object:Gem::Version
69
+ segments:
70
+ - 0
53
71
  version: "0"
54
- version:
72
+ type: :runtime
73
+ version_requirements: *id004
74
+ - !ruby/object:Gem::Dependency
75
+ name: ffi
76
+ prerelease: false
77
+ requirement: &id005 !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ segments:
82
+ - 0
83
+ - 5
84
+ - 4
85
+ version: 0.5.4
86
+ type: :runtime
87
+ version_requirements: *id005
55
88
  description: " Vapir-IE is a library to programatically drive the Internet Explorer \n browser using the OLE interface, exposing a simple-to-use and powerful\n API to make automated testing a simple and joyous affair. \n Forked from the Watir library. \n"
56
89
  email: vapir@googlegroups.com
57
90
  executables: []
@@ -110,19 +143,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
110
143
  requirements:
111
144
  - - ">="
112
145
  - !ruby/object:Gem::Version
146
+ segments:
147
+ - 0
113
148
  version: "0"
114
- version:
115
149
  required_rubygems_version: !ruby/object:Gem::Requirement
116
150
  requirements:
117
- - - ">"
151
+ - - ">="
118
152
  - !ruby/object:Gem::Version
119
- version: 1.3.1
120
- version:
153
+ segments:
154
+ - 0
155
+ version: "0"
121
156
  requirements:
122
157
  - Microsoft Windows
123
158
  - Internet Explorer
124
159
  rubyforge_project:
125
- rubygems_version: 1.3.5
160
+ rubygems_version: 1.3.6
126
161
  signing_key:
127
162
  specification_version: 3
128
163
  summary: Library for automating the Internet Explorer browser in Ruby