import time from appium import webdriver class Testcase(object): def test_start(self): app_params = {} app_params['platformName'] = 'Android' app_params['platformVersion'] = '10' app_params['appPackage'] = 'com.kuaishou.webview' app_params['appActivity'] = 'org.chromium.android_webview.services.VariationsSeedServer' app_params['deviceName'] = 'd0d301ff' app_params['noReset'] = True app_params['noSign'] = 'true' self.driver = webdriver.Remote('http://localhost:4723/wd/hub', app_params) time.sleep(3) lenth = self.driver.get_window_size() print(f"获取当前屏幕的size{lenth}") x1 = lenth['width'] * 0.5 # x坐标 y1 = lenth['height'] * 0.75 # 起始y坐标 y2 = lenth['height'] * 0.25 # 终点y坐标 for i in range(3): self.driver.swipe(x1, y1, x1, y2) self.driver.quit()