Class: Aranha::Selenium::DriverFactory::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/aranha/selenium/driver_factory/base.rb

Direct Known Subclasses

Chrome, Firefox

Constant Summary collapse

DEFAULT_DOWNLOADS_DIR =
::File.join(::Dir.tmpdir, 'aranha_downloads_dir')
DEFAULT_ACCEPT_INSECURE_CERTS =
false
DEFAULT_HEADLESS =
false
DEFAULT_USER_AGENT =
nil

Class Attribute Summary collapse

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Base

Returns a new instance of Base.



38
39
40
# File 'lib/aranha/selenium/driver_factory/base.rb', line 38

def initialize(options)
  @options = options.with_indifferent_access.freeze
end

Class Attribute Details

.default_accept_insecure_certsObject



23
24
25
# File 'lib/aranha/selenium/driver_factory/base.rb', line 23

def default_accept_insecure_certs
  @default_accept_insecure_certs || DEFAULT_ACCEPT_INSECURE_CERTS
end

.default_downloads_dirObject



19
20
21
# File 'lib/aranha/selenium/driver_factory/base.rb', line 19

def default_downloads_dir
  @default_downloads_dir || DEFAULT_DOWNLOADS_DIR
end

.default_headlessObject



27
28
29
# File 'lib/aranha/selenium/driver_factory/base.rb', line 27

def default_headless
  @default_headless || DEFAULT_HEADLESS
end

.default_user_agentObject



31
32
33
# File 'lib/aranha/selenium/driver_factory/base.rb', line 31

def default_user_agent
  @default_user_agent || DEFAULT_USER_AGENT
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



36
37
38
# File 'lib/aranha/selenium/driver_factory/base.rb', line 36

def options
  @options
end

Instance Method Details

#accept_insecure_certs?Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/aranha/selenium/driver_factory/base.rb', line 50

def accept_insecure_certs?
  option_value(:accept_insecure_certs)
end

#buildObject



42
43
44
# File 'lib/aranha/selenium/driver_factory/base.rb', line 42

def build
  raise 'Must be overrided'
end

#downloads_dirObject



46
47
48
# File 'lib/aranha/selenium/driver_factory/base.rb', line 46

def downloads_dir
  option_value(:downloads_dir)
end

#headless?Boolean

Returns:

  • (Boolean)


54
55
56
# File 'lib/aranha/selenium/driver_factory/base.rb', line 54

def headless?
  option_value(:headless)
end

#user_agentObject



58
59
60
# File 'lib/aranha/selenium/driver_factory/base.rb', line 58

def user_agent
  option_value(:user_agent)
end