99import urllib .parse
1010import warnings
1111from contextlib import suppress
12- from filelock import FileLock
12+ from filelock import AsyncFileLock
1313from seleniumbase import config as sb_config
1414from seleniumbase .fixtures import constants
1515from seleniumbase .fixtures import js_utils
@@ -1459,8 +1459,8 @@ async def __gui_click_recaptcha(self):
14591459 y = gui_e_y + y_offset
14601460 sb_config ._saved_cf_x_y = (x , y ) # For debugging later
14611461 await self .sleep (0.11 )
1462- gui_lock = FileLock (constants .MultiBrowser .PYAUTOGUILOCK )
1463- with await asyncio . to_thread ( gui_lock . acquire ) :
1462+ gui_lock = AsyncFileLock (constants .MultiBrowser .PYAUTOGUILOCK )
1463+ async with gui_lock :
14641464 await self .bring_to_front ()
14651465 await self .sleep (0.05 )
14661466 await self .click_with_offset (
@@ -1485,8 +1485,8 @@ async def __cdp_click_incapsula_hcaptcha(self):
14851485 x_offset = 30
14861486 y_offset = 36
14871487 was_clicked = False
1488- gui_lock = FileLock (constants .MultiBrowser .PYAUTOGUILOCK )
1489- with gui_lock : # Prevent issues with multiple processes
1488+ gui_lock = AsyncFileLock (constants .MultiBrowser .PYAUTOGUILOCK )
1489+ async with gui_lock :
14901490 await self .bring_to_front ()
14911491 await self .sleep (0.056 )
14921492 if "--debug" in sys .argv :
@@ -1792,8 +1792,8 @@ async def solve_captcha(self):
17921792 y = e_y + y_offset
17931793 sb_config ._saved_cf_x_y = (x , y ) # For debugging later
17941794 await self .sleep (0.11 )
1795- gui_lock = FileLock (constants .MultiBrowser .PYAUTOGUILOCK )
1796- with await asyncio . to_thread ( gui_lock . acquire ) :
1795+ gui_lock = AsyncFileLock (constants .MultiBrowser .PYAUTOGUILOCK )
1796+ async with gui_lock :
17971797 await self .bring_to_front ()
17981798 await self .sleep (0.05 )
17991799 await self .click_with_offset (
0 commit comments