Skip to content

Commit 18a140a

Browse files
committed
Update specs and add service environment variable
1 parent d207384 commit 18a140a

File tree

21 files changed

+98
-89
lines changed

21 files changed

+98
-89
lines changed

rb/lib/selenium/webdriver/chrome/service.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class Service < WebDriver::Service
2424
DEFAULT_PORT = 9515
2525
EXECUTABLE = 'chromedriver'
2626
SHUTDOWN_SUPPORTED = true
27+
DRIVER_PATH_ENV_KEY = 'SE_CHROMEDRIVER'
2728

2829
def log
2930
return @log unless @log.is_a? String

rb/lib/selenium/webdriver/common/service.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,7 @@ def find_driver_path
102102
end
103103

104104
def env_path
105-
class_name = self.class.name&.split('::')&.[](2)&.downcase
106-
driver_name = class_name == 'firefox' ? 'gecko' : class_name
107-
parsed_driver = "SE_#{driver_name&.upcase}DRIVER"
108-
ENV.fetch(parsed_driver, nil)
105+
ENV.fetch(self.class::DRIVER_PATH_ENV_KEY, nil)
109106
end
110107
end # Service
111108
end # WebDriver

rb/lib/selenium/webdriver/edge/service.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class Service < WebDriver::Service
2424
DEFAULT_PORT = 9515
2525
EXECUTABLE = 'msedgedriver'
2626
SHUTDOWN_SUPPORTED = true
27+
DRIVER_PATH_ENV_KEY = 'SE_EDGEDRIVER'
2728
def log
2829
return @log unless @log.is_a? String
2930

rb/lib/selenium/webdriver/firefox/service.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class Service < WebDriver::Service
2424
DEFAULT_PORT = 4444
2525
EXECUTABLE = 'geckodriver'
2626
SHUTDOWN_SUPPORTED = false
27+
DRIVER_PATH_ENV_KEY = 'SE_GECKODRIVER'
2728
end # Service
2829
end # Firefox
2930
end # WebDriver

rb/lib/selenium/webdriver/ie/service.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class Service < WebDriver::Service
2424
DEFAULT_PORT = 5555
2525
EXECUTABLE = 'IEDriverServer'
2626
SHUTDOWN_SUPPORTED = true
27+
DRIVER_PATH_ENV_KEY = 'SE_IEDRIVER'
2728
end # Server
2829
end # IE
2930
end # WebDriver

rb/lib/selenium/webdriver/safari/service.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class Service < WebDriver::Service
2424
DEFAULT_PORT = 7050
2525
EXECUTABLE = 'safaridriver'
2626
SHUTDOWN_SUPPORTED = false
27+
DRIVER_PATH_ENV_KEY = 'SE_SAFARIDRIVER'
2728
def initialize(path: nil, port: nil, log: nil, args: nil)
2829
raise Error::WebDriverError, 'Safari Service does not support setting log output' if log
2930

rb/sig/lib/selenium/webdriver/chrome/service.rbs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ module Selenium
22
module WebDriver
33
module Chrome
44
class Service < WebDriver::Service
5+
DRIVER_PATH_ENV_KEY: String
6+
57
@log: untyped
68

79
DEFAULT_PORT: Integer

rb/sig/lib/selenium/webdriver/edge/service.rbs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ module Selenium
22
module WebDriver
33
module Edge
44
class Service < WebDriver::Service
5+
DRIVER_PATH_ENV_KEY: String
6+
57
@log: untyped
68

79
DEFAULT_PORT: Integer

rb/sig/lib/selenium/webdriver/firefox/service.rbs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ module Selenium
44
class Service < WebDriver::Service
55
DEFAULT_PORT: 4444
66

7+
DRIVER_PATH_ENV_KEY: String
78
EXECUTABLE: "geckodriver"
89

910
SHUTDOWN_SUPPORTED: false

rb/sig/lib/selenium/webdriver/ie/service.rbs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ module Selenium
44
class Service < WebDriver::Service
55
DEFAULT_PORT: Integer
66

7+
DRIVER_PATH_ENV_KEY: String
78
EXECUTABLE: String
89

910
SHUTDOWN_SUPPORTED: bool

0 commit comments

Comments
 (0)