1919from selenium .webdriver .common import service , utils
2020from subprocess import PIPE
2121
22+
2223class Service (service .Service ):
2324 """
2425 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):
3334 - port : Port the service is running on """
3435
3536 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
3839 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+
4244 if port == 0 :
4345 port = utils .free_port ()
46+
4447 self .quiet = quiet
4548 log = PIPE
4649 if quiet :
@@ -49,7 +52,7 @@ def __init__(self, executable_path=None, port=0, quiet=False, use_legacy=False):
4952
5053 def command_line_args (self ):
5154 if self .legacy_driver :
52- return ["-jar" , self .standalone_jar , "-port" , "%s" % self .port ]
55+ return ["-jar" , self .standalone_jar , "-port" , "%s" % self .port ]
5356 return ["-p" , "%s" % self .port ]
5457
5558 @property
@@ -58,7 +61,6 @@ def service_url(self):
5861 Gets the url of the SafariDriver Service
5962 """
6063 if not self .legacy_driver :
61- return "http://localhost:%d" % self .port
64+ return "http://localhost:%d" % self .port
6265 else :
63- return "http://localhost:%d/wd/hub" % self .port
64-
66+ return "http://localhost:%d/wd/hub" % self .port
0 commit comments