aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorJohn Hawthorn <john@hawthorn.email>2019-07-04 14:47:21 -0700
committerJohn Hawthorn <john@hawthorn.email>2019-07-04 15:00:07 -0700
commitcd4541a1aa7f306d59d167fade17dff17d57ac75 (patch)
treea7095c299bb26c8a070717c28579f9c84af3433e /actionpack
parenta59b2305792dd7012a8abc2e4b1a7d9037e8e208 (diff)
downloadrails-cd4541a1aa7f306d59d167fade17dff17d57ac75.tar.gz
rails-cd4541a1aa7f306d59d167fade17dff17d57ac75.tar.bz2
rails-cd4541a1aa7f306d59d167fade17dff17d57ac75.zip
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.
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_dispatch/system_testing/browser.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/system_testing/browser.rb b/actionpack/lib/action_dispatch/system_testing/browser.rb
index f5f195d876..e861e52f09 100644
--- a/actionpack/lib/action_dispatch/system_testing/browser.rb
+++ b/actionpack/lib/action_dispatch/system_testing/browser.rb
@@ -46,9 +46,19 @@ module ActionDispatch
def preload
case type
when :chrome
- ::Selenium::WebDriver::Chrome::Service.driver_path.try(:call)
+ 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
- ::Selenium::WebDriver::Firefox::Service.driver_path.try(:call)
+ 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