Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 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
4 changes: 2 additions & 2 deletions py/selenium/webdriver/common/virtual_authenticator.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def __init__(
self,
credential_id: bytes,
is_resident_credential: bool,
rp_id: str,
rp_id: Optional[str],
user_handle: Optional[bytes],
private_key: bytes,
sign_count: int,
Expand Down 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
3 changes: 2 additions & 1 deletion py/selenium/webdriver/remote/errorhandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@ def check_response(self, response: dict[str, Any]) -> None:
message = value.get("value") or value.get("message")
if not isinstance(message, str):
value = message
message = message.get("message")
if isinstance(message, dict):
message = message.get("message")
else:
message = value.get("message", None)
except ValueError:
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
from typing import Optional, Sequence
from typing import IO, Optional, Sequence

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 @@ -40,7 +40,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 @@ -49,18 +49,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 @@ -39,7 +39,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