Module: Webdrivers

Defined in:
lib/webdrivers/logger.rb,
lib/webdrivers/common.rb,
lib/webdrivers/system.rb,
lib/webdrivers/network.rb,
lib/webdrivers/railtie.rb,
lib/webdrivers/version.rb,
lib/webdrivers/iedriver.rb,
lib/webdrivers/geckodriver.rb,
lib/webdrivers/chromedriver.rb,
lib/webdrivers/chrome_finder.rb

Overview

Defined Under Namespace

Classes: ChromeFinder, Chromedriver, Common, ConnectionError, Geckodriver, IEdriver, Logger, Network, NetworkError, Railtie, System, VersionError

Constant Summary collapse

DEFAULT_CACHE_TIME =

24 hours

86_400
VERSION =
'4.0.1'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.cache_timeObject

Note:

Value from the environment variable “WD_CACHE_TIME” takes precedence over Webdrivers.cache_time. If neither

Returns the amount of time (Seconds) the gem waits between two update checks. are set, it defaults to 86,400 Seconds (24 hours).



32
33
34
# File 'lib/webdrivers/common.rb', line 32

def cache_time
  (ENV['WD_CACHE_TIME'] || @cache_time || DEFAULT_CACHE_TIME).to_i
end

.install_dirString

Returns the install (download) directory path for the drivers.



40
41
42
# File 'lib/webdrivers/common.rb', line 40

def install_dir
  @install_dir || ENV['WD_INSTALL_DIR'] || File.expand_path(File.join(ENV['HOME'], '.webdrivers'))
end

.proxy_addrObject

Returns the value of attribute proxy_addr.



24
25
26
# File 'lib/webdrivers/common.rb', line 24

def proxy_addr
  @proxy_addr
end

.proxy_passObject

Returns the value of attribute proxy_pass.



24
25
26
# File 'lib/webdrivers/common.rb', line 24

def proxy_pass
  @proxy_pass
end

.proxy_portObject

Returns the value of attribute proxy_port.



24
25
26
# File 'lib/webdrivers/common.rb', line 24

def proxy_port
  @proxy_port
end

.proxy_userObject

Returns the value of attribute proxy_user.



24
25
26
# File 'lib/webdrivers/common.rb', line 24

def proxy_user
  @proxy_user
end

Class Method Details

.configure {|_self| ... } ⇒ Object

Provides a convenient way to configure the gem.

Examples:

Configure proxy and cache_time

Webdrivers.configure do |config|
  config.proxy_addr = 'myproxy_address.com'
  config.proxy_port = '8080'
  config.proxy_user = 'username'
  config.proxy_pass = 'password'
  config.cache_time = 604_800 # 7 days
end

Yields:

  • (_self)

Yield Parameters:

  • _self (Webdrivers)

    the object that the method was called on



60
61
62
# File 'lib/webdrivers/common.rb', line 60

def configure
  yield self
end

.loggerObject



44
45
46
# File 'lib/webdrivers/common.rb', line 44

def logger
  @logger ||= Webdrivers::Logger.new
end

.net_http_ssl_fixObject



64
65
66
67
# File 'lib/webdrivers/common.rb', line 64

def net_http_ssl_fix
  raise 'Webdrivers.net_http_ssl_fix is no longer available.' \
  ' Please see https://github.com/titusfortner/webdrivers#ssl_connect-errors.'
end