Skip to content

Commit

Permalink
fix(playwright): add context manager methods
Browse files Browse the repository at this point in the history
  • Loading branch information
idiotWu committed Feb 5, 2025
1 parent f249833 commit 68a09ca
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions npiai/core/browser/_playwright.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit 68a09ca

Please sign in to comment.