@@ -24,9 +24,8 @@ module Selenium
24
24
module WebDriver
25
25
module Safari
26
26
MISSING_TEXT = <<-ERROR . tr ( "\n " , '' ) . freeze
27
- Unable to find safari extension. Please download the file from
28
- http://www.seleniumhq.org/download/ and place it
29
- somewhere on your PATH. More info at https://github.com/SeleniumHQ/selenium/wiki/SafariDriver.
27
+ Unable to find Apple's safaridriver which comes with Safari 10.
28
+ More info at https://webkit.org/blog/6900/webdriver-support-in-safari-10/
30
29
ERROR
31
30
32
31
class << self
@@ -36,22 +35,10 @@ def path=(path)
36
35
end
37
36
38
37
def path
39
- @path ||= (
40
- path = case Platform . os
41
- when :windows
42
- Platform . find_in_program_files ( 'Safari\\Safari.exe' )
43
- when :macosx
44
- '/Applications/Safari.app/Contents/MacOS/Safari'
45
- else
46
- Platform . find_binary ( 'Safari' )
47
- end
48
-
49
- unless File . file? ( path ) && File . executable? ( path )
50
- raise Error ::WebDriverError , MISSING_TEXT
51
- end
52
-
53
- path
54
- )
38
+ @path ||= '/Applications/Safari.app/Contents/MacOS/Safari'
39
+ return @path if File . file? ( @path ) && File . executable? ( @path )
40
+ raise Error ::WebDriverError , 'Safari is only supported on Mac' unless Platform . os == :macosx
41
+ raise Error ::WebDriverError , 'Unable to find Safari'
55
42
end
56
43
57
44
def resource_path
@@ -64,7 +51,9 @@ def driver_path=(path)
64
51
end
65
52
66
53
def driver_path
67
- @driver_path || '/usr/bin/safaridriver'
54
+ @driver_path ||= '/usr/bin/safaridriver'
55
+ return @driver_path if File . file? ( @driver_path ) && File . executable? ( @driver_path )
56
+ raise Error ::WebDriverError , MISSING_TEXT
68
57
end
69
58
end
70
59
end # Safari
0 commit comments