小米手机滑屏操作-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