>>importpyautogui>>>screenWidth,screenHeight=pyautogui.size()>>>currentMouseX,currentMouseY=pyautogui.position()>>>pyautogui.moveTo(100,150)>>>pyautogui.c" />

欧美三区_成人在线免费观看视频_欧美极品少妇xxxxⅹ免费视频_a级毛片免费播放_鲁一鲁中文字幕久久_亚洲一级特黄

python PyAutoGUI 模擬鼠標(biāo)鍵盤(pán)操作和截屏功能

系統(tǒng) 1644 0

簡(jiǎn)介

一款跨平臺(tái)/無(wú)依賴(lài)的自動(dòng)化測(cè)試工具,目測(cè)只能控制鼠標(biāo)/鍵盤(pán)/獲取屏幕尺寸/彈出消息框/截屏。

安裝

pip install pyautogui

鼠標(biāo)鍵盤(pán)控制

            
 >>> import pyautogui
  >>> screenWidth, screenHeight = pyautogui.size()
  >>> currentMouseX, currentMouseY = pyautogui.position()
  >>> pyautogui.moveTo(100, 150)
  >>> pyautogui.click()
  >>> pyautogui.moveRel(None, 10) # move mouse 10 pixels down
  >>> pyautogui.doubleClick()
  >>> pyautogui.moveTo(500, 500, duration=2, tween=pyautogui.tweens.easeInOutQuad) # use tweening/easing function to move mouse over 2 seconds.
  >>> pyautogui.typewrite('Hello world!', interval=0.25) # type with quarter-second pause in between each key
  >>> pyautogui.press('esc')
  >>> pyautogui.keyDown('shift')
  >>> pyautogui.typewrite(['left', 'left', 'left', 'left', 'left', 'left'])
  >>> pyautogui.keyUp('shift')
  >>> pyautogui.hotkey('ctrl', 'c')
          

顯示消息彈出框

            
 >>> import pyautogui
  >>> pyautogui.alert('This is an alert box.')
  'OK'
  >>> pyautogui.confirm('Shall I proceed?')
  'Cancel'
  >>> pyautogui.confirm('Enter option.', buttons=['A', 'B', 'C'])
  'B'
  >>> pyautogui.prompt('What is your name?')
  'Al'
  >>> pyautogui.password('Enter password (text will be hidden)')
  'swordfish'
          

截屏

            
  >>> import pyautogui
  >>> im1 = pyautogui.screenshot()
  >>> im1.save('my_screenshot.png')
  >>> im2 = pyautogui.screenshot('my_screenshot2.png')
          

定位截屏

            
  >>> import pyautogui
  >>> button7location = pyautogui.locateOnScreen('button.png') # returns (left, top, width, height) of matching region
  >>> button7location
  (1416, 562, 50, 41)
  >>> buttonx, buttony = pyautogui.center(button7location)
  >>> buttonx, buttony
  (1441, 582)
  >>> pyautogui.click(buttonx, buttony) # clicks the center of where the button was found
          

參考

http://pyautogui.readthedocs.io/en/latest/index.html
https://github.com/asweigart/pyautogui
https://github.com/asweigart/sushigoroundbot

總結(jié)

以上所述是小編給大家介紹的python PyAutoGUI 模擬鼠標(biāo)鍵盤(pán)操作和截屏功能,希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)歡迎給我留言,小編會(huì)及時(shí)回復(fù)大家的!


更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號(hào)聯(lián)系: 360901061

您的支持是博主寫(xiě)作最大的動(dòng)力,如果您喜歡我的文章,感覺(jué)我的文章對(duì)您有幫助,請(qǐng)用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長(zhǎng)非常感激您!手機(jī)微信長(zhǎng)按不能支付解決辦法:請(qǐng)將微信支付二維碼保存到相冊(cè),切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對(duì)您有幫助就好】

您的支持是博主寫(xiě)作最大的動(dòng)力,如果您喜歡我的文章,感覺(jué)我的文章對(duì)您有幫助,請(qǐng)用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長(zhǎng)會(huì)非常 感謝您的哦!!!

發(fā)表我的評(píng)論
最新評(píng)論 總共0條評(píng)論
主站蜘蛛池模板: 日本免费黄色 | 鲁丝片一区二区三区免费 | 亚洲国产片高清在线观看 | 久草免费在线观看 | 久久精品无码一区二区日韩av | 亚洲国产欧洲精品路线久久 | 高清国产激情视频在线观看 | 超级碰碰碰频视频免费观看 | 国产一区二区三区日韩欧美 | 亚洲一区二区视频在线观看 | 免费黄网站在线看 | 黄工厂精品视频在线观看 | 国产精品黄 | 国产精品果冻麻豆精东天美 | 成人久久18免费游戏网站 | 色www精品视频在线观看 | 日韩免费视频一区二区 | 九九精品在线 | 天天天天天天天操 | 亚洲综合在线另类色区奇米 | 亚洲第一精品在线 | 免费黄色av | 欧美老妇交乱视频 | 特黄特色的免费大片看看 | 亚洲第一男人天堂 | 奇米色第四色 | 久草观看视频 | 九九re6精品视频在线观看 | 国产xxx在线观看 | 欧美精品一区在线发布 | 精品自拍视频 | 亚洲国产精品一区二区久久 | 免费视频精品一区二区 | 天天做天天爱天天综合网 | 性夜影院爽黄a免费视频 | 国产特级毛片AAAAAAA高清 | 91在线 | porny | 欧美 | 色无极在线观看 | 欧美大片在线看免费观看 | 99精品丰满人妻无码A片 | 亚洲一区二区三 |