def frame(self, locator=None, *args, **kwargs):
        """
        Execute the wrapped code within the given iframe using the given frame or frame name/id.
        May not be supported by all drivers.

        Args:
            locator (str | Element, optional): The name/id of the frame or the frame's element.
                Defaults to the only frame in the document.
        """

        self.switch_to_frame(self._find_frame(locator, *args, **kwargs))
        try:
            yield
        finally:
            self.switch_to_frame("parent")
Execute the wrapped code within the given iframe using the given frame or frame name/id.
        May not be supported by all drivers.

        Args:
            locator (str | Element, optional): The name/id of the frame or the frame's element.
                Defaults to the only frame in the document.