当前位置: 首页 > 工具软件 > Python QQ > 使用案例 >

python QQ自动添加好友

宋运锋
2023-12-01

QQ自动添加好友

`
#导入工具包
import os
import pyautogui
import time
from pymysql import *

#qq启动文件地址
Path = r’D:\Program Files (x86)\Tencent\QQ\Bin\QQScLauncher.exe’
os.startfile(Path)
time.sleep(6)
#移动鼠标点击登录按钮
pyautogui.moveTo(960, 670)
pyautogui.click()
time.sleep(6)
#登录完成点击加好友
pyautogui.moveTo(1577, 817)
pyautogui.click()
time.sleep(1)
qq = 123456789
#清除输入框内容
for i in range(15):
pyautogui.press(“backspace”)
#填写QQ号码
pyautogui.typewrite(message=qq, interval=0.2)
#点击搜索
pyautogui.moveTo(1145, 328)
pyautogui.click()
time.sleep(1)
#点击加好友按钮
pyautogui.moveTo(634, 496)
pyautogui.click()
time.sleep(1)
#点击下一步
pyautogui.moveTo(1070, 680)
pyautogui.click()
time.sleep(0.5)
pyautogui.click()
pyautogui.moveTo(1150, 680)
pyautogui.click()
#鼠标重新定位到输入框
pyautogui.moveTo(710, 320)
pyautogui.click()
print(“添加QQ:” + str(qq) + “成功”)
time.sleep(3)
`

 类似资料: