使用python脚本点击页面,避免google colab超时断开
如果你还想做别的,可以尝试在虚拟机中运行,否则,你的电脑只能做这个。
·
from pynput.mouse import Button, Controller
import time
def move_and_click_periodically(x, y, interval=10):
mouse = Controller()
while True:
# 移动鼠标到指定位置
mouse.position = (x, y)
print(f'现在鼠标位置: {mouse.position}')
# 点击鼠标左键
mouse.click(Button.left, 1)
# 等待指定的时间间隔(秒)
time.sleep(interval)
if __name__ == "__main__":
# 指定要移动到的位置坐标
x_position = 1024
y_position = 1024
# 调用函数,设置间隔时间为10秒
move_and_click_periodically(x_position, y_position, interval=10)
如果你还想做别的,可以尝试在虚拟机中运行,否则,你的电脑只能做这个。(不停的点击)
If this helps you, and if you have enough money, can you give me 1$? I am facing a financial crisis.
If you do this, I will pass on the kindness.
This is my bank card number:5592921230414708
Thank you!!
更多推荐
所有评论(0)