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調試安全設置
