@@ -751,20 +751,26 @@ def _get_playwright(self, sb: BrowserSandbox) -> "BrowserPlaywrightSync":
751751 Automatically recreates the connection when the thread that created it has exited,
752752 because Playwright's internal greenlet is bound to the thread that created it.
753753 """
754- if self ._playwright_sync is not None and self ._playwright_thread is not None :
754+ if (
755+ self ._playwright_sync is not None
756+ and self ._playwright_thread is not None
757+ ):
755758 current_thread = threading .current_thread ()
756759 creator_thread = self ._playwright_thread
757- if not creator_thread .is_alive () or current_thread is not creator_thread :
760+ if (
761+ not creator_thread .is_alive ()
762+ or current_thread is not creator_thread
763+ ):
758764 if not creator_thread .is_alive ():
759765 logger .debug (
760- "Playwright creating thread (id=%s) has exited, recreating "
761- " connection" ,
766+ "Playwright creating thread (id=%s) has exited,"
767+ " recreating connection" ,
762768 creator_thread .ident ,
763769 )
764770 else :
765771 logger .debug (
766- "Playwright creating thread (id=%s) differs from current "
767- " thread (id=%s), recreating connection" ,
772+ "Playwright creating thread (id=%s) differs from"
773+ " current thread (id=%s), recreating connection" ,
768774 creator_thread .ident ,
769775 current_thread .ident ,
770776 )
@@ -970,7 +976,7 @@ def goto(self, url: str) -> Dict[str, Any]:
970976 )
971977 def browser_navigate_back (
972978 self ,
973- wait_until : str = "load " ,
979+ wait_until : str = "domcontentloaded " ,
974980 timeout : Optional [float ] = None ,
975981 ) -> Dict [str , Any ]:
976982 """返回上一页 / Go back to previous page"""
@@ -996,7 +1002,7 @@ def inner(sb: Sandbox):
9961002 )
9971003 def browser_go_forward (
9981004 self ,
999- wait_until : str = "load " ,
1005+ wait_until : str = "domcontentloaded " ,
10001006 timeout : Optional [float ] = None ,
10011007 ) -> Dict [str , Any ]:
10021008 """前进到下一页 / Go forward to next page"""
0 commit comments