19
19
from selenium .webdriver .common import service , utils
20
20
from subprocess import PIPE
21
21
22
+
22
23
class Service (service .Service ):
23
24
"""
24
25
Object that manages the starting and stopping of the SafariDriver
@@ -33,14 +34,16 @@ def __init__(self, executable_path=None, port=0, quiet=False, use_legacy=False):
33
34
- port : Port the service is running on """
34
35
35
36
if not use_legacy and os .path .exists ('/usr/bin/safaridriver' ):
36
- path = '/usr/bin/safaridriver'
37
- self .legacy_driver = False
37
+ path = '/usr/bin/safaridriver'
38
+ self .legacy_driver = False
38
39
else :
39
- path = 'java'
40
- self .standalone_jar = executable_path
41
- self .legacy_driver = True
40
+ path = 'java'
41
+ self .standalone_jar = executable_path
42
+ self .legacy_driver = True
43
+
42
44
if port == 0 :
43
45
port = utils .free_port ()
46
+
44
47
self .quiet = quiet
45
48
log = PIPE
46
49
if quiet :
@@ -49,7 +52,7 @@ def __init__(self, executable_path=None, port=0, quiet=False, use_legacy=False):
49
52
50
53
def command_line_args (self ):
51
54
if self .legacy_driver :
52
- return ["-jar" , self .standalone_jar , "-port" , "%s" % self .port ]
55
+ return ["-jar" , self .standalone_jar , "-port" , "%s" % self .port ]
53
56
return ["-p" , "%s" % self .port ]
54
57
55
58
@property
@@ -58,7 +61,6 @@ def service_url(self):
58
61
Gets the url of the SafariDriver Service
59
62
"""
60
63
if not self .legacy_driver :
61
- return "http://localhost:%d" % self .port
64
+ return "http://localhost:%d" % self .port
62
65
else :
63
- return "http://localhost:%d/wd/hub" % self .port
64
-
66
+ return "http://localhost:%d/wd/hub" % self .port
0 commit comments