@@ -363,6 +363,21 @@ def _perform_random_click(self, x_abs, y_abs, use_safe_move=False, safe_move_box
363363 self .pydirect_interaction .click (down_time = _down_time )
364364
365365 self .sleep (_after_sleep )
366+
367+ def click_btn_random (self , box : Box , down_time = 0.0 , post_sleep = 0.0 , after_sleep = 0.0 ):
368+ safe_move_box = box .copy (x_offset = - box .width * 0.20 , width_offset = box .width * 8.1 ,
369+ y_offset = - box .height * 0.30 , height_offset = box .height * 0.7 , name = 'safe_move_box' )
370+ random_x = random .uniform (box .x + box .width , box .x + self .width * 0.12 )
371+ random_y = random .uniform (box .y , box .y + box .height )
372+
373+ self ._perform_random_click (
374+ random_x , random_y ,
375+ use_safe_move = True ,
376+ safe_move_box = safe_move_box ,
377+ down_time = down_time ,
378+ post_sleep = post_sleep ,
379+ after_sleep = after_sleep
380+ )
366381
367382 def click_box_random (self , box : Box , down_time = 0.0 , post_sleep = 0.0 , after_sleep = 0.0 , use_safe_move = False , safe_move_box = None , left_extend = 0.0 , right_extend = 0.0 , up_extend = 0.0 , down_extend = 0.0 ):
368383 le_px = left_extend * self .width
@@ -432,6 +447,8 @@ def rel_move_if_in_win(self, x=0.5, y=0.5, box=None):
432447 x (float): 相对 x 坐标 (0.0 到 1.0)。
433448 y (float): 相对 y 坐标 (0.0 到 1.0)。
434449 """
450+ if box is not None :
451+ self .draw_boxes (box .name , box , "blue" )
435452 if not self .is_mouse_in_window () or not self .is_mouse_in_box (box = box ):
436453 return False
437454 abs_pos = self .executor .device_manager .hwnd_window .get_abs_cords (self .width_of_screen (x ),
0 commit comments