appium学习总结8 - 与app互动(移动鼠标、触碰屏幕)

1、移动鼠标的操作

1.1 将鼠标移动到

actions = ActionChains(self.driver)
actions.move_to(element, 10, 10)
actions.perform()

如果未指定任何元素,则移动相对于当前鼠标光标。
如果提供了一个元素但没有偏移,则鼠标将移动到元素的中心。
如果元素不可见,它将滚动到视图中。

1.2 在当前鼠标坐标处单击任意鼠标按钮

actions = ActionChains(self.driver)
actions.move_to_element(element)
actions.click()
actions.perform()

1.3 双击当前鼠标坐标(由 moveto 设置)

actions = ActionChains(self.driver)
actions.move_to_element(element)
actions.double_click()
actions.perform()

1.4 在当前鼠标坐标处单击并按住鼠标左键

actions = ActionChains(self.driver)
actions.move_to_element(element)
actions.click_and_hold()
actions.perform()

1.5 释放之前按住的鼠标按钮

actions = ActionChains(self.driver)
actions.move_to_element(element)
actions.click_and_hold()
actions.move_to_element(element, 10, 10)
action.release()
actions.perform()

2、触碰屏幕的操作

2.1 手指在屏幕上单击

from appium.webdriver.common.touch_action import TouchAction
# ...
actions = TouchAction(driver)
actions.tap(element)
actions.perform()

2.2 手指在触摸屏上双击

from appium.webdriver.common.touch_action import TouchAction
# ...
actions = TouchAction(driver)
actions.double_tap(element)
actions.perform()

2.3 手指在屏幕上移动

from appium.webdriver.common.touch_action import TouchAction
# ...
actions = TouchAction(driver)
actions.tap_and_hold(element)
actions.move_to(element, 50, 50)
actions.perform()

2.4 手指在屏幕上向下

from appium.webdriver.common.touch_action import TouchAction
# ...
actions = TouchAction(driver)
actions.tap_and_hold(element)
actions.move(50, 50)
actions.perform()

2.5 手指在屏幕上 release

from appium.webdriver.common.touch_action import TouchAction
# ...
actions = TouchAction(driver)
actions.tap_and_hold(20, 20)
actions.release(50, 50)
actions.perform()

2.6 手指运动事件长按触摸屏

from appium.webdriver.common.touch_action import TouchAction
# ...
actions = TouchAction(driver)
actions.long_press(element)
actions.perform()

2.7 手指在触摸屏上滚动

from appium.webdriver.common.touch_action import TouchAction
# ...
actions = TouchAction(driver)
actions.scroll_from_element(element, 10, 100)
actions.scroll(10, 100)
actions.perform()

2.8 手指在触摸屏上轻弹

from appium.webdriver.common.touch_action import TouchAction
# ...
actions = TouchAction(driver)
actions.flick_element(element, 1, 10, 10)
actions.perform()

2.9 执行多点触控动作序列

from appium.webdriver.common.touch_action import TouchAction
from appium.webdriver.common.multi_action import MultiAction
# ...
a1 = TouchAction()
a1.press(10, 20)
a1.move_to(10, 200)
a1.release()

a2 = TouchAction()
a2.press(10, 10)
a2.move_to(10, 100)
a2.release()

ma = MultiAction(self.driver)
ma.add(a1, a2)
ma.perform()

2.10 执行触摸动作序列

from appium.webdriver.common.touch_action import TouchAction
// ...
actions = TouchAction(driver)
actions.tap_and_hold(20, 20)
actions.move_to(10, 100)
actions.release()
actions.perform()

3 W3C actions

行一系列或多个键盘和指针(触摸、鼠标、触控笔)操作链

element = self.driver.find_element_by_accessibility_id("elId")
actions = ActionChains(self.driver)
actions.move_to_element(element)
actions.click(hidden_submenu)
actions.perform()
  • 2
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
很抱歉,作为语言模型,我无法亲自测试Appium测试APP手机安全卫士的实验结果与分析。但是,我可以为您提供一些关于Appium移动应用程序测试的信息。 Appium是一种自动化测试框架,它可以用于iOS和Android移动应用程序的UI测试。它使用WebDriver协议来控制移动设备,并使用Appium客户端库来编写测试脚本。 针对手机安全卫士的测试可以包括如下内容: 1. 安装和配置Appium环境 2. 编写测试脚本 3. 执行测试 4. 分析测试结果 在测试过程中,需要关注以下几个方面: 1. 功能测试:测试应用程序的各项功能是否正常。例如,测试手机安全卫士的病毒扫描、清理垃圾、加速手机等功能是否正常。 2. UI测试:测试应用程序的用户界面是否符合设计要求。例如,测试手机安全卫士的图标、菜单、按钮等UI元素是否正确显示。 3. 性能测试:测试应用程序的运行速度和资源占用情况。例如,测试手机安全卫士的启动时间、响应时间、内存占用等性能指标是否符合要求。 4. 兼容性测试:测试应用程序在不同的设备和操作系统版本上的兼容性。例如,测试手机安全卫士在不同的Android设备上是否正常运行。 在分析测试结果时,需要关注测试覆盖率、测试报告、性能指标等方面的数据,以便发现潜在的问题并进行改进。 总之,Appium是一种强大的移动应用程序测试框架,可以帮助开发人员和测试人员快速、准确地测试应用程序的各项功能和性能,以确保应用程序的质量和稳定性。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

阿_焦

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值