DanielWagnerHall: Adding log_path/service_log_path as named kwargs for chrome
git-svn-id: http://selenium.googlecode.com/svn/trunk/py@18238 07704840-8298-11de-bf8c-fd130f914ac9
diff --git a/selenium/webdriver/chrome/service.py b/selenium/webdriver/chrome/service.py
index 3a89c82..db7b724 100644
--- a/selenium/webdriver/chrome/service.py
+++ b/selenium/webdriver/chrome/service.py
@@ -26,18 +26,21 @@
Object that manages the starting and stopping of the ChromeDriver
"""
- def __init__(self, executable_path, port=0, service_args=None):
+ def __init__(self, executable_path, port=0, service_args=None, log_path=None):
"""
Creates a new instance of the Service
:Args:
- executable_path : Path to the ChromeDriver
- port : Port the service is running on
- - service_args : List of args to pass to the chromedriver service"""
+ - service_args : List of args to pass to the chromedriver service
+ - log_path : Path for the chromedriver service to log to"""
self.port = port
self.path = executable_path
- self.service_args = service_args
+ self.service_args = service_args or []
+ if log_path:
+ self.service_args.append('--log-path=%s' % log_path)
if self.port == 0:
self.port = utils.free_port()
@@ -53,7 +56,7 @@
self.process = subprocess.Popen([
self.path,
"--port=%d" % self.port] +
- self.service_args or [], stdout=PIPE, stderr=PIPE)
+ self.service_args, stdout=PIPE, stderr=PIPE)
except:
raise WebDriverException(
"ChromeDriver executable needs to be available in the path. \
diff --git a/selenium/webdriver/chrome/webdriver.py b/selenium/webdriver/chrome/webdriver.py
index e7d980f..ed3d728 100644
--- a/selenium/webdriver/chrome/webdriver.py
+++ b/selenium/webdriver/chrome/webdriver.py
@@ -33,7 +33,7 @@
def __init__(self, executable_path="chromedriver", port=0,
chrome_options=None, service_args=None,
- desired_capabilities=None):
+ desired_capabilities=None, service_log_path=None):
"""
Creates a new instance of the chrome driver.
@@ -56,7 +56,8 @@
else:
desired_capabilities = options.to_capabilities()
- self.service = Service(executable_path, port=port, service_args=service_args)
+ self.service = Service(executable_path, port=port,
+ service_args=service_args, log_path=service_log_path)
self.service.start()
try: