Class: Selenium::WebDriver::Logs
- Inherits:
-
Object
- Object
- Selenium::WebDriver::Logs
- Defined in:
- lib/automation_helpers/extensions/selenium/webdriver/logs.rb
Overview
Additional useful methods to extend the Selenium::WebDriver::Logs class with
Instance Method Summary collapse
-
#get(type) ⇒ Hash
Identical to the regular log fetch from Selenium, but stores the logs inside a Hash to be writable later.
-
#write_log_to_file(type, file = default_file_path) ⇒ Integer
Write the logs to a filepath (If provided), or default file path (Configured).
Instance Method Details
#get(type) ⇒ Hash
Identical to the regular log fetch from Selenium, but stores the logs inside a Hash to be writable later
12 13 14 |
# File 'lib/automation_helpers/extensions/selenium/webdriver/logs.rb', line 12 def get(type) cached_logs[type] = @bridge.log(type) end |
#write_log_to_file(type, file = default_file_path) ⇒ Integer
Write the logs to a filepath (If provided), or default file path (Configured). Returns the filesize as per the regular Ruby Filesystem method
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/automation_helpers/extensions/selenium/webdriver/logs.rb', line 20 def write_log_to_file(type, file = default_file_path) get(type) unless cached_logs.key?(type) cached_logs[type].each do |log_entry| if file == $stdout file << log_entry else File.write(file, log_entry) end end end |