小米手机滑屏操作-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调试安全设置

猜你喜欢

转载自www.cnblogs.com/cxy-higher-0419/p/10857862.html