awetestlib 0.1.29 → 0.1.30pre1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/bin/awetestlib +18 -3
- data/bin/awetestlib-helpers.rb +19 -0
- data/images/netbeans1.jpg +0 -0
- data/images/netbeans2.jpg +0 -0
- data/images/netbeans3.jpg +0 -0
- data/images/netbeans4.jpg +0 -0
- data/images/netbeans5.jpg +0 -0
- data/images/rubymine1.jpg +0 -0
- data/images/rubymine2.jpg +0 -0
- data/images/rubymine3.jpg +0 -0
- data/images/rubymine4.jpg +0 -0
- data/images/scripting1.png +0 -0
- data/images/scripting2.png +0 -0
- data/images/scripting3.png +0 -0
- data/images/scripting4.png +0 -0
- data/lib/awetestlib.rb +5 -5
- data/lib/awetestlib/html_report.rb +74 -43
- data/lib/awetestlib/logging.rb +6 -6
- data/lib/awetestlib/regression/browser.rb +37 -30
- data/lib/awetestlib/regression/drag_and_drop.rb +4 -3
- data/lib/awetestlib/regression/runner.rb +44 -44
- data/lib/awetestlib/regression/tables.rb +17 -9
- data/lib/awetestlib/regression/user_input.rb +1 -1
- data/lib/awetestlib/regression/utilities.rb +69 -11
- data/lib/awetestlib/regression/validations.rb +84 -65
- data/lib/awetestlib/runner.rb +1 -1
- data/lib/version.rb +2 -2
- data/netbeans_setup.md +6 -6
- data/rubymine_setup.md +5 -5
- data/setup_samples/sample_cucumber/features/step_definitions/predefined_steps.rb +1 -1
- data/test/demo_wwd.rb +7 -0
- metadata +21 -5
data/.gitignore
CHANGED
data/bin/awetestlib
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
$: << "./lib"
|
2
|
+
|
3
|
+
$base_time = Time.now
|
4
|
+
$load_times = Hash.new
|
5
|
+
$capture_load_times = true
|
6
|
+
|
2
7
|
require File.join(File.dirname(__FILE__),"awetestlib-helpers")
|
3
|
-
require 'fileutils'
|
8
|
+
require 'fileutils' #: load_time
|
4
9
|
|
5
10
|
cmd = ARGV[0]
|
6
11
|
|
@@ -30,8 +35,8 @@ elsif cmd == 'driver_setup'
|
|
30
35
|
awetestlib_driver_setup
|
31
36
|
else
|
32
37
|
|
33
|
-
require 'optparse'
|
34
|
-
require 'awetestlib'
|
38
|
+
require 'optparse' #; load_time('optparse')
|
39
|
+
require 'awetestlib' #; load_time
|
35
40
|
|
36
41
|
options = { }
|
37
42
|
OptionParser.new do |opts|
|
@@ -77,12 +82,18 @@ OptionParser.new do |opts|
|
|
77
82
|
opts.on("-o", "--output_to_log", "Write to log file") do
|
78
83
|
options[:output_to_log] = true
|
79
84
|
end
|
85
|
+
opts.on("-c", "--classic_watir", "Use Classic Watir for IE instead of Watir-webdriver") do
|
86
|
+
options[:classic_watir] = true
|
87
|
+
end
|
80
88
|
opts.on("", "--log_path_subdir LOG_PATH_SUBDIR", "Specify log path relative to root_path.") do |log_path_subdir|
|
81
89
|
options[:log_path_subdir] = log_path_subdir
|
82
90
|
end
|
83
91
|
opts.on("", "--report_all_test_refs REPORT_ALL_TEST_REFS", "Include list of all error/test case reference ids actually validated.") do
|
84
92
|
options[:report_all_test_refs] = true
|
85
93
|
end
|
94
|
+
opts.on("", "--capture_load_times CAPTURE_LOAD_TIMES", "Capture load time for gem requires.") do
|
95
|
+
options[:capture_load_times] = true
|
96
|
+
end
|
86
97
|
|
87
98
|
end.parse!
|
88
99
|
|
@@ -92,6 +103,10 @@ options[:environment]["url"] = options[:environment_url]
|
|
92
103
|
options[:environment]["nodename"] = options[:environment_nodename]
|
93
104
|
check_script_type(options)
|
94
105
|
|
106
|
+
$watir_script = options[:classic_watir]
|
107
|
+
$capture_load_times = options[:capture_load_times] unless $capture_load_times
|
108
|
+
|
109
|
+
|
95
110
|
IS_WIN_2008 = File.exists?("config/win2008.txt")
|
96
111
|
Awetestlib::Runner.new(options)
|
97
112
|
|
data/bin/awetestlib-helpers.rb
CHANGED
@@ -40,3 +40,22 @@ def check_script_type(options)
|
|
40
40
|
options[:script_file] = ARGV[0]
|
41
41
|
end
|
42
42
|
end
|
43
|
+
|
44
|
+
def load_time(what = nil, time = Time.now)
|
45
|
+
if $capture_load_times
|
46
|
+
caller = Kernel.caller
|
47
|
+
called = $"
|
48
|
+
unless what
|
49
|
+
what = "#{caller[0]} => #{called[called.length - 1]}"
|
50
|
+
end
|
51
|
+
elapsed = time - $base_time
|
52
|
+
msg = "#{what} #{sprintf('%.4f', elapsed)}"
|
53
|
+
$load_times[time.to_f] = msg
|
54
|
+
begin
|
55
|
+
debug_to_report("#{time.to_f}: #{msg}")
|
56
|
+
rescue
|
57
|
+
puts("#{time.to_f}: #{msg}")
|
58
|
+
end
|
59
|
+
$base_time = time
|
60
|
+
end
|
61
|
+
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/lib/awetestlib.rb
CHANGED
@@ -27,13 +27,13 @@ module Awetestlib
|
|
27
27
|
#require 'active_support/inflector'
|
28
28
|
#require 'active_support/core_ext/object'
|
29
29
|
#require 'active_support/core_ext/hash'
|
30
|
-
require 'awetestlib/runner'
|
31
|
-
require 'andand'
|
32
|
-
require 'awetestlib/regression/runner'
|
33
|
-
require 'pry'
|
30
|
+
require 'awetestlib/runner' #; load_time
|
31
|
+
require 'andand' #; load_time
|
32
|
+
require 'awetestlib/regression/runner' #; load_time
|
33
|
+
require 'pry' #; load_time
|
34
34
|
|
35
35
|
if USING_OSX
|
36
|
-
require 'appscript'
|
36
|
+
require 'appscript' #; load_time
|
37
37
|
end
|
38
38
|
|
39
39
|
#require 'roo' #moved to awetestlib runner
|
@@ -5,7 +5,7 @@ module Awetestlib
|
|
5
5
|
# Initialize the report class
|
6
6
|
# @private
|
7
7
|
def initialize(report_name)
|
8
|
-
@reportname
|
8
|
+
@reportname = report_name
|
9
9
|
@reportContent1 = ''
|
10
10
|
@reportContent2 = ''
|
11
11
|
end
|
@@ -16,13 +16,17 @@ module Awetestlib
|
|
16
16
|
# Get current time
|
17
17
|
t = Time.now
|
18
18
|
|
19
|
+
@col_1_p = '65%'
|
20
|
+
@col_2_p = '25%'
|
21
|
+
@col_3_p = '10%'
|
22
|
+
|
19
23
|
# Create the report name
|
20
|
-
|
21
|
-
|
22
|
-
|
24
|
+
rpt_time = "#{t.strftime("%Y%m%d_%H%M%S")}"
|
25
|
+
rpt_nice_time = "#{t.strftime("%m/%d/%Y @ %H:%M:%S")}"
|
26
|
+
rpt_file_name = "#{reportName}_#{rpt_time}.html"
|
23
27
|
|
24
28
|
# Create the HTML report
|
25
|
-
|
29
|
+
rpt_file = File.open(rpt_file_name, 'w')
|
26
30
|
|
27
31
|
# Format the header of the HTML report
|
28
32
|
@reportContent1 = '<html>
|
@@ -31,19 +35,22 @@ module Awetestlib
|
|
31
35
|
<title>Awetestlib Test Run</title>
|
32
36
|
<style type=text/css>
|
33
37
|
.title { font-family: verdana; font-size: 30px; font-weight: bold; align: left; color: #000000;}
|
34
|
-
.bold_text { font-family: verdana; font-size:
|
35
|
-
.bold_large_text { font-family: verdana; font-size:
|
36
|
-
.normal_text { font-family: verdana; font-size:
|
37
|
-
.
|
38
|
+
.bold_text { font-family: verdana; font-size: 11px; font-weight: bold;}
|
39
|
+
.bold_large_text { font-family: verdana; font-size: 12px; font-weight: bold;}
|
40
|
+
.normal_text { font-family: verdana; font-size: 11px; font-weight: normal;}
|
41
|
+
.center_text { font-family: verdana; font-size: 11px; font-weight: normal; text-align: center;}
|
42
|
+
.small_text { font-family: verdana; font-size: 9px; font-weight: normal; }
|
38
43
|
.border { border: 1px solid #000000;}
|
39
44
|
.mark_testlevel_left { border-top: 1px solid #858585; border-left: 1px solid #858585;background-color:#E2F4FE;}
|
45
|
+
.mark_testlevel_middle { border-top: 1px solid #858585; background-color:#E2F4FE;}
|
40
46
|
.mark_testlevel_right { border-top: 1px solid #858585; border-right: 1px solid #858585;background-color:#E2F4FE;}
|
41
47
|
.border_left { border-top: 1px solid #858585; border-left: 1px solid #858585; border-right: 1px solid #858585;}
|
48
|
+
.border_middle { border-top: 1px solid #858585; border-right: 1px solid #858585;}
|
42
49
|
.border_right { border-top: 1px solid #858585; border-right: 1px solid #858585;}
|
43
|
-
.result_ok { font-family: verdana; font-size:
|
44
|
-
.result_nok { font-family: verdana; font-size:
|
45
|
-
.overall_ok { font-family: verdana; font-size:
|
46
|
-
.overall_nok { font-family: verdana; font-size:
|
50
|
+
.result_ok { font-family: verdana; font-size: 11px; font-weight: bold; text-align: center; color: green;}
|
51
|
+
.result_nok { font-family: verdana; font-size: 11px; font-weight: bold; text-align: center; color: red;}
|
52
|
+
.overall_ok { font-family: verdana; font-size: 11px; font-weight: bold; text-align: left; color: green;}
|
53
|
+
.overall_nok { font-family: verdana; font-size: 11px; font-weight: bold; text-align: left; color: red;}
|
47
54
|
.bborder_left { border-top: 1px solid #858585; border-left: 1px solid #858585; border-bottom: 1px solid #858585; background-color:#858585;font-family: verdana; font-size: 12px; font-weight: bold; text-align: center; color: white;}
|
48
55
|
.bborder_right { border-right: 1px solid #858585; background-color:#858585;font-family: verdana; font-size: 12px; font-weight: bold; text-align: center; color: white;}
|
49
56
|
</style>
|
@@ -51,11 +58,11 @@ module Awetestlib
|
|
51
58
|
<body>
|
52
59
|
<br>
|
53
60
|
<center>
|
54
|
-
<table width=
|
61
|
+
<table width=auto border=0 cellpadding=2 cellspacing=2>
|
55
62
|
<tbody>
|
56
63
|
<tr>
|
57
64
|
<td>
|
58
|
-
<table width=
|
65
|
+
<table width=90% border=0 cellpadding=2 cellspacing=2>
|
59
66
|
<tbody>
|
60
67
|
<tr>
|
61
68
|
<td style=width: 150px;> </td>
|
@@ -67,17 +74,19 @@ module Awetestlib
|
|
67
74
|
<br>
|
68
75
|
<hr width=100% class=border size=1px>
|
69
76
|
<center>
|
70
|
-
<table border=0 width=
|
77
|
+
<table border=0 width=100% cellpadding=2 cellspacing=2>
|
71
78
|
<tbody>
|
72
79
|
<tr>
|
80
|
+
<td width=10%><p class=normal_text></p></td>
|
73
81
|
<td width=20%><p class=bold_text>Script</p></td>
|
74
82
|
<td width=5%><p class=bold_text>:</p></td>
|
75
|
-
<td width=
|
83
|
+
<td width=65%><p class=normal_text>' + @reportname.capitalize + '</p></td>
|
76
84
|
</tr>
|
77
85
|
<tr>
|
86
|
+
<td width=10%><p class=normal_text></p></td>
|
78
87
|
<td width=20%><p class=bold_text>Test Execution</p></td>
|
79
88
|
<td width=5%><p class=bold_text>:</p></td>
|
80
|
-
<td width=
|
89
|
+
<td width=65%><p class=normal_text>' + rpt_nice_time + '</p></td>
|
81
90
|
</tr>
|
82
91
|
<tr>'
|
83
92
|
|
@@ -87,56 +96,78 @@ module Awetestlib
|
|
87
96
|
</center>
|
88
97
|
<br>
|
89
98
|
<center>
|
90
|
-
<table width=
|
99
|
+
<table width=100% cellpadding=2 cellspacing=0>
|
91
100
|
<tbody>
|
92
101
|
<tr>
|
93
|
-
<td class=bborder_left width=
|
94
|
-
<td class=bborder_left width=
|
95
|
-
</
|
102
|
+
<td class=bborder_left width=' + @col_1_p + '><p>Test Step</p></td>
|
103
|
+
<td class=bborder_left width=' + @col_2_p + '><p>Location</p></td>
|
104
|
+
<td class=bborder_left width=' + @col_3_p + '><p>Result</p></td>
|
105
|
+
</tr>' + "\n"
|
96
106
|
|
97
107
|
# Close the report
|
98
|
-
|
108
|
+
rpt_file.close
|
99
109
|
|
100
|
-
return
|
110
|
+
return rpt_file_name
|
101
111
|
end
|
102
112
|
|
103
113
|
# Add a row to the report
|
104
114
|
# @private
|
105
|
-
def add_to_report(
|
115
|
+
def add_to_report(message, location, result, level = 1)
|
106
116
|
# Format the body of the HTML report
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
117
|
+
|
118
|
+
left_class = 'border_left'
|
119
|
+
right_class = 'border_right'
|
120
|
+
pgph_class = 'normal_text'
|
121
|
+
loc_class = 'center_text'
|
122
|
+
rslt_class = 'result_ok'
|
123
|
+
middle_class = 'border_middle'
|
124
|
+
|
125
|
+
rslt_class = 'result_nok' if result == "FAILED"
|
126
|
+
case result
|
127
|
+
when 'FAILED'
|
128
|
+
rslt_class = 'result_nok'
|
129
|
+
when 'PASSED'
|
130
|
+
rslt_class = 'result_ok'
|
131
|
+
else
|
132
|
+
if level
|
133
|
+
if level >= 1
|
134
|
+
pgph_class = 'bold_large_text'
|
135
|
+
left_class = 'mark_testlevel_left'
|
136
|
+
middle_class = 'mark_testlevel_middle'
|
137
|
+
right_class = 'mark_testlevel_right'
|
138
|
+
end
|
139
|
+
end
|
119
140
|
end
|
141
|
+
|
142
|
+
row = '<tr>
|
143
|
+
<td class=' + left_class + ' width=' + @col_1_p + '><p class=' + pgph_class + '>' + message + '</p></td>
|
144
|
+
<td class=' + middle_class + ' width=' + @col_2_p + '><p class=' + loc_class + '>' + location + '</p></td>
|
145
|
+
<td class=' + right_class + ' width=' + @col_3_p + '><p class=' + rslt_class + '>' + result + '</p></td>
|
146
|
+
</tr>'
|
147
|
+
|
148
|
+
@reportContent2 += row + "\n"
|
149
|
+
|
120
150
|
end
|
121
151
|
|
122
152
|
# Close the report HTML
|
123
153
|
# @private
|
124
154
|
def finish_report(reportName)
|
125
155
|
# Open the HTML report
|
126
|
-
|
156
|
+
rpt_file = File.open(reportName, 'a')
|
127
157
|
|
128
158
|
@reportContent2 = @reportContent2 + '<tr>
|
129
|
-
<td class=bborder_left width=
|
130
|
-
<td class=bborder_left width=
|
159
|
+
<td class=bborder_left width=' + @col_1_p + '><p> </p></td>
|
160
|
+
<td class=bborder_left width=' + @col_2_p + '><p> </p></td>
|
161
|
+
<td class=bborder_left width=' + @col_3_p + '><p> </p></td>
|
131
162
|
</tr>
|
132
163
|
</table>'
|
133
164
|
|
134
|
-
|
165
|
+
rpt_file.puts(@reportContent1)
|
135
166
|
|
136
|
-
|
167
|
+
rpt_file.puts(@reportContent2)
|
137
168
|
|
138
169
|
# Close the report
|
139
|
-
|
170
|
+
rpt_file.close
|
140
171
|
end
|
141
172
|
end
|
142
173
|
end
|
data/lib/awetestlib/logging.rb
CHANGED
@@ -99,7 +99,7 @@ module Awetestlib
|
|
99
99
|
# failed_to_log "SIKULI LOG:\n\n #{output_lines.join('\n')}"
|
100
100
|
# end
|
101
101
|
|
102
|
-
return { :result => passed, :msg =>
|
102
|
+
return { :result => passed, :msg => output_lines }
|
103
103
|
end
|
104
104
|
|
105
105
|
|
@@ -126,9 +126,9 @@ module Awetestlib
|
|
126
126
|
end
|
127
127
|
strg << " #{message}" if message.length > 0
|
128
128
|
strg << " (#{desc})" if desc.length > 0
|
129
|
-
strg << " [#{call_line}]"
|
129
|
+
strg << " [#{call_line}]" if dbg or @debug_calls
|
130
130
|
strg << "\n#{list.to_yaml}" if dbg or @debug_calls
|
131
|
-
@report_class.add_to_report(strg, " ", lvl || 1) unless Awetestlib::Runner.nil?
|
131
|
+
@report_class.add_to_report(strg, " ", " ", lvl || 1) unless Awetestlib::Runner.nil?
|
132
132
|
log_message(INFO, strg, lvl, nil, 1)
|
133
133
|
rescue
|
134
134
|
failed_to_log("#{__method__}: #{$!}")
|
@@ -170,7 +170,7 @@ module Awetestlib
|
|
170
170
|
message << " \n#{get_debug_list}" if dbg or @debug_calls # and not @debug_calls_fail_only)
|
171
171
|
@my_passed_count += 1 if @my_passed_count
|
172
172
|
parse_error_references(message)
|
173
|
-
@report_class.add_to_report(message, "PASSED") unless Awetestlib::Runner.nil?
|
173
|
+
@report_class.add_to_report(message, get_caller(lnbr), "PASSED") unless Awetestlib::Runner.nil?
|
174
174
|
log_message(INFO, "#{message}", PASS, lnbr)
|
175
175
|
end
|
176
176
|
|
@@ -186,7 +186,7 @@ module Awetestlib
|
|
186
186
|
message << " \n#{get_debug_list}" if dbg.to_s == 'true' or @debug_calls or @debug_calls_fail_only
|
187
187
|
@my_failed_count += 1 if @my_failed_count
|
188
188
|
parse_error_references(message, true)
|
189
|
-
@report_class.add_to_report("#{message}"
|
189
|
+
@report_class.add_to_report("#{message}", get_caller(lnbr), "FAILED") unless Awetestlib::Runner.nil?
|
190
190
|
log_message(WARN, "#{message}", FAIL, lnbr, nil, exception)
|
191
191
|
end
|
192
192
|
|
@@ -202,7 +202,7 @@ module Awetestlib
|
|
202
202
|
message << " \n#{get_debug_list}" if dbg.to_s == 'true' or (@debug_calls and not @debug_calls_fail_only)
|
203
203
|
@my_failed_count += 1 if @my_failed_count
|
204
204
|
parse_error_references(message, true)
|
205
|
-
@report_class.add_to_report("#{message}"
|
205
|
+
@report_class.add_to_report("#{message}", get_caller(lnbr), "FAILED") unless Awetestlib::Runner.nil?
|
206
206
|
debug_to_report("#{__method__}:\n#{dump_caller(lnbr)}")
|
207
207
|
log_message(FATAL, "#{message} (#{lnbr})", FAIL, lnbr, nil, exception)
|
208
208
|
end
|
@@ -40,6 +40,7 @@ module Awetestlib
|
|
40
40
|
|
41
41
|
# Open a browser based on the command line parameters that identify the browser and
|
42
42
|
# version to use for the test.
|
43
|
+
# @note Safari currently supported only on Mac OS X
|
43
44
|
# @example
|
44
45
|
# browser = open_browser('www.google.com')
|
45
46
|
# @param [String, Regexp] url When provided, the browser will go to this url.
|
@@ -53,10 +54,13 @@ module Awetestlib
|
|
53
54
|
@myHwnd = @myBrowser.hwnd
|
54
55
|
end
|
55
56
|
when 'FF'
|
56
|
-
@myBrowser =
|
57
|
+
@myBrowser = open_ff
|
57
58
|
when 'S'
|
58
|
-
|
59
|
-
|
59
|
+
if USING_OSX
|
60
|
+
@myBrowser = open_safari
|
61
|
+
else
|
62
|
+
raise "Safari is not supported under this operating system #{RUBY_PLATFORM}"
|
63
|
+
end
|
60
64
|
when 'C', 'GC'
|
61
65
|
@myBrowser = open_chrome
|
62
66
|
else
|
@@ -82,18 +86,16 @@ module Awetestlib
|
|
82
86
|
browser
|
83
87
|
end
|
84
88
|
|
85
|
-
# Open
|
86
|
-
# @
|
87
|
-
# @return [Watir::Browser
|
88
|
-
|
89
|
-
|
90
|
-
browser = Watir::Browser.new :firefox
|
89
|
+
# Open Safari browser instance.
|
90
|
+
# @note Safari currently supported only on Mac OS X
|
91
|
+
# @return [Watir::Browser]
|
92
|
+
def open_safari
|
93
|
+
browser = Watir::Browser.new(:remote, :desired_capabilities=>:'safari')
|
91
94
|
end
|
92
95
|
|
93
96
|
# Open FF (Firefox) browser instance under FireWatir.
|
94
|
-
# @return [
|
97
|
+
# @return [Watir::Browser]
|
95
98
|
def open_ff
|
96
|
-
# Watir::Browser.default = 'firefox'
|
97
99
|
browser = Watir::Browser.new :firefox
|
98
100
|
end
|
99
101
|
|
@@ -502,17 +504,18 @@ module Awetestlib
|
|
502
504
|
end
|
503
505
|
|
504
506
|
# Closes main browser session. Misnamed. Usually used at end of script to shut down browser.
|
505
|
-
def
|
507
|
+
def close_browser(browser, where = @myName, lnbr = __LINE__)
|
506
508
|
#TODO Firewatir 1.6.5 does not implement .exists for FireWatir::Firefox class
|
507
509
|
debug_to_log("Logging out in #{where} at line #{lnbr}.", lnbr, true)
|
508
510
|
debug_to_log("#{__method__}: browser: #{browser.inspect} (#{__LINE__})")
|
509
511
|
|
512
|
+
url = browser.url
|
513
|
+
title = browser.title
|
514
|
+
|
510
515
|
if ['FF', 'S'].include?(@browserAbbrev) || browser.exists?
|
511
516
|
case @browserAbbrev
|
512
517
|
when 'FF'
|
513
518
|
if is_browser?(browser)
|
514
|
-
url = browser.url
|
515
|
-
title = browser.title
|
516
519
|
debug_to_log("#{__method__}: Firefox browser url: [#{url}]")
|
517
520
|
debug_to_log("#{__method__}: Firefox browser title: [#{title}]")
|
518
521
|
debug_to_log("#{__method__}: Closing browser: #{where} (#{lnbr})")
|
@@ -525,16 +528,23 @@ module Awetestlib
|
|
525
528
|
|
526
529
|
end
|
527
530
|
when 'IE'
|
528
|
-
|
529
|
-
|
530
|
-
debug_to_log("#{__method__}: Closing browser:
|
531
|
-
|
532
|
-
|
533
|
-
|
531
|
+
debug_to_log("#{__method__}: Internet Explorer browser url: [#{url}]")
|
532
|
+
debug_to_log("#{__method__}: Internet Explorer browser title: [#{title}]")
|
533
|
+
debug_to_log("#{__method__}: Closing browser: #{where} (#{lnbr})")
|
534
|
+
if $watir_script
|
535
|
+
hwnd = browser.hwnd
|
536
|
+
pid = Watir::IE::Process.process_id_from_hwnd(hwnd)
|
537
|
+
debug_to_log("#{__method__}: Closing browser: hwnd #{hwnd} pid #{pid} #{where} (#{lnbr}) (#{__LINE__})")
|
538
|
+
browser.close
|
539
|
+
if browser.exists? and pid > 0 and pid < 538976288 # value of uninitialized memory location
|
540
|
+
debug_to_log("Retry close browser: hwnd #{hwnd} pid #{pid} #{where} #{lnbr} (#{__LINE__})")
|
541
|
+
browser.close
|
542
|
+
end
|
543
|
+
if browser.exists? and pid > 0 and pid < 538976288 # value of uninitialized memory location
|
544
|
+
kill_browser(browser.hwnd, __LINE__, browser)
|
545
|
+
end
|
546
|
+
else
|
534
547
|
browser.close
|
535
|
-
end
|
536
|
-
if browser.exists? and pid > 0 and pid < 538976288 # value of uninitialized memory location
|
537
|
-
kill_browser(browser.hwnd, __LINE__, browser)
|
538
548
|
end
|
539
549
|
when 'S'
|
540
550
|
if is_browser?(browser)
|
@@ -555,9 +565,6 @@ module Awetestlib
|
|
555
565
|
debug_to_log("Closing browser: #{where} (#{lnbr})")
|
556
566
|
if url and url.length > 1
|
557
567
|
browser.close
|
558
|
-
#else
|
559
|
-
#browser = FireWatir::Firefox.attach(:title, title)
|
560
|
-
#browser.close
|
561
568
|
end
|
562
569
|
|
563
570
|
end
|
@@ -565,12 +572,12 @@ module Awetestlib
|
|
565
572
|
raise "Unsupported browser: '#{@browserAbbrev}'"
|
566
573
|
end
|
567
574
|
end
|
568
|
-
|
569
|
-
|
570
|
-
# raise e
|
571
|
-
# end
|
575
|
+
rescue
|
576
|
+
failed_to_log(unable_to)
|
572
577
|
end
|
573
578
|
|
579
|
+
alias logout close_browser
|
580
|
+
|
574
581
|
# Close a browser popup window. Does not apply to modal popups.
|
575
582
|
# @param [Watir::Browser] popup Reference to the popup to be closed
|
576
583
|
def close_new_window_popup(popup)
|