destroy closes the driver instance and removes session from the storage. The function is noop if session_id doesn't exist. The function returns True if session was found and destroyed, and False if session_id wasn't found.
(self, session_id: str)
| 57 | return session_id in self.sessions |
| 58 | |
| 59 | def destroy(self, session_id: str) -> bool: |
| 60 | """destroy closes the driver instance and removes session from the storage. |
| 61 | The function is noop if session_id doesn't exist. |
| 62 | The function returns True if session was found and destroyed, |
| 63 | and False if session_id wasn't found. |
| 64 | """ |
| 65 | if not self.exists(session_id): |
| 66 | return False |
| 67 | |
| 68 | session = self.sessions.pop(session_id) |
| 69 | if utils.PLATFORM_VERSION == "nt": |
| 70 | session.driver.close() |
| 71 | session.driver.quit() |
| 72 | return True |
| 73 | |
| 74 | def get(self, session_id: str, ttl: Optional[timedelta] = None) -> Tuple[Session, bool]: |
| 75 | session, fresh = self.create(session_id) |
no test coverage detected