playwright-python
playwright-python copied to clipboard
[Feature]Route&unroute can be made into contextmanagement
from contextlib import contextmanager
@contextmanager
def expect_route(url, handle, *, times):
page.route(url, handle, times=times)
yield
page.unroute(url, handle)
with expect_route(url, handle) as route_info:
page.click(xxxx)
I hope that after using route to listen for a click event, I can immediately log off the listening