Skip to content

Commit 09d6cb1

Browse files
committed
Update environment to be working now
1 parent a2152ec commit 09d6cb1

File tree

15 files changed

+150
-17
lines changed

15 files changed

+150
-17
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ class Service < WebDriver::Service
2424
DEFAULT_PORT = 9515
2525
EXECUTABLE = 'chromedriver'
2626
SHUTDOWN_SUPPORTED = true
27-
PATH = ENV.fetch('SE_CHROMEDRIVER', nil)
2827

2928
def log
3029
return @log unless @log.is_a? String

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def driver_path=(path)
7171
def initialize(path: nil, port: nil, log: nil, args: nil)
7272
port ||= self.class::DEFAULT_PORT
7373
args ||= []
74-
path ||= self.class::PATH
74+
path ||= env_path
7575

7676
@executable_path = path
7777
@host = Platform.localhost
@@ -90,7 +90,7 @@ def initialize(path: nil, port: nil, log: nil, args: nil)
9090
end
9191

9292
def launch
93-
@executable_path ||= self.class::PATH || find_driver_path
93+
@executable_path ||= env_path || find_driver_path
9494
ServiceManager.new(self).tap(&:start)
9595
end
9696

@@ -102,6 +102,13 @@ def find_driver_path
102102
default_options = WebDriver.const_get("#{self.class.name&.split('::')&.[](2)}::Options").new
103103
DriverFinder.new(default_options, self).driver_path
104104
end
105+
106+
def env_path
107+
class_name = self.class.name&.split('::')&.[](2)&.downcase
108+
driver_name = class_name == 'firefox' ? 'gecko' : class_name
109+
parsed_driver = "SE_#{driver_name&.upcase}DRIVER"
110+
ENV.fetch(parsed_driver, nil)
111+
end
105112
end # Service
106113
end # WebDriver
107114
end # Selenium

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ class Service < WebDriver::Service
2424
DEFAULT_PORT = 9515
2525
EXECUTABLE = 'msedgedriver'
2626
SHUTDOWN_SUPPORTED = true
27-
PATH = ENV.fetch('SE_EDGEDRIVER', nil)
2827
def log
2928
return @log unless @log.is_a? String
3029

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ class Service < WebDriver::Service
2424
DEFAULT_PORT = 4444
2525
EXECUTABLE = 'geckodriver'
2626
SHUTDOWN_SUPPORTED = false
27-
PATH = ENV.fetch('SE_GECKODRIVER', nil)
2827
end # Service
2928
end # Firefox
3029
end # WebDriver

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ class Service < WebDriver::Service
2424
DEFAULT_PORT = 5555
2525
EXECUTABLE = 'IEDriverServer'
2626
SHUTDOWN_SUPPORTED = true
27-
PATH = ENV.fetch('SE_IEDRIVER', nil)
2827
end # Server
2928
end # IE
3029
end # WebDriver

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

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

97
DEFAULT_PORT: Integer

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ module Selenium
4747

4848
attr_accessor args: untyped
4949

50+
def env_path: -> String
51+
5052
alias extra_args args
5153

5254
def initialize: (?path: untyped?, ?port: untyped?, ?log: untyped?, ?args: untyped?) -> void

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ module Selenium
22
module WebDriver
33
module Edge
44
class Service < WebDriver::Service
5-
PATH: String
65

76
@log: untyped
87

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ module Selenium
66

77
EXECUTABLE: String
88

9-
PATH: String
109
SHUTDOWN_SUPPORTED: bool
1110
end
1211
end

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ module Selenium
66

77
EXECUTABLE: String
88

9-
PATH: String
109
SHUTDOWN_SUPPORTED: bool
1110

1211
def initialize: (?path: untyped?, ?port: untyped?, ?log: untyped?, ?args: untyped?) -> void

0 commit comments

Comments
 (0)