Skip to content

Commit

Permalink
make exception_class type more explicit by declaring it before status…
Browse files Browse the repository at this point in the history
… checks

Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
  • Loading branch information
hoefling committed Jul 12, 2021
1 parent 077798d commit 107c173
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions py/selenium/webdriver/remote/errorhandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,9 @@ def check_response(self, response: Dict[str, Any]) -> None:
except ValueError:
pass

exception_class: Type[WebDriverException]
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class: Type[WebDriverException] = NoSuchElementException
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_WINDOW:
Expand Down Expand Up @@ -207,7 +208,7 @@ def check_response(self, response: Dict[str, Any]) -> None:
if message == "" and 'message' in value:
message = value['message']

screen = None
screen = None # type: ignore[assignment]
if 'screen' in value:
screen = value['screen']

Expand Down

0 comments on commit 107c173

Please sign in to comment.