in computers/shared/base_playwright.py [0:0]
def __enter__(self):
# Start Playwright and call the subclass hook for getting browser/page
self._playwright = sync_playwright().start()
self._browser, self._page = self._get_browser_and_page()
# Set up network interception to flag URLs matching domains in BLOCKED_DOMAINS
def handle_route(route, request):
url = request.url
if check_blocklisted_url(url):
print(f"Flagging blocked domain: {url}")
route.abort()
else:
route.continue_()
self._page.route("**/*", handle_route)
return self