This method raises an exception if the active window is closed. (This provides a much cleaner exception message in this situation.)
(self)
| 10070 | self.ad_block() |
| 10071 | |
| 10072 | def _check_browser(self): |
| 10073 | """This method raises an exception if the active window is closed. |
| 10074 | (This provides a much cleaner exception message in this situation.)""" |
| 10075 | page_actions._reconnect_if_disconnected(self.driver) |
| 10076 | active_window = None |
| 10077 | with suppress(Exception): |
| 10078 | active_window = self.driver.current_window_handle # Fails if None |
| 10079 | if not active_window: |
| 10080 | raise NoSuchWindowException("Active window was already closed!") |
| 10081 | |
| 10082 | def _print(self, msg): |
| 10083 | """Same as Python's print(), but also prints during multithreaded runs. |
no test coverage detected