1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
| def get_mouse_array(distance): origin_mouse_array = [ [0, 0, 0], [1, 0, 68], [2, 0, 6], [4, 0, 8], [8, 0, 9], [12, 0, 8], [16, 0, 8], [22, 0, 8], [29, 0, 8], [37, 0, 8], [45, 0, 8], [53, 0, 8], [60, 0, 8], [67, 0, 8], [74, 0, 8], [79, 0, 8], [84, -1, 8], [90, -1, 8], [94, -1, 8], [98, -2, 8], [102, -2, 8], [104, -2, 8], [107, -2, 8], [110, -2, 8], [114, -2, 8], [116, -2, 8], [118, -2, 8], [122, -2, 8], [124, -2, 8], [126, -2, 8], [128, -2, 8], [130, -2, 8], [133, -2, 8], [135, -2, 8], [137, -2, 7], [140, -2, 8], [142, -2, 9], [144, -2, 8], [147, -2, 8], [149, -2, 8], [152, -2, 8], [154, -2, 7], [156, -2, 8], [158, -2, 9], [160, -2, 8], [164, -2, 7], [166, -2, 8], [168, -2, 9], [170, -2, 8], [173, -2, 8], [175, -2, 8], [177, -2, 8], [179, -2, 8], [181, -2, 8], [184, -2, 8], [186, -2, 8], [188, -2, 8], [191, -2, 8], [193, -2, 8], [195, -2, 8], [197, -2, 8], [199, -2, 8], [202, -2, 8], [204, -2, 8], [206, -2, 8], [207, -2, 8], [208, -2, 8], [210, -2, 8], [212, -2, 7], [213, -2, 8], [214, -2, 8], [215, -2, 8], [216, -2, 9], [217, -2, 16], [218, -2, 8], [219, -2, 8], [220, -2, 8], [220, -2, 8], [221, -2, 8], [222, -2, 8], [222, -2, 8], [223, -2, 8], [224, -2, 8], [224, -2, 8], [225, -2, 8], [226, -2, 16], [226, -2, 8], [227, -2, 8], [228, -2, 8], [229, -2, 8], [230, -2, 8], [230, -2, 8], [231, -2, 8], [232, -2, 8], [233, -2, 8], [234, -2, 8], [234, -2, 8], [235, -2, 42], [236, -2, 17], [236, -3, 4], [236, -3, 9], [237, -3, 8], [238, -4, 16], [238, -4, 16], ] result = [] num = -2 while len(result) < 80: _max = random.randint(1, 10) for _ in range(1, _max): result.append(num) num -= 1 result = result[:80] print("生成的随机Y轴序列", result, len(result)) i = -1 for n in result[::-1]: origin_mouse_array[i][1] = n i -= 1
mouse_array = [] origin_distance = origin_mouse_array[-1][0] per = distance / origin_distance for i in origin_mouse_array: new_x = round(i[0] * per) new_y = round(i[1] * per) new_t = round(i[2] * per) mouse_array.append([new_x, new_y, new_t]) print("缩放后的滑动轨迹", mouse_array) return mouse_array slide_len = 440 ori_x, ori_y = 0, 0 for tu in get_mouse_array(slide_len): x, y, z = tu off_x = x - ori_x ori_x = x off_y = y - ori_y ori_y = y page.actions.move(offset_x=off_x, offset_y=off_y, duration=0) time.sleep(z / 1000)
|