Skip to content

Commit 882afba

Browse files
committed
[py]: set exception direct cause when switching frame focus when NSE is raised
1 parent d90f7ba commit 882afba

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

py/selenium/webdriver/remote/switch_to.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ def frame(self, frame_reference: Union[str, int, WebElement]) -> None:
8989
except NoSuchElementException:
9090
try:
9191
frame_reference = self._driver.find_element(By.NAME, frame_reference)
92-
except NoSuchElementException:
93-
raise NoSuchFrameException(frame_reference)
92+
except NoSuchElementException as exc:
93+
raise NoSuchFrameException(frame_reference) from exc
9494

9595
self._driver.execute(Command.SWITCH_TO_FRAME, {"id": frame_reference})
9696

0 commit comments

Comments
 (0)