@@ -718,7 +718,44 @@ def _uc_gui_click_x_y(driver, x, y, timeframe=0.25, uc_lock=False):
718
718
719
719
720
720
def uc_gui_click_x_y (driver , x , y , timeframe = 0.25 ):
721
- _uc_gui_click_x_y (driver , x , y , timeframe = timeframe , uc_lock = True )
721
+ gui_lock = fasteners .InterProcessLock (
722
+ constants .MultiBrowser .PYAUTOGUILOCK
723
+ )
724
+ with gui_lock : # Prevent issues with multiple processes
725
+ install_pyautogui_if_missing (driver )
726
+ import pyautogui
727
+ pyautogui = get_configured_pyautogui (pyautogui )
728
+ if IS_WINDOWS :
729
+ width_ratio = 1.0
730
+ window_rect = driver .get_window_rect ()
731
+ width = window_rect ["width" ]
732
+ height = window_rect ["height" ]
733
+ win_x = window_rect ["x" ]
734
+ win_y = window_rect ["y" ]
735
+ if (
736
+ hasattr (sb_config , "_saved_width_ratio" )
737
+ and sb_config ._saved_width_ratio
738
+ ):
739
+ width_ratio = sb_config ._saved_width_ratio
740
+ else :
741
+ scr_width = pyautogui .size ().width
742
+ driver .maximize_window ()
743
+ win_width = driver .get_window_size ()["width" ]
744
+ width_ratio = round (float (scr_width ) / float (win_width ), 2 )
745
+ width_ratio += 0.01
746
+ if width_ratio < 0.45 or width_ratio > 2.55 :
747
+ width_ratio = 1.01
748
+ sb_config ._saved_width_ratio = width_ratio
749
+ driver .minimize_window ()
750
+ driver .set_window_rect (win_x , win_y , width , height )
751
+ x = x * width_ratio
752
+ y = y * width_ratio
753
+ _uc_gui_click_x_y (driver , x , y , timeframe = timeframe , uc_lock = False )
754
+ return
755
+ page_actions .switch_to_window (
756
+ driver , driver .current_window_handle , 2 , uc_lock = False
757
+ )
758
+ _uc_gui_click_x_y (driver , x , y , timeframe = timeframe , uc_lock = False )
722
759
723
760
724
761
def _on_a_cf_turnstile_page (driver ):
@@ -804,6 +841,7 @@ def _uc_gui_click_captcha(
804
841
width_ratio = round (float (scr_width ) / float (win_width ), 2 ) + 0.01
805
842
if width_ratio < 0.45 or width_ratio > 2.55 :
806
843
width_ratio = 1.01
844
+ sb_config ._saved_width_ratio = width_ratio
807
845
driver .minimize_window ()
808
846
driver .set_window_rect (win_x , win_y , width , height )
809
847
if ctype == "cf_t" :
0 commit comments