Sha256: f019ef070d4551d645ccdb3926e94436c0ef0a0f5d5a792361248efccaf0829e

Contents?: true

Size: 1.6 KB

Versions: 2

Compression:

Stored size: 1.6 KB

Contents

require "nokogiri"

module WebDriverManager
  class IEDriver
    extend Support

    class << self
      def current_binary
        WebDriverManager.logger.debug("Checking Current Driver Version")
        return nil unless driver_is_downloaded?
        binary_version = `#{driver_binary} --version`
        WebDriverManager.logger.debug(
          "Current version of #{driver_binary} is #{binary_version}"
        )
        normalize(
          binary_version.match(/IEDriverServer.exe (\d\.\d+\.\d*\.\d*)/)[1]
        )
      end

      def normalize(string)
        string.to_f
      end

      def driver_name
        "IEDriverServer.exe"
      end

      def driver_base_url
        "http://selenium-release.storage.googleapis.com"
      end

      def driver_binary_list
        unless driver_url_is_reachable?
          raise StandardError, "Unable to Access the Driver URL"
        end

        @binaries ||= begin
          files = process_binary_files
          process_binary_versions(files)
        end
      end

      def process_binary_files
        resource = Nokogiri::XML.parse(get(driver_base_url))
        files = resource.css("Key").collect(&:text)
        files.select! { |file| file.include?("IEDriverServer_Win32") }
      end

      def process_binary_versions(files)
        binary_list = files.each_with_object({}) do |file, binary|
          version = normalize(file[%r{^[^\/]+}])
          binary[version] = "#{driver_base_url}/#{file}"
        end

        WebDriverManager.logger.debug(
          "Versions Located at Driver URL: #{binary_list.keys}"
        )

        binary_list
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
webdriver_manager-0.6.0 lib/webdriver_manager/drivers/driver_ie.rb
webdriver_manager-0.5.0 lib/webdriver_manager/drivers/driver_ie.rb