#NEWLINE# def __init__( self , executable_path , port = 0 , service_args = None , log_path = None ) : #NEWLINE# #INDENT# '\n        Creates a new instance of the Service\n\n        :Args:\n         - executable_path : Path to PhantomJS binary\n         - port : Port the service is running on\n         - service_args : A List of other command line options to pass to PhantomJS\n         - log_path: Path for PhantomJS service to log to\n        ' #NEWLINE# self . port = port #NEWLINE# self . path = executable_path #NEWLINE# self . service_args = service_args #NEWLINE# if ( self . port == 0 ) : #NEWLINE# #INDENT# self . port = utils . free_port ( ) #NEWLINE# #UNINDENT# if ( self . service_args is None ) : #NEWLINE# #INDENT# self . service_args = [ ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . service_args = service_args [ : ] #NEWLINE# #UNINDENT# self . service_args . insert ( 0 , self . path ) #NEWLINE# self . service_args . append ( ( '--webdriver=%d' % self . port ) ) #NEWLINE# self . process = None #NEWLINE# if ( not log_path ) : #NEWLINE# #INDENT# log_path = 'ghostdriver.log' #NEWLINE# #UNINDENT# self . _log = open ( log_path , 'w' )