MCPcopy Index your code
hub / github.com/microsoft/playwright-python / url_matches

Function url_matches

playwright/_impl/_helper.py:155–169  ·  view source on GitHub ↗
(
    base_url: Optional[str],
    url_string: str,
    match: Optional[URLMatch],
    websocket_url: bool = None,
)

Source from the content-addressed store, hash-verified

153
154
155def url_matches(
156 base_url: Optional[str],
157 url_string: str,
158 match: Optional[URLMatch],
159 websocket_url: bool = None,
160) -> bool:
161 if not match:
162 return True
163 if isinstance(match, str):
164 match = re.compile(
165 resolve_glob_to_regex_pattern(base_url, match, websocket_url)
166 )
167 if isinstance(match, Pattern):
168 return bool(match.search(url_string))
169 return match(url_string)
170
171
172def resolve_glob_to_regex_pattern(

Callers 7

matchesMethod · 0.90
predicateMethod · 0.90
wait_for_urlMethod · 0.90
frameMethod · 0.90
my_predicateMethod · 0.90
matchesMethod · 0.85

Calls 1

Tested by 1