• AppiumLibrary实用函数介绍


    1. 点击按钮:

    Click Button index_or_name

    Click button

    实例:Click Button index=0

    作者通过实验发现在安卓手机应用测试中,name这个属性不起作用,所以建议还是使用index属性。

    2.输入内容:

    Input Text locator, text

    Types the given text into text field identified by locator.

    See introduction for details about locating elements.

    实例:Input Text id=com.tencent.mm:id/ayc 测试账号

    作者通过实验发现安卓手机应用测试中,有许多ID相同的控件,从而定位控件只能通过XPATH来定位,不知道XPATH的同学们不用着急,在后面的篇章我会告诉大家如何用XPath来定位元素。

    3.滑动屏幕:

    Swipe start_x, start_y, end_x, end_y, duration=1000

    Swipe from one point to another point, for an optional duration.

     实例: Swipe 50  100 100  100 duration=2000

    作者的例子为横向滑动50dp,滑动时间为2秒,科普:手机的原点即(0,0)为屏幕的左上角,如果手机屏幕分辨率为480*720的,则右下角的坐标为(480,720)。

    4.放大元素:

    Zoom locator, percent=200%, steps=1

    Zooms in on an element a certain amount.

    实例: Zoom  id=com.tencent.mm:id/ayc percent=150% steps=1

    作用为将一个元素一次性放大1.5倍。

  • 相关阅读:
    uva 11294 Wedding
    uvalive 4452 The Ministers’ Major Mess
    uvalive 3211 Now Or Later
    uvalive 3713 Astronauts
    uvalive 4288 Cat Vs. Dog
    uvalive 3276 The Great Wall Game
    uva 1411 Ants
    uva 11383 Golden Tiger Claw
    uva 11419 SAM I AM
    uvalive 3415 Guardian Of Decency
  • 原文地址:https://www.cnblogs.com/chenjingyi/p/5881613.html
Copyright © 2020-2023  润新知