def setup_webclient(opts)
      browser = (opts.delete(:browser) || :firefox3).to_sym

      browser_version = case browser
                        when :firefox, :ff, :firefox3, :ff3 # default :firefox
                          ::HtmlUnit::BrowserVersion::FIREFOX_3
                        when :firefox_3_6, :ff36
                          ::HtmlUnit::BrowserVersion::FIREFOX_3_6
                        when :internet_explorer_6, :ie6
                          ::HtmlUnit::BrowserVersion::INTERNET_EXPLORER_6
                        when :internet_explorer, :ie, :internet_explorer7, :internet_explorer_7, :ie7  # default :ie
                          ::HtmlUnit::BrowserVersion::INTERNET_EXPLORER_7
                        when :internet_explorer_8, :ie8
                          ::HtmlUnit::BrowserVersion::INTERNET_EXPLORER_8
                        else
                          raise ArgumentError, "unknown browser: #{browser.inspect}"
                        end

      if ua = opts.delete(:user_agent)
        browser_version.setUserAgent(ua)
      end

      @webclient = if proxy = opts.delete(:proxy)
                     phost, pport = proxy.split(":")
                     ::HtmlUnit::WebClient.new(browser_version, phost, pport.to_i)
                   else
                     ::HtmlUnit::WebClient.new(browser_version)
                   end

      self.javascript_exceptions  = false unless opts.delete(:javascript_exceptions)
      self.status_code_exceptions = false unless opts.delete(:status_code_exceptions)
      self.css                    = !!opts.delete(:css) if opts.has_key?(:css)
      self.javascript_enabled     = opts.delete(:javascript_enabled) != false
      self.secure_ssl             = opts.delete(:secure_ssl) != false
      self.ignore_pattern         = opts.delete(:ignore_pattern) if opts[:ignore_pattern]
      self.refresh_handler        = opts.delete(:refresh_handler) if opts[:refresh_handler]
      self.cache_limit            = opts.delete(:cache_limit) if opts[:cache_limit]

      @default_wait               = Integer(opts.delete(:default_wait) || 10)

      if opts.delete(:resynchronize)
        controller = ::HtmlUnit::NicelyResynchronizingAjaxController.new
        @webclient.setAjaxController controller
      end

      enable_event_listener
    end
def setup_webclient(opts)
      browser = (opts.delete(:browser) || :firefox3).to_sym

      browser_version = case browser
                        when :firefox, :ff, :firefox3, :ff3 # default :firefox
                          ::HtmlUnit::BrowserVersion::FIREFOX_3
                        when :firefox_3_6, :ff36
                          ::HtmlUnit::BrowserVersion::FIREFOX_3_6
                        when :internet_explorer_6, :ie6
                          ::HtmlUnit::BrowserVersion::INTERNET_EXPLORER_6
                        when :internet_explorer, :ie, :internet_explorer7, :internet_explorer_7, :ie7  # default :ie
                          ::HtmlUnit::BrowserVersion::INTERNET_EXPLORER_7
                        when :internet_explorer_8, :ie8
                          ::HtmlUnit::BrowserVersion::INTERNET_EXPLORER_8
                        else
                          raise ArgumentError, "unknown browser: #{browser.inspect}"
                        end

      if ua = opts.delete(:user_agent)
        browser_version.setUserAgent(ua)
      end

      @webclient = if proxy = opts.delete(:proxy)
                     phost, pport = proxy.split(":")
                     ::HtmlUnit::WebClient.new(browser_version, phost, pport.to_i)
                   else
                     ::HtmlUnit::WebClient.new(browser_version)
                   end

      self.javascript_exceptions  = false unless opts.delete(:javascript_exceptions)
      self.status_code_exceptions = false unless opts.delete(:status_code_exceptions)
      self.css                    = !!opts.delete(:css) if opts.has_key?(:css)
      self.javascript_enabled     = opts.delete(:javascript_enabled) != false
      self.secure_ssl             = opts.delete(:secure_ssl) != false
      self.ignore_pattern         = opts.delete(:ignore_pattern) if opts[:ignore_pattern]
      self.refresh_handler        = opts.delete(:refresh_handler) if opts[:refresh_handler]
      self.cache_limit            = opts.delete(:cache_limit) if opts[:cache_limit]

      @default_wait               = Integer(opts.delete(:default_wait) || 10)

      if opts.delete(:resynchronize)
        controller = ::HtmlUnit::NicelyResynchronizingAjaxController.new
        @webclient.setAjaxController controller
      end

      enable_event_listener
    end
Configure the webclient according to the options given to #new.
 @see initialize