<commit_before>require 'capybara'
require 'capybara/selenium/driver'
require 'base64'

module PersistentSelenium
  class Browser < Capybara::Selenium::Driver
    def initialize(browser_type)
      @browser_type = browser_type.to_s.to_sym
      @__found_elements__ = []
    end

    def browser
      case @browser_type
      when :firefox
        profile = Selenium::WebDriver::Firefox::Profile.new
        profile['browser.cache.disk.enable'] = false
        profile['browser.cache.memory.enable'] = false
        profile['browser.cache.offline.enable'] = false
        profile['network.http.use-cache'] = false

        options = { :profile => profile }
      when :chrome
        profile = Selenium::WebDriver::Chrome::Profile.new

        PersistentSelenium.chrome_extensions.each do |extension|
          profile.add_extension extension
        end

        options = { :profile => profile, :switches => %w{--disk-cache-size=1 --media-cache-size=1} }
      end

      @browser ||= Selenium::WebDriver.for(@browser_type, options)
    end

    def options
      {}
    end<commit_msg>Add @frame_handles for iframe support<commit_after>require 'capybara'
require 'capybara/selenium/driver'
require 'base64'

module PersistentSelenium
  class Browser < Capybara::Selenium::Driver
    def initialize(browser_type)
      @browser_type = browser_type.to_s.to_sym
      @frame_handles = {}
      @__found_elements__ = []
    end

    def browser
      case @browser_type
      when :firefox
        profile = Selenium::WebDriver::Firefox::Profile.new
        profile['browser.cache.disk.enable'] = false
        profile['browser.cache.memory.enable'] = false
        profile['browser.cache.offline.enable'] = false
        profile['network.http.use-cache'] = false

        options = { :profile => profile }
      when :chrome
        profile = Selenium::WebDriver::Chrome::Profile.new

        PersistentSelenium.chrome_extensions.each do |extension|
          profile.add_extension extension
        end

        options = { :profile => profile, :switches => %w{--disk-cache-size=1 --media-cache-size=1} }
      end

      @browser ||= Selenium::WebDriver.for(@browser_type, options)
    end

    def options
      {}
    end
{'fraction_non_alphanumeric': 0.1137589928057554, 'fraction_numerical': 0.0035971223021582736, 'mean_word_length': 2.8628472222222223, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5880704', 'n_tokens_mistral': 672, 'n_tokens_neox': 646, 'n_words': 124}