Fix Browser#preload for older Selenium
Older versions of selenium had driver_path on ::Selenium::WebDriver::Chrome directly, not on Service. This avoids errors on those old versions and will preload properly if webdrivers is installed.
This commit is contained in:
parent
a59b230579
commit
cd4541a1aa
@ -46,9 +46,19 @@ def capabilities
|
||||
def preload
|
||||
case type
|
||||
when :chrome
|
||||
if ::Selenium::WebDriver::Service.respond_to? :driver_path=
|
||||
::Selenium::WebDriver::Chrome::Service.driver_path.try(:call)
|
||||
else
|
||||
# Selenium <= v3.141.0
|
||||
::Selenium::WebDriver::Chrome.driver_path
|
||||
end
|
||||
when :firefox
|
||||
if ::Selenium::WebDriver::Service.respond_to? :driver_path=
|
||||
::Selenium::WebDriver::Firefox::Service.driver_path.try(:call)
|
||||
else
|
||||
# Selenium <= v3.141.0
|
||||
::Selenium::WebDriver::Firefox.driver_path
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user