Skip to content

Commit c911b18

Browse files
stored frame into another var and passed that in exception
1 parent bda34a7 commit c911b18

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

py/selenium/webdriver/remote/switch_to.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,14 @@ def frame(self, frame_reference: Union[str, int, WebElement]) -> None:
8181
driver.switch_to.frame(driver.find_elements(By.TAG_NAME, "iframe")[0])
8282
"""
8383
if isinstance(frame_reference, str):
84+
frame_name = frame_reference
8485
try:
8586
frame_reference = self._driver.find_element(By.ID, frame_reference)
8687
except NoSuchElementException:
8788
try:
8889
frame_reference = self._driver.find_element(By.NAME, frame_reference)
8990
except NoSuchElementException as exc:
90-
raise NoSuchFrameException(str(frame_reference)) from exc
91+
raise NoSuchFrameException(frame_name) from exc
9192

9293
self._driver.execute(Command.SWITCH_TO_FRAME, {"id": frame_reference})
9394

0 commit comments

Comments
 (0)