小米手機滑屏操作-appium自動化報錯Injecting to another application requires INJECT_EVENTS permission


APP自動化測試python+appium+selenium

滑屏操作練習

代碼如下:

# 等待元素出現
loc = (MobileBy.ANDROID_UIAUTOMATOR,'new UiSelector().text("跨部門溝通,完全0障礙")')
WebDriverWait(driver,20).until(EC.visibility_of_element_located(loc))

# 練習
size = driver.get_window_size()
# 從右向左滑
start_x = size['width'] * 0.9
start_y = size['height'] * 0.5

end_x = size['width'] * 0.1
end_y = size['height'] * 0.5

driver.swipe(start_x,start_y,end_x,end_y,300)

運行后報錯:selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Injecting to another application requires INJECT_EVENTS permission

百度后了解到應該是小米手機需開啟usb調試安全設置


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM