APP-移动端脚本操作

目录一、swip滑动事件二、scroll滑动事件三、drag拖拽事件四、手指轻敲操作五、手指按操作六、等待操作七、手指长按操作八、手指移动操作一、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 Pytho
摘要由CSDN通过智能技术生成

目录

一、swip滑动事件

二、scroll滑动事件

三、drag拖拽事件

四、手指轻敲操作

五、手指按操作

六、等待操作

七、手指长按操作

八、手指移动操作


一、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"] 
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值