小米手机滑屏操作-appium自动化报错Injecting to another application requires INJECT_EVENTS permission...

APP自动化测试滑屏操作
本文分享了使用Python结合Appium和Selenium进行APP自动化测试的滑屏操作实践,包括代码示例及解决小米手机usb调试安全设置导致的错误。

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调试安全设置

转载于:https://www.cnblogs.com/cxy-higher-0419/p/10857862.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值