diff --git a/npiai/core/browser/_playwright.py b/npiai/core/browser/_playwright.py index 13c41af..b42bf8e 100644 --- a/npiai/core/browser/_playwright.py +++ b/npiai/core/browser/_playwright.py @@ -212,3 +212,10 @@ async def stop(self): await self.playwright.stop() self.ready = False self.closed = True + + async def __aenter__(self): + await self.start() + return self + + async def __aexit__(self, exc_type, exc, tb): + await self.stop()