From b2130906bd94a19cb39743f25f51d87236809db6 Mon Sep 17 00:00:00 2001 From: jmuramatsu Date: Fri, 28 Feb 2014 19:15:02 -0800 Subject: [PATCH] service.py: fix service_args[] handling currently webdriver uses the passed in service_args[] to start phantomjs without making a local copy of the list. When the service object is created, it appends data to service_args, which unintentionally modifies the initial list passed in upon instantiation of the webdriver. this is poor in two respects -- the user of the library does NOT expect their passed in parameter to be modified and also this current behavior interferes with creating more than one instance of webdriver in a python script. The fix is to create a local copy of service_args and pass that local copy to service. so ... service_args=service_args[:] Signed-off-by: Luke Inman-Semerau --- py/selenium/webdriver/phantomjs/service.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/py/selenium/webdriver/phantomjs/service.py b/py/selenium/webdriver/phantomjs/service.py index 8e77ef5eebbed..bf7a57b854a3d 100755 --- a/py/selenium/webdriver/phantomjs/service.py +++ b/py/selenium/webdriver/phantomjs/service.py @@ -44,6 +44,8 @@ def __init__(self, executable_path, port=0, service_args=None, log_path=None): self.port = utils.free_port() if self.service_args is None: self.service_args = [] + else: + self.service_args=service_args[:] self.service_args.insert(0, self.path) self.service_args.append("--webdriver=%d" % self.port) if not log_path: