目录
一、swip滑动事件
# This sample code uses the Appium python client # pip install Appium-Python-Client # Then you can paste this into a file and simply run with Python from appium import webdriver caps = {} caps["platformName"] = "Android" caps["deviceName"] = "127.0.0.1:62001" caps["appPackage"] = "com.android.settings" caps["appActivity"] = "com.android.settings.Settings" driver = webdriver.Remote("http://localhost:4723/wd/hub", caps) driver.swipe(188, 659, 148, 248, 5000)
二、scroll滑动事件
# This sample code uses the Appium python client # pip install Appium-Python-Client # Then you can paste this into a file and simply run with Python from appium import webdriver caps = {} caps["platformName"] = "Android" caps["deviceName"] = "127.0.0.1:62001" caps["appPackage"] = "com.android.settings" caps["appActivity"] = "com.android.settings.Settings" driver = webdriver.Remote("http://localhost:4723/wd/hub", caps) driver.swipe(188, 659, 148, 248, 5000) # 定位到存储菜单栏 el1 = driver.find_element_by_xpath("//*[contains(@text,'存储')]") # 定位到WLAN菜单栏 el2 = driver.find_element_by_xpath("//*[contains(@text,'WLAN')]") # 执行滑动操作 driver.scroll(el1, el2)
三、drag拖拽事件
# This sample code uses the Appium python client # pip install Appium-Python-Client # Then you can paste this into a file and simply run with Python from appium import webdriver caps = {} caps["platformName"]