Method: Selenium::WebDriver::Firefox::Profile#initialize

Defined in:
lib/selenium/webdriver/firefox/profile.rb

#initialize(directory = nil) ⇒ Profile

Create a new Profile instance

Examples:

User configured profile


profile = Selenium::WebDriver::Firefox::Profile.new
profile['network.proxy.http'] = 'localhost'
profile['network.proxy.http_port'] = 9090

driver = Selenium::WebDriver.for :firefox, :profile => profile


37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/selenium/webdriver/firefox/profile.rb', line 37

def initialize(directory = nil)
  @directory = directory ? create_tmp_copy(directory) : Dir.mktmpdir("webdriver-profile")

  unless File.directory? @directory
    raise Error::WebDriverError, "Profile directory does not exist: #{@directory.inspect}"
  end

  FileReaper << @directory

  # TODO: replace constants with options hash
  @port              = DEFAULT_PORT
  @native_events     = DEFAULT_ENABLE_NATIVE_EVENTS
  @secure_ssl        = DEFAULT_SECURE_SSL
  @untrusted_issuer  = DEFAULT_ASSUME_UNTRUSTED_ISSUER
  @load_no_focus_lib = DEFAULT_LOAD_NO_FOCUS_LIB

  @additional_prefs  = {}
end