Skip to content

Commit

Permalink
service.py: fix service_args[] handling
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
jmuramatsu authored and lukeis committed Mar 3, 2014
1 parent 37ea8e6 commit b213090
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions py/selenium/webdriver/phantomjs/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit b213090

Please sign in to comment.