pyautogui页面点击和键盘输入


以下程序实现了在编辑框处点击,然后用键盘输入的功能

import pyautogui
import time

time.sleep(10)

currentMouseX, currentMouseY = pyautogui.position()
print(currentMouseX,currentMouseY)  #打印鼠标位置

pyautogui.click(x=261, y=118, clicks=1,  button='left')  #绝对位置点击
pyautogui.typewrite("hello world") #键盘输入

注:键盘输入是模拟键盘输入,输入法需要在英文状态下

      目前无法实现中文的直接数据只能输入法在中文,输入后拼出啥是啥

import pyautogui
import time

time.sleep(10)

currentMouseX, currentMouseY = pyautogui.position()
print(currentMouseX,currentMouseY)  #打印鼠标位置

pyautogui.click(x=261, y=118, clicks=1,  button='left')  #绝对位置点击
pyautogui.typewrite("nihao") #键盘输入
pyautogui.press("space") #键盘输入空格


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM