Class: WatchDoge::WebdriverManager
- Inherits:
-
Object
- Object
- WatchDoge::WebdriverManager
- Defined in:
- lib/watchdoge/webdriver_manager.rb
Instance Attribute Summary collapse
-
#driver ⇒ Object
readonly
Returns the value of attribute driver.
-
#install_path ⇒ Object
readonly
Returns the value of attribute install_path.
-
#install_version ⇒ Object
readonly
Returns the value of attribute install_version.
Instance Method Summary collapse
-
#initialize(browser) ⇒ WebdriverManager
constructor
A new instance of WebdriverManager.
Constructor Details
#initialize(browser) ⇒ WebdriverManager
Returns a new instance of WebdriverManager.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/watchdoge/webdriver_manager.rb', line 18 def initialize browser @driver = case browser when :chrome Webdrivers::Chromedriver when :firefox Webdrivers::Geckodriver end @install_version = WatchDoge.configuration.send("#{browser}_version") || @driver.latest_version.to_s @install_path = "#{WatchDoge.configuration.web_drivers_dir}/#{browser}/#{@install_version}/" Webdrivers.install_dir = @install_path @driver.required_version = @install_version @driver.update klass = "Selenium::WebDriver::#{browser.to_s.split('_').collect(&:capitalize).join}::Service".constantize binary = case browser when :chrome "chromedriver" when :firefox "geckodriver" end klass.driver_path = "#{@install_path}/#{binary}" end |
Instance Attribute Details
#driver ⇒ Object (readonly)
Returns the value of attribute driver.
14 15 16 |
# File 'lib/watchdoge/webdriver_manager.rb', line 14 def driver @driver end |
#install_path ⇒ Object (readonly)
Returns the value of attribute install_path.
16 17 18 |
# File 'lib/watchdoge/webdriver_manager.rb', line 16 def install_path @install_path end |
#install_version ⇒ Object (readonly)
Returns the value of attribute install_version.
15 16 17 |
# File 'lib/watchdoge/webdriver_manager.rb', line 15 def install_version @install_version end |