vapir-ie 1.8.1 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/vapir-ie/autoit.rb +2 -0
- data/lib/vapir-ie/browser.rb +4 -5
- data/lib/vapir-ie/modal_dialog.rb +18 -1
- data/lib/vapir-ie/page_container.rb +2 -2
- data/lib/vapir-ie/scripts/select_file.rb +20 -1
- data/lib/vapir-ie/version.rb +1 -1
- metadata +12 -12
data/lib/vapir-ie/autoit.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
module Vapir
|
2
2
|
AutoItDLL=File.join(File.expand_path(File.dirname(__FILE__)),'AutoItX3.dll')
|
3
|
+
# returns a WIN32OLE for an AutoIt control. if AutoIt is not registered, this will attempt to
|
4
|
+
# registered the bundled AutoIt DLL and return a WIN32OLE for it when it is registered.
|
3
5
|
def self.autoit
|
4
6
|
@@autoit||= begin
|
5
7
|
begin
|
data/lib/vapir-ie/browser.rb
CHANGED
@@ -117,7 +117,7 @@ module Vapir
|
|
117
117
|
}
|
118
118
|
how=hows.keys.detect{|h| h.to_s.downcase==orig_how.to_s.downcase}
|
119
119
|
raise ArgumentError, "how should be one of: #{hows.keys.inspect} (was #{orig_how.inspect})" unless how
|
120
|
-
@browser_object = ::Waiter.try_for(options[:timeout], :exception => NoMatchingWindowFoundException.new("Unable to locate a window with #{how} of #{what}")) do
|
120
|
+
@browser_object = ::Waiter.try_for(options[:timeout], :exception => NoMatchingWindowFoundException.new("Unable to locate a window with #{how} of #{what.inspect}")) do
|
121
121
|
self.class.browser_objects.detect do |browser_object|
|
122
122
|
begin
|
123
123
|
Vapir::fuzzy_match(hows[how].call(browser_object), what)
|
@@ -313,8 +313,7 @@ module Vapir
|
|
313
313
|
assert_exists
|
314
314
|
@browser_object.stop
|
315
315
|
@browser_object.quit
|
316
|
-
|
317
|
-
::Waiter.try_for(32, :exception => WindowFailedToCloseException.new("The browser window did not close"), :interval => 1) do
|
316
|
+
::Waiter.try_for(config.close_timeout, :exception => WindowFailedToCloseException.new("The browser window did not close"), :interval => 1) do
|
318
317
|
begin
|
319
318
|
if exists?
|
320
319
|
@browser_object.quit
|
@@ -461,7 +460,7 @@ module Vapir
|
|
461
460
|
require 'nokogiri'
|
462
461
|
if @xml_parser_doc == nil
|
463
462
|
htmlSource ="<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<HTML>\n"
|
464
|
-
htmlSource = html_source(
|
463
|
+
htmlSource = html_source(document_object.body,htmlSource," ")
|
465
464
|
htmlSource += "\n</HTML>\n"
|
466
465
|
# Angrez: Resolving Jira issue WTR-114
|
467
466
|
htmlSource = htmlSource.gsub(/ /, ' ')
|
@@ -672,7 +671,7 @@ module Vapir
|
|
672
671
|
curElem = nil
|
673
672
|
|
674
673
|
#puts "Hello; Given xpath is : #{xpath}"
|
675
|
-
doc =
|
674
|
+
doc = document_object
|
676
675
|
curElem = doc.getElementsByTagName("body").item(0)
|
677
676
|
xpath =~ /^.*\/body\[?\d*\]?\/(.*)/
|
678
677
|
xpath = $1
|
@@ -5,7 +5,24 @@ module Vapir
|
|
5
5
|
class IE::ModalDialog
|
6
6
|
include Vapir::ModalDialog
|
7
7
|
def locate
|
8
|
-
@modal_window=@browser.win_window.enabled_popup
|
8
|
+
@modal_window=@browser.win_window.enabled_popup || begin
|
9
|
+
# IE9 modal dialogs aren't modal to the actual browser window. instead it creates some
|
10
|
+
# other window with class_name="Alternate Modal Top Most" and makes the modal dialog modal
|
11
|
+
# to that thing instead. this has the same text (title) as the browser window but that
|
12
|
+
# is the only relationship I have found so far to the browser window. I'd like to use a
|
13
|
+
# stronger relationship than that, but, it'll have to do.
|
14
|
+
matching_windows = WinWindow::All.select do |win|
|
15
|
+
win.parent && win.parent.class_name == "Alternate Modal Top Most" && win.parent.text == @browser.win_window.text
|
16
|
+
end
|
17
|
+
case matching_windows.size
|
18
|
+
when 0
|
19
|
+
nil
|
20
|
+
when 1
|
21
|
+
matching_windows.first
|
22
|
+
else
|
23
|
+
raise Vapir::Exception::WindowException, "found multiple windows that looked like popups: #{matching_windows.inspect}"
|
24
|
+
end
|
25
|
+
end
|
9
26
|
end
|
10
27
|
|
11
28
|
def exists?
|
@@ -78,7 +78,7 @@ module Vapir
|
|
78
78
|
# execScript works, but behaves differently than eval (it doesn't return anything) - but
|
79
79
|
# once an execScript has run, eval is subsequently defined. so, execScript a blank script,
|
80
80
|
# and then try again with eval.
|
81
|
-
|
81
|
+
document_object.parentWindow.execScript('null')
|
82
82
|
retried=true
|
83
83
|
retry
|
84
84
|
end
|
@@ -93,7 +93,7 @@ module Vapir
|
|
93
93
|
unless options.is_a?(Hash)
|
94
94
|
raise ArgumentError, "given options should be a Hash, not #{options.inspect} (#{options.class})\nold conflicting arguments of no_sleep or last_url are gone"
|
95
95
|
end
|
96
|
-
options={:sleep => false, :interval => 0.1, :timeout =>
|
96
|
+
options={:sleep => false, :interval => 0.1, :timeout => config.wait_timeout}.merge(options)
|
97
97
|
@xml_parser_doc = nil
|
98
98
|
@down_load_time = nil
|
99
99
|
start_load_time = Time.now
|
@@ -63,7 +63,26 @@ browser_window=WinWindow.new(browser_hwnd.to_i)
|
|
63
63
|
|
64
64
|
popup=nil
|
65
65
|
$upload_dialog=::Waiter.try_for(16, :exception => nil) do
|
66
|
-
|
66
|
+
popup=browser_window.enabled_popup || begin
|
67
|
+
# IE9 modal dialogs aren't modal to the actual browser window. instead it creates some
|
68
|
+
# other window with class_name="Alternate Modal Top Most" and makes the modal dialog modal
|
69
|
+
# to that thing instead. this has the same text (title) as the browser window but that
|
70
|
+
# is the only relationship I have found so far to the browser window. I'd like to use a
|
71
|
+
# stronger relationship than that, but, it'll have to do.
|
72
|
+
matching_windows = WinWindow::All.select do |win|
|
73
|
+
win.parent && win.parent.class_name == "Alternate Modal Top Most" && win.parent.text == browser_window.text
|
74
|
+
end
|
75
|
+
case matching_windows.size
|
76
|
+
when 0
|
77
|
+
nil
|
78
|
+
when 1
|
79
|
+
matching_windows.first
|
80
|
+
else
|
81
|
+
raise Vapir::Exception::WindowException, "found multiple windows that looked like popups: #{matching_windows.inspect}"
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
if popup && UploadWindowTitles.values.include?(popup.text)
|
67
86
|
popup
|
68
87
|
end
|
69
88
|
end
|
data/lib/vapir-ie/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vapir-ie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 51
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 1.
|
8
|
+
- 9
|
9
|
+
- 0
|
10
|
+
version: 1.9.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ethan
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-08-04 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -26,12 +26,12 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - "="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
hash:
|
29
|
+
hash: 51
|
30
30
|
segments:
|
31
31
|
- 1
|
32
|
-
-
|
33
|
-
-
|
34
|
-
version: 1.
|
32
|
+
- 9
|
33
|
+
- 0
|
34
|
+
version: 1.9.0
|
35
35
|
type: :runtime
|
36
36
|
version_requirements: *id001
|
37
37
|
- !ruby/object:Gem::Dependency
|
@@ -81,12 +81,12 @@ dependencies:
|
|
81
81
|
version: 0.5.4
|
82
82
|
- - <
|
83
83
|
- !ruby/object:Gem::Version
|
84
|
-
hash:
|
84
|
+
hash: 15
|
85
85
|
segments:
|
86
|
-
-
|
86
|
+
- 2
|
87
87
|
- 0
|
88
88
|
- 0
|
89
|
-
version:
|
89
|
+
version: 2.0.0
|
90
90
|
type: :runtime
|
91
91
|
version_requirements: *id004
|
92
92
|
- !ruby/object:Gem::Dependency
|