from init_driver.Init_driver import init_driver driver = init_driver() # 坐标-->坐标,定位滑动 driver.swipe(309, 1353, 537, 511, duration=3000) # 元素-->元素,定位滑动 start_ele = driver.find_element_by_xpath("//*[contains(@text, '通知管理')]") end_ele = driver.find_element_by_xpath("//*[contains(@text, '飞行模式')]") driver.scroll(start_ele, end_ele) # 继续滑动 start_ele = driver.find_element_by_xpath("//*[contains(@text, '隐私授权')]") end_ele = driver.find_element_by_xpath("//*[contains(@text, '通知管理')]") driver.scroll(start_ele, end_ele) # 元素-->元素,第二个元素替换第一个元素的位置, 元素位置替换 start_ele = driver.find_element_by_xpath("//*[contains(@text, '通知管理')]") end_ele = driver.find_element_by_xpath("//*[contains(@text, '飞行模式')]") driver.drag_and_drop(start_ele, end_ele) # 应用置于后台,模拟热启动 driver.background_app(5)