@@ -287,7 +287,11 @@ def main_frame(self) -> Frame:
287287 return self ._main_frame
288288
289289 def frame (self , name : str = None , url : URLMatch = None ) -> Optional [Frame ]:
290- matcher = URLMatcher (url ) if url else None
290+ matcher = (
291+ URLMatcher (self ._browser_context ._options .get ("baseURL" ), url )
292+ if url
293+ else None
294+ )
291295 for frame in self ._frames :
292296 if name and frame .name == name :
293297 return frame
@@ -335,10 +339,10 @@ async def is_editable(self, selector: str, timeout: float = None) -> bool:
335339 async def is_enabled (self , selector : str , timeout : float = None ) -> bool :
336340 return await self ._main_frame .is_enabled (** locals_to_params (locals ()))
337341
338- async def is_hidden (self , selector : str , timeout : float = None ) -> bool :
342+ async def is_hidden (self , selector : str ) -> bool :
339343 return await self ._main_frame .is_hidden (** locals_to_params (locals ()))
340344
341- async def is_visible (self , selector : str , timeout : float = None ) -> bool :
345+ async def is_visible (self , selector : str ) -> bool :
342346 return await self ._main_frame .is_visible (** locals_to_params (locals ()))
343347
344348 async def dispatch_event (
@@ -506,7 +510,11 @@ async def add_init_script(
506510 await self ._channel .send ("addInitScript" , dict (source = script ))
507511
508512 async def route (self , url : URLMatch , handler : RouteHandler ) -> None :
509- self ._routes .append (RouteHandlerEntry (URLMatcher (url ), handler ))
513+ self ._routes .append (
514+ RouteHandlerEntry (
515+ URLMatcher (self ._browser_context ._options .get ("baseURL" ), url ), handler
516+ )
517+ )
510518 if len (self ._routes ) == 1 :
511519 await self ._channel .send (
512520 "setNetworkInterceptionEnabled" , dict (enabled = True )
@@ -822,7 +830,13 @@ def expect_request(
822830 url_or_predicate : URLMatchRequest ,
823831 timeout : float = None ,
824832 ) -> EventContextManagerImpl [Request ]:
825- matcher = None if callable (url_or_predicate ) else URLMatcher (url_or_predicate )
833+ matcher = (
834+ None
835+ if callable (url_or_predicate )
836+ else URLMatcher (
837+ self ._browser_context ._options .get ("baseURL" ), url_or_predicate
838+ )
839+ )
826840 predicate = url_or_predicate if callable (url_or_predicate ) else None
827841
828842 def my_predicate (request : Request ) -> bool :
@@ -850,7 +864,13 @@ def expect_response(
850864 url_or_predicate : URLMatchResponse ,
851865 timeout : float = None ,
852866 ) -> EventContextManagerImpl [Response ]:
853- matcher = None if callable (url_or_predicate ) else URLMatcher (url_or_predicate )
867+ matcher = (
868+ None
869+ if callable (url_or_predicate )
870+ else URLMatcher (
871+ self ._browser_context ._options .get ("baseURL" ), url_or_predicate
872+ )
873+ )
854874 predicate = url_or_predicate if callable (url_or_predicate ) else None
855875
856876 def my_predicate (response : Response ) -> bool :
0 commit comments