1414# KIND, either express or implied. See the License for the
1515# specific language governing permissions and limitations
1616# under the License.
17- from typing import Optional
17+
18+ from typing import Optional , Sequence
1819
1920from selenium .types import SubprocessStdAlias
2021from selenium .webdriver .common import service
@@ -28,7 +29,7 @@ def __init__(
2829 executable_path : Optional [str ] = None ,
2930 port : int = 0 ,
3031 host : Optional [str ] = None ,
31- service_args : Optional [list [str ]] = None ,
32+ service_args : Optional [Sequence [str ]] = None ,
3233 log_level : Optional [str ] = None ,
3334 log_output : Optional [SubprocessStdAlias ] = None ,
3435 driver_path_env_key : Optional [str ] = None ,
@@ -39,19 +40,21 @@ def __init__(
3940 :Args:
4041 - executable_path : Path to the IEDriver
4142 - port : Port the service is running on
42- - host : IP address the service port is bound
43- - log_level : Level of logging of service, may be "FATAL", "ERROR", "WARN", "INFO", "DEBUG", "TRACE".
44- Default is "FATAL".
43+ - host : (Optional) IP address the service port is bound
44+ - service_args: (Optional) Sequence of args to be passed to the subprocess when launching the executable.
45+ - log_level : (Optional) Level of logging of service, may be "FATAL", "ERROR", "WARN", "INFO", "DEBUG",
46+ "TRACE". Default is "FATAL".
4547 - log_output: (Optional) int representation of STDOUT/DEVNULL, any IO instance or String path to file.
4648 Default is "stdout".
49+ - driver_path_env_key: (Optional) Environment variable to use to get the path to the driver executable.
4750 """
48- self .service_args = service_args or []
51+ self ._service_args = service_args or []
4952 driver_path_env_key = driver_path_env_key or "SE_IEDRIVER"
5053
5154 if host :
52- self .service_args .append (f"--host={ host } " )
55+ self ._service_args .append (f"--host={ host } " )
5356 if log_level :
54- self .service_args .append (f"--log-level={ log_level } " )
57+ self ._service_args .append (f"--log-level={ log_level } " )
5558
5659 super ().__init__ (
5760 executable_path = executable_path ,
@@ -62,4 +65,14 @@ def __init__(
6265 )
6366
6467 def command_line_args (self ) -> list [str ]:
65- return [f"--port={ self .port } " ] + self .service_args
68+ return [f"--port={ self .port } " ] + self ._service_args
69+
70+ @property
71+ def service_args (self ) -> Sequence [str ]:
72+ return self ._service_args
73+
74+ @service_args .setter
75+ def service_args (self , value : Sequence [str ]):
76+ if not isinstance (value , Sequence ):
77+ raise TypeError ("service_args must be a sequence" )
78+ self ._service_args = value
0 commit comments