Avoid "Selenium::WebDriver::Error::UnknownError" sometime on accessing log.

This commit is contained in:
Martin Edenhofer 2016-06-14 15:58:16 +02:00
parent 5218119ce5
commit 51bab574d1

View file

@ -3127,13 +3127,17 @@ wait untill text in selector disabppears
end
def log(method, params = {})
instance = params[:browser] || @browser
if instance
logs = instance.manage.logs.get(:browser)
logs.each {|log|
time = Time.zone.parse(Time.zone.at(log.timestamp / 1000).to_datetime.to_s)
puts "#{time}/#{log.level}: #{log.message}"
}
begin
instance = params[:browser] || @browser
if instance
logs = instance.manage.logs.get(:browser)
logs.each {|log|
time = Time.zone.parse(Time.zone.at(log.timestamp / 1000).to_datetime.to_s)
puts "#{time}/#{log.level}: #{log.message}"
}
end
rescue
# faild to get logs
end
return if !@@debug
return if params[:mute_log]