@@ -781,6 +781,7 @@ def _uc_gui_click_captcha(
781
781
)
782
782
with gui_lock : # Prevent issues with multiple processes
783
783
needs_switch = False
784
+ width_ratio = 1.0
784
785
is_in_frame = js_utils .is_in_frame (driver )
785
786
if is_in_frame and driver .is_element_present ("#challenge-stage" ):
786
787
driver .switch_to .parent_frame ()
@@ -791,6 +792,20 @@ def _uc_gui_click_captcha(
791
792
page_actions .switch_to_window (
792
793
driver , driver .current_window_handle , 2 , uc_lock = False
793
794
)
795
+ if IS_WINDOWS :
796
+ window_rect = driver .get_window_rect ()
797
+ width = window_rect ["width" ]
798
+ height = window_rect ["height" ]
799
+ win_x = window_rect ["x" ]
800
+ win_y = window_rect ["y" ]
801
+ scr_width = pyautogui .size ().width
802
+ driver .maximize_window ()
803
+ win_width = driver .get_window_size ()["width" ]
804
+ width_ratio = round (float (scr_width ) / float (win_width ), 2 ) + 0.01
805
+ if width_ratio < 0.45 or width_ratio > 2.55 :
806
+ width_ratio = 1.01
807
+ driver .minimize_window ()
808
+ driver .set_window_rect (win_x , win_y , width , height )
794
809
if ctype == "cf_t" :
795
810
if (
796
811
driver .is_element_present (".cf-turnstile-wrapper iframe" )
@@ -1015,6 +1030,18 @@ def _uc_gui_handle_captcha(
1015
1030
page_actions .switch_to_window (
1016
1031
driver , driver .current_window_handle , 2 , uc_lock = False
1017
1032
)
1033
+ if IS_WINDOWS and hasattr (pyautogui , "getActiveWindowTitle" ):
1034
+ py_a_g_title = pyautogui .getActiveWindowTitle ()
1035
+ window_title = driver .title
1036
+ if not py_a_g_title .startswith (window_title ):
1037
+ window_rect = driver .get_window_rect ()
1038
+ width = window_rect ["width" ]
1039
+ height = window_rect ["height" ]
1040
+ win_x = window_rect ["x" ]
1041
+ win_y = window_rect ["y" ]
1042
+ driver .minimize_window ()
1043
+ driver .set_window_rect (win_x , win_y , width , height )
1044
+ time .sleep (0.33 )
1018
1045
if ctype == "cf_t" :
1019
1046
if (
1020
1047
driver .is_element_present (".cf-turnstile-wrapper iframe" )
0 commit comments