Skip to content

[Feature]Route&unroute can be made into contextmanagement #1800

@gcil125

Description

@gcil125
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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions