Switches to a new top-level browsing context. The type hint can be one of "tab" or "window". If not specified the browser will automatically select it. Example: driver.switch_to.new_window("tab")
(self, type_hint: str | None = None)
| 89 | self._driver.execute(Command.SWITCH_TO_FRAME, {"id": frame_reference}) |
| 90 | |
| 91 | def new_window(self, type_hint: str | None = None) -> None: |
| 92 | """Switches to a new top-level browsing context. |
| 93 | |
| 94 | The type hint can be one of "tab" or "window". If not specified the |
| 95 | browser will automatically select it. |
| 96 | |
| 97 | Example: |
| 98 | driver.switch_to.new_window("tab") |
| 99 | """ |
| 100 | value = self._driver.execute(Command.NEW_WINDOW, {"type": type_hint})["value"] |
| 101 | self._w3c_window(value["handle"]) |
| 102 | |
| 103 | def parent_frame(self) -> None: |
| 104 | """Switch focus to the parent browsing context. |