Bug 1725683 - [wdspec] Session fixtures should not ignore "session not created" errors. r=webdriver-reviewers,jgraham

Right now we ignore all the possible thrown "session not created"
errors unless the session id is not set. This is specifically
problematic for the BiDi session creation, which would fail
silently in case it cannot be created.

Differential Revision: https://phabricator.services.mozilla.com/D122625
This commit is contained in:
Henrik Skupin 2021-09-06 16:34:42 +00:00
Родитель 943e76e2de
Коммит d6188c9ce0
2 изменённых файлов: 9 добавлений и 13 удалений

Просмотреть файл

@ -1,10 +1,11 @@
from typing import Dict
from urllib import parse as urlparse
from . import error
from . import protocol
from . import transport
from .bidi.client import BidiSession
from urllib import parse as urlparse
def command(func):
def inner(self, *args, **kwargs):
@ -551,6 +552,9 @@ class Session(object):
body["capabilities"] = self.requested_capabilities
value = self.send_command("POST", "session", body=body)
assert isinstance(value["sessionId"], str)
assert isinstance(value["capabilities"], Dict)
self.session_id = value["sessionId"]
self.capabilities = value["capabilities"]

Просмотреть файл

@ -113,12 +113,8 @@ async def session(capabilities, configuration, request):
configuration["host"],
configuration["port"],
capabilities=caps)
try:
_current_session.start()
except webdriver.error.SessionNotCreatedException:
if not _current_session.session_id:
raise
_current_session.start()
# Enforce a fixed default window size and position
if _current_session.capabilities.get("setWindowRect"):
@ -159,12 +155,8 @@ async def bidi_session(capabilities, configuration, request):
capabilities=caps,
enable_bidi=True)
try:
_current_session.start()
await _current_session.bidi_session.start()
except webdriver.error.SessionNotCreatedException:
if not _current_session.session_id:
raise
_current_session.start()
await _current_session.bidi_session.start()
# Enforce a fixed default window size and position
_current_session.window.size = defaults.WINDOW_SIZE