python 實(shí)現(xiàn)手機(jī)自動撥打電話的方法(通話壓力測試)
現(xiàn)在能用自動化實(shí)現(xiàn)的,盡量使用自動化程序去操作,代替人工去操作,更有效率。
今天說下用python結(jié)合adb命令去實(shí)現(xiàn)安卓手機(jī)端的通話壓力測試。
#操作前先在設(shè)置里打開power鍵可以結(jié)束通話按鈕,否則會導(dǎo)致代碼報(bào)錯 from time import sleep import os def test_call(number1,number2,number3,number4,number5): #撥打電話 call = os.popen('adb shell am start -a android.intent.action.CALL -d tel:{}'.format(number1)) sleep(20) #掛斷電話 Hangup = os.popen('adb shell input keyevent 26') sleep(5) call = os.popen('adb shell am start -a android.intent.action.CALL -d tel:{}'.format(number2)) sleep(5) # 掛斷電話 Hangup = os.popen('adb shell input keyevent 26') sleep(5) call = os.popen('adb shell am start -a android.intent.action.CALL -d tel:{}'.format(number3)) sleep(20) # 掛斷電話 Hangup = os.popen('adb shell input keyevent 26') sleep(5) call = os.popen('adb shell am start -a android.intent.action.CALL -d tel:{}'.format(number4)) sleep(20) # 掛斷電話 Hangup = os.popen('adb shell input keyevent 26') sleep(5) call = os.popen('adb shell am start -a android.intent.action.CALL -d tel:{}'.format(number5)) sleep(20) # 掛斷電話 Hangup = os.popen('adb shell input keyevent 26') sleep(2) #你可以修改你要通話的號碼如下: number1 = 10010 number2 = 10086 number3 = 10011 number4 = 12580 number5 =114 #執(zhí)行代碼: test_call(number1,number2,number3,number4,number5) #截圖 ScreenShot = os.popen('adb shell /system/bin/screencap -p /sdcard/xie.png') #將截圖保存到電腦 SaveScreenShot = os.popen('adb pull /sdcard/xie.png')
以上這篇python 實(shí)現(xiàn)手機(jī)自動撥打電話的方法(通話壓力測試)就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持腳本之家。
相關(guān)文章
vscode中配置jupyter的詳細(xì)步驟(徹底解決Failed?to?start?the?Kernel問題)
自從vscode出了支持jupyter?notebook的功能之后,我就再也沒有傻傻的用瀏覽器開過jupyter(問就是vscode好看),下面這篇文章主要給大家介紹了關(guān)于vscode中配置jupyter(徹底解決Failed?to?start?the?Kernel問題)的相關(guān)資料,需要的朋友可以參考下2022-12-12python打開url并按指定塊讀取網(wǎng)頁內(nèi)容的方法
這篇文章主要介紹了python打開url并按指定塊讀取網(wǎng)頁內(nèi)容的方法,涉及Python操作URL及網(wǎng)頁內(nèi)容的技巧,非常具有實(shí)用價(jià)值,需要的朋友可以參考下2015-04-04Python數(shù)據(jù)類型詳解(三)元祖:tuple
本文給大家介紹的是Python數(shù)據(jù)類型中的元祖(tuple),簡單的說Tuple,與列表一樣,元素也是不可變的,但與列表不同,在一個元祖可以包含不同類型的元素2016-05-05Python實(shí)現(xiàn)微信好友的數(shù)據(jù)分析
這篇文章主要為大家詳細(xì)介紹了Python實(shí)現(xiàn)微信好友的數(shù)據(jù)分析,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2019-12-12