Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion py/selenium/webdriver/common/virtual_authenticator.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def is_resident_credential(self) -> bool:
return self._is_resident_credential

@property
def rp_id(self) -> str:
def rp_id(self) -> Optional[str]:
return self._rp_id

@property
Expand Down
40 changes: 26 additions & 14 deletions py/selenium/webdriver/webkitgtk/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
import shutil
import warnings
from collections.abc import Mapping, Sequence
from typing import Optional
from typing import IO, Optional

from selenium.webdriver.common import service

DEFAULT_EXECUTABLE_PATH: str = shutil.which("WebKitWebDriver")
DEFAULT_EXECUTABLE_PATH: Optional[str] = shutil.which("WebKitWebDriver")


class Service(service.Service):
Expand All @@ -44,7 +44,7 @@ class Service(service.Service):

def __init__(
self,
executable_path: str = DEFAULT_EXECUTABLE_PATH,
executable_path: Optional[str] = DEFAULT_EXECUTABLE_PATH,
port: int = 0,
log_path: Optional[str] = None,
log_output: Optional[str] = None,
Expand All @@ -53,18 +53,30 @@ def __init__(
**kwargs,
) -> None:
self._service_args = list(service_args or [])
if log_path is not None:
warnings.warn("log_path is deprecated, use log_output instead", DeprecationWarning, stacklevel=2)
log_path = open(log_path, "wb")
log_output = open(log_output, "wb") if log_output else None

super().__init__(
executable_path=executable_path,
port=port,
log_output=log_path or log_output,
env=env,
**kwargs,
)
log_file: Optional[IO[bytes]] = None

try:
if log_output is not None:
log_file = open(log_output, "wb")
elif log_path is not None:
warnings.warn("log_path is deprecated, use log_output instead", DeprecationWarning, stacklevel=2)
log_file = open(log_path, "wb")

super().__init__(
executable_path=executable_path,
port=port,
log_output=log_file,
env=env,
**kwargs,
)
except Exception:
if log_file is not None:
try:
log_file.close()
except Exception:
pass
raise

def command_line_args(self) -> list[str]:
return ["-p", f"{self.port}"] + self._service_args
Expand Down
2 changes: 1 addition & 1 deletion py/selenium/webdriver/wpewebkit/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class Service(service.Service):

def __init__(
self,
executable_path: str = DEFAULT_EXECUTABLE_PATH,
executable_path: Optional[str] = DEFAULT_EXECUTABLE_PATH,
port: int = 0,
log_output: Optional[str] = None,
service_args: Optional[Sequence[str]] = None,
Expand Down