@@ -287,7 +287,11 @@ def main_frame(self) -> Frame:
287
287
return self ._main_frame
288
288
289
289
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
+ )
291
295
for frame in self ._frames :
292
296
if name and frame .name == name :
293
297
return frame
@@ -335,10 +339,10 @@ async def is_editable(self, selector: str, timeout: float = None) -> bool:
335
339
async def is_enabled (self , selector : str , timeout : float = None ) -> bool :
336
340
return await self ._main_frame .is_enabled (** locals_to_params (locals ()))
337
341
338
- async def is_hidden (self , selector : str , timeout : float = None ) -> bool :
342
+ async def is_hidden (self , selector : str ) -> bool :
339
343
return await self ._main_frame .is_hidden (** locals_to_params (locals ()))
340
344
341
- async def is_visible (self , selector : str , timeout : float = None ) -> bool :
345
+ async def is_visible (self , selector : str ) -> bool :
342
346
return await self ._main_frame .is_visible (** locals_to_params (locals ()))
343
347
344
348
async def dispatch_event (
@@ -506,7 +510,11 @@ async def add_init_script(
506
510
await self ._channel .send ("addInitScript" , dict (source = script ))
507
511
508
512
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
+ )
510
518
if len (self ._routes ) == 1 :
511
519
await self ._channel .send (
512
520
"setNetworkInterceptionEnabled" , dict (enabled = True )
@@ -822,7 +830,13 @@ def expect_request(
822
830
url_or_predicate : URLMatchRequest ,
823
831
timeout : float = None ,
824
832
) -> 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
+ )
826
840
predicate = url_or_predicate if callable (url_or_predicate ) else None
827
841
828
842
def my_predicate (request : Request ) -> bool :
@@ -850,7 +864,13 @@ def expect_response(
850
864
url_or_predicate : URLMatchResponse ,
851
865
timeout : float = None ,
852
866
) -> 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
+ )
854
874
predicate = url_or_predicate if callable (url_or_predicate ) else None
855
875
856
876
def my_predicate (response : Response ) -> bool :
0 commit comments