lib/smart_driver.rb in smart_driver-1.1.0 vs lib/smart_driver.rb in smart_driver-1.1.1

- old
+ new

@@ -5,14 +5,12 @@ class SmartDriver attr_accessor :__driver__ attr_reader :log_dir_path include SmartDriver::CommonInterface - def initialize(url=nil, log_dir_path="./log", browser=:chrome) + def initialize(url=nil, browser=:chrome) @__driver__ = Selenium::WebDriver.for(browser) - FileUtils.mkdir_p log_dir_path - @log_dir_path = log_dir_path go(url) if url end def go(url) logging :info, "visiting #{url}..." @@ -30,15 +28,15 @@ def exec_js(js_code) @__driver__.execute_script js_code end - def save_html(file_name="log.html") - File.open("#{@log_dir_path}/#{file_name}", 'w') { |f| f.write(@__driver__.page_source) } + def save_html(file_path) + File.open(file_path, 'w') { |f| f.write(@__driver__.page_source) } end - def save_png(file_name="log.png") - @__driver__.save_screenshot "#{@log_dir_path}/#{file_name}" + def save_png(file_path) + @__driver__.save_screenshot file_path end def method_missing(method, *args, &block) @__driver__.respond_to?(method) ? @__driver__.send(method, *args, &block) : super end