Skip to content

Commit ac99629

Browse files
jugglinmikelmtierney
authored andcommitted
[py] Honor cmd line args passed to Service ctor (#4167)
* [py] Honor cmd line args passed to Service ctor Ensure that when command line arguments are specified during creation of a Service object for GeckoDriver, these arguments are used in the resulting invocation of the binary.
1 parent 234c999 commit ac99629

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

py/selenium/webdriver/firefox/service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def __init__(self, executable_path, port=0, service_args=None,
4848
self.service_args = service_args or []
4949

5050
def command_line_args(self):
51-
return ["--port", "%d" % self.port]
51+
return ["--port", "%d" % self.port] + self.service_args
5252

5353
def send_remote_shutdown_command(self):
5454
pass
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Licensed to the Software Freedom Conservancy (SFC) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The SFC licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
from selenium.webdriver.firefox.service import Service
19+
20+
def test_command_line_args():
21+
service = Service("geckodriver", service_args=["--log", "trace"])
22+
found = False
23+
24+
args = service.command_line_args()
25+
26+
for idx in range(len(args) - 1):
27+
if args[idx] == "--log" and args[idx + 1] == "trace":
28+
found = True
29+
break
30+
31+
assert found, "Provided arguments do not exist in array"

0 commit comments

Comments
 (0)