不知道大家用Python+uiautomator2+weditor在做UI自動化的時候打開有沒有遇到過類似的錯誤
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
在weditor上表現爲:
在dos窗口爲:
問題解決
這是因爲ATX的服務停止了:
但是奇怪的是在ATX並沒有開啓服務的按鈕,這個時候我們需要用adb命令進入手機,手動開啓服務
第一步:確保手機連接
adb devices
第二部:進入手機
adb shell
第三步:開啓服務
/data/local/tmp/atx-agent server -d
這個時候服務就開啓成功了:
此時運行
python -m weditor
就可以正常連接,開啓UI自動化之旅了,具體實戰技巧請看:
Python+uiautomator2+weditor UI自動化測試實戰(2):項目實戰