Sha256: b81a3957a123454a2463c6bc0ee32f57b45a6890d301f4843a4d980b7ace05de

Contents?: true

Size: 1.13 KB

Versions: 2

Compression:

Stored size: 1.13 KB

Contents

module SeleniumConnect
  class Runner
    class Firefox
      attr_reader :config

      def initialize(config)
        @config = config
      end

      def match?
        config.browser == "firefox"
      end

      def launch
        init_browser
      end

      private

      def get_profile
        if config.profile_path
          Selenium::WebDriver::Firefox::Profile.new config.profile_path
        elsif config.profile_name
          Selenium::WebDriver::Firefox::Profile.from_name config.profile_name
        else
          Selenium::WebDriver::Firefox::Profile.new
        end
      end

      def config_browser
        profile = get_profile
        profile.assume_untrusted_certificate_issuer = false unless profile.nil?
        profile.log_file = File.join(Dir.getwd, config.log, 'firefox.log') if config.log
        browser = Selenium::WebDriver::Remote::Capabilities.firefox
        browser[:firefox_binary] = config.browser_path if config.browser_path
        browser[:firefox_profile] = profile
        return browser
      end

      def init_browser
        config_browser
      end

    end #Firefox
  end #Runner
end #SeleniumConnect

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
selenium-connect-2.0.0 lib/selenium-connect/runners/firefox.rb
selenium-connect-1.9.3 lib/selenium-connect/runners/firefox.rb