selenium-framework 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/copyfiles/Gemfile +10 -10
- data/bin/copyfiles/include.rb +12 -12
- data/bin/copyfiles/project_file.rb +24 -24
- data/bin/framework +297 -297
- data/lib/modules/login/login.rb +13 -13
- data/lib/selenium-framework.rb +10 -10
- data/lib/userextension/user_extension.rb +239 -239
- metadata +42 -21
data/lib/modules/login/login.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
class Login
|
2
|
-
|
3
|
-
def self.login(user_loc_type, user_locator, username, pass_loc_type, pass_locator, password, submit_loc_type, submit_locator)
|
4
|
-
$driver.find_element(user_loc_type.to_sym, user_locator).send_keys username
|
5
|
-
$driver.find_element(pass_loc_type.to_sym, pass_locator).send_keys password
|
6
|
-
$driver.find_element(submit_loc_type.to_sym, submit_locator).click
|
7
|
-
end
|
8
|
-
|
9
|
-
def self.forgot_password(user_loc_type, user_locator, username, submit_loc_type, submit_locator)
|
10
|
-
$driver.find_element(user_loc_type.to_sym, user_locator).send_keys username
|
11
|
-
$driver.find_element(submit_loc_type.to_sym, submit_locator).click
|
12
|
-
end
|
13
|
-
|
1
|
+
class Login
|
2
|
+
|
3
|
+
def self.login(user_loc_type, user_locator, username, pass_loc_type, pass_locator, password, submit_loc_type, submit_locator)
|
4
|
+
$driver.find_element(user_loc_type.to_sym, user_locator).send_keys username
|
5
|
+
$driver.find_element(pass_loc_type.to_sym, pass_locator).send_keys password
|
6
|
+
$driver.find_element(submit_loc_type.to_sym, submit_locator).click
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.forgot_password(user_loc_type, user_locator, username, submit_loc_type, submit_locator)
|
10
|
+
$driver.find_element(user_loc_type.to_sym, user_locator).send_keys username
|
11
|
+
$driver.find_element(submit_loc_type.to_sym, submit_locator).click
|
12
|
+
end
|
13
|
+
|
14
14
|
end
|
data/lib/selenium-framework.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
require 'selenium-framework'
|
2
|
-
require 'userextension/user_extension.rb'
|
3
|
-
require 'modules/login/login.rb'
|
4
|
-
require 'time'
|
5
|
-
require 'fileutils'
|
6
|
-
require 'csv'
|
7
|
-
require 'faker'
|
8
|
-
require 'headless'
|
9
|
-
|
10
|
-
|
1
|
+
require 'selenium-framework'
|
2
|
+
require 'userextension/user_extension.rb'
|
3
|
+
require 'modules/login/login.rb'
|
4
|
+
require 'time'
|
5
|
+
require 'fileutils'
|
6
|
+
require 'csv'
|
7
|
+
require 'faker'
|
8
|
+
require 'headless'
|
9
|
+
|
10
|
+
|
@@ -1,239 +1,239 @@
|
|
1
|
-
class UserExtension
|
2
|
-
|
3
|
-
# Call this function this way "generate_mail_id(length, domain)".
|
4
|
-
# This function will generate a random Yopmail id and return it.
|
5
|
-
def self.generate_mail_id(length, domain)
|
6
|
-
yopmailid = (1..length).map { ('a'..'z').to_a[rand(26)] }.join+"@"+domain.to_s
|
7
|
-
return yopmailid
|
8
|
-
end
|
9
|
-
|
10
|
-
# Call this function this way "generate_string(length)".
|
11
|
-
# This function will generate a random string and return it.
|
12
|
-
def self.generate_string(length)
|
13
|
-
str = (1..length).map { ('a'..'z').to_a[rand(26)] }.join
|
14
|
-
return str
|
15
|
-
end
|
16
|
-
|
17
|
-
# Call this function this way "generate_title".
|
18
|
-
# This function will generate a title and return it.
|
19
|
-
def self.generate_title
|
20
|
-
title = Faker::Name.prefix
|
21
|
-
return title
|
22
|
-
end
|
23
|
-
|
24
|
-
# Call this function this way "generate_name(length)".
|
25
|
-
# This function will generate a random name and return it.
|
26
|
-
def self.generate_name(length)
|
27
|
-
str = (1..length-1).map { ('a'..'z').to_a[rand(26)] }.join
|
28
|
-
str = ('A'..'Z').to_a[rand(26)] + str
|
29
|
-
#str = Faker::Name.first_name
|
30
|
-
#while str.length != length
|
31
|
-
# str = Faker::Name.first_name
|
32
|
-
#end
|
33
|
-
str.capitalize
|
34
|
-
return str
|
35
|
-
end
|
36
|
-
|
37
|
-
# Call this function this way "generate_number(minrange, maxrange)".
|
38
|
-
# This function will generate a random number and return it.
|
39
|
-
def self.generate_number(minrange, maxrange)
|
40
|
-
number = rand(minrange..maxrange)
|
41
|
-
return number
|
42
|
-
end
|
43
|
-
|
44
|
-
# Call this function this way "generate_future_date(days)".
|
45
|
-
# This function will generate a future date and return it.
|
46
|
-
def self.generate_future_date(days)
|
47
|
-
date = Date.strptime(Date.today.to_s)
|
48
|
-
date = date + days
|
49
|
-
return date.strftime("%d-%m-%Y")
|
50
|
-
end
|
51
|
-
|
52
|
-
# Call this function this way "generate_past_date(days)".
|
53
|
-
# This function will generate a past date and return it.
|
54
|
-
def self.generate_past_date(days)
|
55
|
-
date = Date.strptime(Date.today.to_s)
|
56
|
-
date = date - days
|
57
|
-
return date.strftime("%d-%m-%Y")
|
58
|
-
end
|
59
|
-
|
60
|
-
# Call this function this way "generate_alphanumeric_string(length)".
|
61
|
-
# This function will generate a random alpha-numeric string and return it.
|
62
|
-
def self.generate_alphanumeric_string(length)
|
63
|
-
str = (1..length).map { rand(36).to_s(36) }.join
|
64
|
-
return str
|
65
|
-
end
|
66
|
-
|
67
|
-
# Call this function this way "generate_street_address".
|
68
|
-
# This function will generate a random street address and return it.
|
69
|
-
def self.generate_street_address
|
70
|
-
street_address = Faker::Address.street_address
|
71
|
-
return street_address
|
72
|
-
end
|
73
|
-
|
74
|
-
# Call this function this way "generate_address".
|
75
|
-
# This function will generate a random address and return it.
|
76
|
-
def self.generate_address
|
77
|
-
address = Faker::Address.secondary_address
|
78
|
-
return address
|
79
|
-
end
|
80
|
-
|
81
|
-
# Call this function this way "generate_phone_number".
|
82
|
-
# This function will generate a random phone number and return it.
|
83
|
-
def self.generate_phone_number
|
84
|
-
phone_number = rand(1000000000..9999999999)
|
85
|
-
return phone_number
|
86
|
-
end
|
87
|
-
|
88
|
-
# Call this function this way "generate_paragraph".
|
89
|
-
# This function will generate a paragraph and return it.
|
90
|
-
def self.generate_paragraph
|
91
|
-
paragraph = Faker::Lorem.paragraphs.map { |i| i.to_s }.join(" ")
|
92
|
-
return paragraph
|
93
|
-
end
|
94
|
-
|
95
|
-
# Call this function this way "generate_words(number)".
|
96
|
-
# This function will generate words and return it.
|
97
|
-
def self.generate_words(number)
|
98
|
-
words = Faker::Lorem.words(number).map { |i| i.to_s }.join(" ")
|
99
|
-
return words
|
100
|
-
end
|
101
|
-
|
102
|
-
# Call this function this way "generate_sentence".
|
103
|
-
# This function will generate a sentence and return it.
|
104
|
-
def self.generate_sentence
|
105
|
-
sentence = Faker::Lorem.sentence
|
106
|
-
return sentence
|
107
|
-
end
|
108
|
-
|
109
|
-
# Call this function this way "write_result_to_csv(report_file, test_id, test_case, result, comment="")".
|
110
|
-
# This function will write the result to .csv file.
|
111
|
-
def self.write_result_to_csv(report_file, test_id, test_case, result, comment="")
|
112
|
-
CSV.open(report_file, "ab") do |csv_file|
|
113
|
-
csv_file << [test_id, test_case, result, comment]
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
# Call this function this way "write_logs_to_text_file(log_file, logs)".
|
118
|
-
# This function will write the logs to .log file.
|
119
|
-
def self.write_logs_to_text_file(log_file, logs)
|
120
|
-
File.open(log_file, "a") do |txt_file|
|
121
|
-
txt_file.puts logs
|
122
|
-
txt_file.puts "\n"
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
|
-
# Call this function this way "element_present?(how, what)".
|
127
|
-
# This function will check if the element is present or not.
|
128
|
-
def self.element_present?(how, what)
|
129
|
-
begin
|
130
|
-
$driver.find_element(how, what)
|
131
|
-
return true
|
132
|
-
rescue
|
133
|
-
return false
|
134
|
-
end
|
135
|
-
end
|
136
|
-
|
137
|
-
# Call this function this way "pre_requisite(build_no,browser,timestamp)".
|
138
|
-
# This function will create the pre-requisites for the project.
|
139
|
-
def self.pre_requisite(build_no, browser, timestamp)
|
140
|
-
returning_array = Array.new
|
141
|
-
build_no = build_no.to_s
|
142
|
-
browser = browser.to_s
|
143
|
-
timestamp = timestamp.to_s
|
144
|
-
store_path = Dir.pwd
|
145
|
-
Dir.chdir("screenshots")
|
146
|
-
Dir.mkdir(build_no)
|
147
|
-
Dir.chdir(build_no)
|
148
|
-
Dir.mkdir(browser +"_"+ timestamp)
|
149
|
-
Dir.chdir(browser +"_"+ timestamp)
|
150
|
-
screenshot_path = store_path + "/screenshots/" + build_no + "/" + browser +"_"+ timestamp + "/"
|
151
|
-
returning_array.push(screenshot_path)
|
152
|
-
Dir.chdir(store_path)
|
153
|
-
|
154
|
-
Dir.chdir("reports")
|
155
|
-
Dir.mkdir(build_no)
|
156
|
-
report_path = store_path + "/reports/" + build_no + "/"
|
157
|
-
Dir.chdir(report_path)
|
158
|
-
report_file = report_path + build_no +"_" + browser +"_"+ timestamp + ".csv"
|
159
|
-
FileUtils.touch(report_file)
|
160
|
-
CSV.open(report_file, "wb") do |csv_file|
|
161
|
-
csv_file << ["TEST_ID", "TEST_CASE", "RESULT", "COMMENTS"]
|
162
|
-
end
|
163
|
-
returning_array.push(report_file)
|
164
|
-
broken_links_report_file = report_path + build_no +"_broken_links_" + timestamp + ".csv"
|
165
|
-
FileUtils.touch(broken_links_report_file)
|
166
|
-
CSV.open(broken_links_report_file, "wb") do |csv_file|
|
167
|
-
csv_file << ["LINK", "RESPONSE", "COMMENTS"]
|
168
|
-
end
|
169
|
-
returning_array.push(broken_links_report_file)
|
170
|
-
Dir.chdir(store_path)
|
171
|
-
|
172
|
-
Dir.chdir("logs")
|
173
|
-
Dir.mkdir(build_no)
|
174
|
-
log_path = store_path + "/logs/" + build_no + "/"
|
175
|
-
Dir.chdir(log_path)
|
176
|
-
log_file = log_path + build_no +"_" + browser + "_" + timestamp + ".log"
|
177
|
-
FileUtils.touch(log_file)
|
178
|
-
File.open(log_file, "wb") do |txt_file|
|
179
|
-
txt_file.puts "LOGS WITH RESULTS"
|
180
|
-
end
|
181
|
-
returning_array.push(log_file)
|
182
|
-
Dir.chdir(store_path)
|
183
|
-
|
184
|
-
return returning_array
|
185
|
-
end
|
186
|
-
|
187
|
-
|
188
|
-
def self.init_record()
|
189
|
-
os = RUBY_PLATFORM
|
190
|
-
if os.include? "linux"
|
191
|
-
headless_obj = Headless.new
|
192
|
-
headless_obj.start
|
193
|
-
return headless_obj
|
194
|
-
else
|
195
|
-
puts "#{RUBY_PLATFORM} is not a linux platform !!!"
|
196
|
-
end
|
197
|
-
end
|
198
|
-
|
199
|
-
|
200
|
-
def self.record_video_start_capture(headless_obj)
|
201
|
-
os = RUBY_PLATFORM
|
202
|
-
if os.include? "linux"
|
203
|
-
headless_obj.video.start_capture
|
204
|
-
else
|
205
|
-
puts "#{RUBY_PLATFORM} is not a linux platform !!!"
|
206
|
-
end
|
207
|
-
end
|
208
|
-
|
209
|
-
|
210
|
-
def self.record_video_stop_and_save(headless_obj,filename)
|
211
|
-
os = RUBY_PLATFORM
|
212
|
-
if os.include? "linux"
|
213
|
-
headless_obj.video.stop_and_save(filename)
|
214
|
-
else
|
215
|
-
puts "#{RUBY_PLATFORM} is not a linux platform !!!"
|
216
|
-
end
|
217
|
-
end
|
218
|
-
|
219
|
-
|
220
|
-
def self.record_video_stop_and_discard(headless_obj)
|
221
|
-
os = RUBY_PLATFORM
|
222
|
-
if os.include? "linux"
|
223
|
-
headless_obj.video.stop_and_discard()
|
224
|
-
else
|
225
|
-
puts "#{RUBY_PLATFORM} is not a linux platform !!!"
|
226
|
-
end
|
227
|
-
end
|
228
|
-
|
229
|
-
|
230
|
-
def self.capture_screenshot(selenium_diver,filename)
|
231
|
-
browser_name = selenium_diver.capabilities.browser_name
|
232
|
-
unless (browser_name.include? "safari")
|
233
|
-
selenium_diver.save_screenshot filename
|
234
|
-
else
|
235
|
-
puts "#{browser_name} does not support for capturing screenshot !!!"
|
236
|
-
end
|
237
|
-
end
|
238
|
-
|
239
|
-
end
|
1
|
+
class UserExtension
|
2
|
+
|
3
|
+
# Call this function this way "generate_mail_id(length, domain)".
|
4
|
+
# This function will generate a random Yopmail id and return it.
|
5
|
+
def self.generate_mail_id(length, domain)
|
6
|
+
yopmailid = (1..length).map { ('a'..'z').to_a[rand(26)] }.join+"@"+domain.to_s
|
7
|
+
return yopmailid
|
8
|
+
end
|
9
|
+
|
10
|
+
# Call this function this way "generate_string(length)".
|
11
|
+
# This function will generate a random string and return it.
|
12
|
+
def self.generate_string(length)
|
13
|
+
str = (1..length).map { ('a'..'z').to_a[rand(26)] }.join
|
14
|
+
return str
|
15
|
+
end
|
16
|
+
|
17
|
+
# Call this function this way "generate_title".
|
18
|
+
# This function will generate a title and return it.
|
19
|
+
def self.generate_title
|
20
|
+
title = Faker::Name.prefix
|
21
|
+
return title
|
22
|
+
end
|
23
|
+
|
24
|
+
# Call this function this way "generate_name(length)".
|
25
|
+
# This function will generate a random name and return it.
|
26
|
+
def self.generate_name(length)
|
27
|
+
str = (1..length-1).map { ('a'..'z').to_a[rand(26)] }.join
|
28
|
+
str = ('A'..'Z').to_a[rand(26)] + str
|
29
|
+
#str = Faker::Name.first_name
|
30
|
+
#while str.length != length
|
31
|
+
# str = Faker::Name.first_name
|
32
|
+
#end
|
33
|
+
str.capitalize
|
34
|
+
return str
|
35
|
+
end
|
36
|
+
|
37
|
+
# Call this function this way "generate_number(minrange, maxrange)".
|
38
|
+
# This function will generate a random number and return it.
|
39
|
+
def self.generate_number(minrange, maxrange)
|
40
|
+
number = rand(minrange..maxrange)
|
41
|
+
return number
|
42
|
+
end
|
43
|
+
|
44
|
+
# Call this function this way "generate_future_date(days)".
|
45
|
+
# This function will generate a future date and return it.
|
46
|
+
def self.generate_future_date(days)
|
47
|
+
date = Date.strptime(Date.today.to_s)
|
48
|
+
date = date + days
|
49
|
+
return date.strftime("%d-%m-%Y")
|
50
|
+
end
|
51
|
+
|
52
|
+
# Call this function this way "generate_past_date(days)".
|
53
|
+
# This function will generate a past date and return it.
|
54
|
+
def self.generate_past_date(days)
|
55
|
+
date = Date.strptime(Date.today.to_s)
|
56
|
+
date = date - days
|
57
|
+
return date.strftime("%d-%m-%Y")
|
58
|
+
end
|
59
|
+
|
60
|
+
# Call this function this way "generate_alphanumeric_string(length)".
|
61
|
+
# This function will generate a random alpha-numeric string and return it.
|
62
|
+
def self.generate_alphanumeric_string(length)
|
63
|
+
str = (1..length).map { rand(36).to_s(36) }.join
|
64
|
+
return str
|
65
|
+
end
|
66
|
+
|
67
|
+
# Call this function this way "generate_street_address".
|
68
|
+
# This function will generate a random street address and return it.
|
69
|
+
def self.generate_street_address
|
70
|
+
street_address = Faker::Address.street_address
|
71
|
+
return street_address
|
72
|
+
end
|
73
|
+
|
74
|
+
# Call this function this way "generate_address".
|
75
|
+
# This function will generate a random address and return it.
|
76
|
+
def self.generate_address
|
77
|
+
address = Faker::Address.secondary_address
|
78
|
+
return address
|
79
|
+
end
|
80
|
+
|
81
|
+
# Call this function this way "generate_phone_number".
|
82
|
+
# This function will generate a random phone number and return it.
|
83
|
+
def self.generate_phone_number
|
84
|
+
phone_number = rand(1000000000..9999999999)
|
85
|
+
return phone_number
|
86
|
+
end
|
87
|
+
|
88
|
+
# Call this function this way "generate_paragraph".
|
89
|
+
# This function will generate a paragraph and return it.
|
90
|
+
def self.generate_paragraph
|
91
|
+
paragraph = Faker::Lorem.paragraphs.map { |i| i.to_s }.join(" ")
|
92
|
+
return paragraph
|
93
|
+
end
|
94
|
+
|
95
|
+
# Call this function this way "generate_words(number)".
|
96
|
+
# This function will generate words and return it.
|
97
|
+
def self.generate_words(number)
|
98
|
+
words = Faker::Lorem.words(number).map { |i| i.to_s }.join(" ")
|
99
|
+
return words
|
100
|
+
end
|
101
|
+
|
102
|
+
# Call this function this way "generate_sentence".
|
103
|
+
# This function will generate a sentence and return it.
|
104
|
+
def self.generate_sentence
|
105
|
+
sentence = Faker::Lorem.sentence
|
106
|
+
return sentence
|
107
|
+
end
|
108
|
+
|
109
|
+
# Call this function this way "write_result_to_csv(report_file, test_id, test_case, result, comment="")".
|
110
|
+
# This function will write the result to .csv file.
|
111
|
+
def self.write_result_to_csv(report_file, test_id, test_case, result, comment="")
|
112
|
+
CSV.open(report_file, "ab") do |csv_file|
|
113
|
+
csv_file << [test_id, test_case, result, comment]
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
# Call this function this way "write_logs_to_text_file(log_file, logs)".
|
118
|
+
# This function will write the logs to .log file.
|
119
|
+
def self.write_logs_to_text_file(log_file, logs)
|
120
|
+
File.open(log_file, "a") do |txt_file|
|
121
|
+
txt_file.puts logs
|
122
|
+
txt_file.puts "\n"
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
# Call this function this way "element_present?(how, what)".
|
127
|
+
# This function will check if the element is present or not.
|
128
|
+
def self.element_present?(how, what)
|
129
|
+
begin
|
130
|
+
$driver.find_element(how, what)
|
131
|
+
return true
|
132
|
+
rescue
|
133
|
+
return false
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
# Call this function this way "pre_requisite(build_no,browser,timestamp)".
|
138
|
+
# This function will create the pre-requisites for the project.
|
139
|
+
def self.pre_requisite(build_no, browser, timestamp)
|
140
|
+
returning_array = Array.new
|
141
|
+
build_no = build_no.to_s
|
142
|
+
browser = browser.to_s
|
143
|
+
timestamp = timestamp.to_s
|
144
|
+
store_path = Dir.pwd
|
145
|
+
Dir.chdir("screenshots")
|
146
|
+
Dir.mkdir(build_no)
|
147
|
+
Dir.chdir(build_no)
|
148
|
+
Dir.mkdir(browser +"_"+ timestamp)
|
149
|
+
Dir.chdir(browser +"_"+ timestamp)
|
150
|
+
screenshot_path = store_path + "/screenshots/" + build_no + "/" + browser +"_"+ timestamp + "/"
|
151
|
+
returning_array.push(screenshot_path)
|
152
|
+
Dir.chdir(store_path)
|
153
|
+
|
154
|
+
Dir.chdir("reports")
|
155
|
+
Dir.mkdir(build_no)
|
156
|
+
report_path = store_path + "/reports/" + build_no + "/"
|
157
|
+
Dir.chdir(report_path)
|
158
|
+
report_file = report_path + build_no +"_" + browser +"_"+ timestamp + ".csv"
|
159
|
+
FileUtils.touch(report_file)
|
160
|
+
CSV.open(report_file, "wb") do |csv_file|
|
161
|
+
csv_file << ["TEST_ID", "TEST_CASE", "RESULT", "COMMENTS"]
|
162
|
+
end
|
163
|
+
returning_array.push(report_file)
|
164
|
+
broken_links_report_file = report_path + build_no +"_broken_links_" + timestamp + ".csv"
|
165
|
+
FileUtils.touch(broken_links_report_file)
|
166
|
+
CSV.open(broken_links_report_file, "wb") do |csv_file|
|
167
|
+
csv_file << ["LINK", "RESPONSE", "COMMENTS"]
|
168
|
+
end
|
169
|
+
returning_array.push(broken_links_report_file)
|
170
|
+
Dir.chdir(store_path)
|
171
|
+
|
172
|
+
Dir.chdir("logs")
|
173
|
+
Dir.mkdir(build_no)
|
174
|
+
log_path = store_path + "/logs/" + build_no + "/"
|
175
|
+
Dir.chdir(log_path)
|
176
|
+
log_file = log_path + build_no +"_" + browser + "_" + timestamp + ".log"
|
177
|
+
FileUtils.touch(log_file)
|
178
|
+
File.open(log_file, "wb") do |txt_file|
|
179
|
+
txt_file.puts "LOGS WITH RESULTS"
|
180
|
+
end
|
181
|
+
returning_array.push(log_file)
|
182
|
+
Dir.chdir(store_path)
|
183
|
+
|
184
|
+
return returning_array
|
185
|
+
end
|
186
|
+
|
187
|
+
|
188
|
+
def self.init_record()
|
189
|
+
os = RUBY_PLATFORM
|
190
|
+
if os.include? "linux"
|
191
|
+
headless_obj = Headless.new
|
192
|
+
headless_obj.start
|
193
|
+
return headless_obj
|
194
|
+
else
|
195
|
+
puts "#{RUBY_PLATFORM} is not a linux platform !!!"
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
|
200
|
+
def self.record_video_start_capture(headless_obj)
|
201
|
+
os = RUBY_PLATFORM
|
202
|
+
if os.include? "linux"
|
203
|
+
headless_obj.video.start_capture
|
204
|
+
else
|
205
|
+
puts "#{RUBY_PLATFORM} is not a linux platform !!!"
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
209
|
+
|
210
|
+
def self.record_video_stop_and_save(headless_obj,filename)
|
211
|
+
os = RUBY_PLATFORM
|
212
|
+
if os.include? "linux"
|
213
|
+
headless_obj.video.stop_and_save(filename)
|
214
|
+
else
|
215
|
+
puts "#{RUBY_PLATFORM} is not a linux platform !!!"
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
|
220
|
+
def self.record_video_stop_and_discard(headless_obj)
|
221
|
+
os = RUBY_PLATFORM
|
222
|
+
if os.include? "linux"
|
223
|
+
headless_obj.video.stop_and_discard()
|
224
|
+
else
|
225
|
+
puts "#{RUBY_PLATFORM} is not a linux platform !!!"
|
226
|
+
end
|
227
|
+
end
|
228
|
+
|
229
|
+
|
230
|
+
def self.capture_screenshot(selenium_diver,filename)
|
231
|
+
browser_name = selenium_diver.capabilities.browser_name
|
232
|
+
unless (browser_name.include? "safari")
|
233
|
+
selenium_diver.save_screenshot filename
|
234
|
+
else
|
235
|
+
puts "#{browser_name} does not support for capturing screenshot !!!"
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
239
|
+
end
|