*** Settings ***
Library AppiumLibrary
Library AutoItLibrary
Library os *** Keywords ***
xpath应该匹配次数
[Arguments] ${xpath} ${count}
Xpath Should Match X Times ${xpath} ${count} 上传文件
[Arguments] ${path} ${data} ${encode}=base64
Push File ${path} ${data} ${encode} 元素不应该包含文本
[Arguments] ${locator} ${expected} ${msg}=
Element Should not Contain Text ${locator} ${expected} ${msg} 元素值应该是
[Arguments] ${locator} ${expected}
Element Value Should Be ${locator} ${expected} 元素名应该是
[Arguments] ${path} ${name}
Element Name Should Be ${path} ${name} 元素属性应该匹配
[Arguments] ${locator} ${attr_name} ${match_pattern} ${regx}=False
Element Attribute Should Match ${locator} ${attr_name} ${match_pattern} ${regx} 元素应该包含文本
[Arguments] ${locator} ${expected} ${msg}=None
Element Should Contain Text ${locator} ${expected} ${msg} 元素应该失效
[Arguments] ${locator} ${level}=INFO
Element should be disabled ${locator} ${level} 元素应该有效
[Arguments] ${locator} ${level}=INFO
Element should be enabled ${locator} ${level} 元素文本应该是
[Arguments] ${locator} ${expected} ${msg}=None
Element Text Should Be ${locator} ${expected} ${msg} 关闭当前应用
Close Application 关闭所有应用
Close All Applications 切换应用
[Arguments] ${index_or_alias}
Switch Application ${index_or_alias} 切换页面内容
[Arguments] ${webview}
Switch To Context ${webview} 卸载应用
[Arguments] ${application_id}
Remove Application ${application_id} 后台运行
[Arguments] ${sec}
Background App ${sec} 向上滚动
[Arguments] ${locator}
Scroll Up ${locator} 向下滚动
[Arguments] ${locator}
Scroll Down ${locator} 失败后运行关键字
[Arguments] ${keyword}
[Documentation] Example: # Disables run-on-failure functionality and stores the previous kw name in a variable. # Restore to the previous keyword.
...
... Register Keyword To Run On Failure \ \ \ Log Source
... \ \ \ \ \ \ \ # Run `Log Source` on failure.
...
... ${previous kw}=
... Register Keyword To Run On Failure \ \ Nothing
...
...
... Register Keyword To Run On Failure \ \ \ \ ${previous kw} \ \ \ \
Register Keyword To Run On Failure ${keyword} 打印资源
[Arguments] ${level}
Log Source ${level} 打开URL
[Arguments] ${url}
[Documentation] Example:
...
... 打开应用
... http://localhost:4755/wd/hub \ platformName=iOS \ platformVersion=7.0
... deviceName='iPhone Simulator'
... browserName=Safari
...
... 打开URL \ http://m.webapp.com
Go To URL ${url} 打开应用
[Arguments] ${url} ${platformName} ${version} ${deviceName} ${app}
[Documentation] 打开应用 ${url} ${platformName} ${version} \ \ ${devicename} ${app} @{args}
...
... 例如:
...
... 打开应用 http://localhost:4723/wd/hub Android 5.1.1 5e25d20d ${CURDIR}${/}app${/}fft.apk
...
... ${url} 是用于访问应用的地址,一般是固定的。 url 和 端口可以根据具体地址修改。
... ${version} \ 是安卓的版本
... ${devicename} 是手机的UDID, 可以打开cmd 然后用 adb devices -l \ 看到设备列表。
... UDID 是看到的第一列的内容,真机是一串字符串,模拟器是 \ ip:port \ 的形式
... ${app} 是apk 存放的路径 ${CURDIR} 系统变量,取得当前脚本路径。 ${/} 系统变量 '/'
open application ${url} platformName=${platformName} platformVersion=${version} deviceName=${deviceName} app=${app} 按关键字
[Arguments] ${keycode} ${metastate}=None
Press Keycode ${keycode} ${metastate} 摇动手机
Shake 放大元素
[Arguments] ${locator} ${percent}=200% ${step}=1
Zoom ${locator} ${percent} ${step} 敲击元素
[Arguments] ${locator}
Tap ${locator} 横屏
[Documentation] 手机设置横屏
LANDSCAPE 清除文本
[Arguments] ${locator}
Clear Text ${locator} 滑动
[Arguments] ${start_x} ${start_y} ${end_x} ${end_y}
swipe ${start_x} ${start_y} ${end_x} ${end_y} 滚动
[Arguments] ${start_locator} ${end_locator}
[Documentation] 从一个元素滚动到另一个元素
Scroll ${start_locator} ${end_locator} 点击元素
[Arguments] ${locator}
Click Element ${locator} 点击元素坐标
[Arguments] ${coordinate_x} ${coordinate_y}
Click Element At Coordinates ${coordinate_x} ${coordinate_y} 点击固定点
[Arguments] ${x} ${y} @{args}
Click A Point ${x} ${y} @{args} 点击按钮
[Arguments] ${index_or_name}
Click Button ${index_or_name} 点击文本
[Arguments] ${text} ${exact_match}=false
[Documentation] 点击匹配到文本的元素:
...
... 点击文本 "text"
... 点击文本 "text" True
...
... 默认模糊匹配所有元素,可以设置成精确匹配。
... 如果可以匹配到两个或两个以上的元素,那么需要用 click Element 元素,去处理。
Click Text ${text} ${exact_match} 睡眠
[Arguments] ${sec}
sleep ${sec} 竖屏
PORTRAIT 等待页面元素出现
[Arguments] ${locator} ${timeout}=100 ${err}=None
Wait Until Page Contains Element ${locator} ${timeout} ${err} 等待元素出现文本
[Arguments] ${text} ${timeout}=10 ${err}=None
Wait Until Page Contains ${text} ${timeout} ${err} 等待页面不包含元素
[Arguments] ${locator} ${timeout}=10 ${err}=None
Wait Until Page Does Not Contain Element ${locator} ${timeout} ${err} 等待页面不包含文本
[Arguments] ${text} ${timeout}=10 ${err}=None
Wait Until Page Does Not Contain ${text} ${timeout} ${err} 缩小元素
[Arguments] ${locator} ${percent}=200% ${step}=1
Pinch ${locator} ${percent} ${step} 获取Appium超时时间
${timeout} Get Appium Timeout
[Return] ${timeout} 获取Web元素
[Arguments] ${locator}
[Documentation] 获取匹配的定位器的第一个元素:
...
... ${element} 获取Web元素 id=name
... 点击元素 ${element}
${element} Get Webelement ${locator}
[Return] ${element} 获取元素坐标
[Arguments] ${locator}
${location} Get Element Location ${locator}
[Return] ${location} 获取元素尺寸
[Arguments] ${locator}
${size} Get Element Size ${locator}
[Return] ${size} 获取元素属性
[Arguments] ${locator} ${name_or_value}
[Documentation] 获取元素属性:(name 或者 value)
... ${val} \ 获取元素属性 ${locator} ${name_or_value}
...
... 例如:
... ${val} 获取元素属性 id=xxxx name
... ${val} 获取元素属性 id=xxxx value
${val} Get Element Attribute ${locator} ${name_or_value}
[Return] ${val} 获取匹配xpath数
[Arguments] ${xpath}
[Documentation] 例如:
...
... ${count} \ \ \ 获取匹配xpath数 \ \ //android.view.View[@text='Test']
${count} Get Matching Xpath Count ${xpath}
[Return] ${count} 获取可见文本
${contents} Get Contexts
[Return] ${contents} 获取当前文本
${context} Get Current Context
[Return] ${context} 获取所有web元素
[Arguments] ${locator}
[Documentation] @{element} 获取所有web元素 id=my_element
... 点击元素 @{element}[2]
@{element} Get Webelements ${locator}
[Return] @{element} 获取文件
[Arguments] ${file_path} ${decode}=False
pull file ${file_path} ${decode} 获取文件夹
[Arguments] ${folder_path} ${decode}=False
Pull Folder ${folder_path} ${decode} 获取文本
[Arguments] ${locator}
[Documentation] 获取符合元素的文本:
... ${text} \ 获取文本 \ //*[contains(@text,'foo')]
${text} Get Text ${locator}
[Return] ${text} 获取网络连接情况
${stat} Get Network Connection Status
[Return] ${stat} 获取资源
${source} Get Source
[Return] ${source} 设置Appium超时
[Arguments] ${sec}
Set Appium Timeout ${sec} 设置网络连接状态
[Arguments] ${sec}
Set Network Connection Status ${sec} 输入值
[Arguments] ${locator} ${val}
Input Value ${locator} ${val} 输入密码
[Arguments] ${path} ${passwd}
Input Password ${path} ${passwd} 输入文本
[Arguments] ${path} ${text}
Input Text ${path} ${text} 返回
[Documentation] 浏览器返回上一个的页面
Go Back 重置应用
Reset Application 锁屏
[Arguments] ${sec}
[Documentation] 这个方法只使用于IOS
Lock ${sec} 长按元素
[Arguments] ${locator}
Long Press ${locator} 长按关键字
[Arguments] ${keycode} ${metastate}=None
[Documentation] keycode 可以在这个网址里面找到:
... http://developer.android.com/reference/android/view/KeyEvent.html.
...
... Args:
... \ \ \ \ - keycode - the keycode to be sent to the device
... \ \ - metastate - meta information about the keycode being sent
Long Press Keycode ${keycode} ${metastate} 隐藏键盘
Hide Keyboard 页面不应该包含元素
[Arguments] ${locator} ${lvl}=INFO
Page Should Not Contain Element ${locator} ${lvl} 页面不应该包含文本
[Arguments] ${locator} ${lvl}=INFO
Page Should Not Contain Text ${locator} ${lvl} 页面应该包含元素
[Arguments] ${locator} ${lvl}=INFO
Page Should Contain Element ${locator} ${lvl} 页面应该包含文本
[Arguments] ${locator} ${lvl}=INFO
Page Should Contain Text ${locator} ${lvl} 页面截图
[Arguments] ${filename}=
Capture Page Screenshot ${filename}

Appium关键字的更多相关文章

  1. 【python-appium】appium 关键字

    Appium 服务关键字 关键字 描述 实例 automationName 你想使用的自动化测试引擎 Appium (默认) 或 Selendroid platformName 你要测试的手机操作系统 ...

  2. appium关键字:

    ## Appium 服务关键字 <expand_table> |关键字|描述|实例||----|-----------|-------||`automationName`|你想使用的自动化 ...

  3. Appium Capabilities 详解(Android适配/IOS后续再补充)

    Appium 关键字 关键字 描述 实例 automationName 你想使用的自动化测试引擎 Appium (默认) 或 Selendroid platformName 你要测试的手机操作系统 i ...

  4. appium遇到click事件,提示"w3cStatus":400

    1.小米手机被开发借用后归还,使用该手机再进行自动化,发现appium遇到click事件,返回400 2.当时未想到是要在手机侧进行开发者选项-调试权限的设置 3.一直以为是appium的问题,app ...

  5. Appium与Appium Desktop的区别

    Appium-Server的配置,在之前的博文已有介绍,基于Python的Appium环境搭建合集,所以在此处就不详细介绍了.今天主要来分享下Appium-Server和Appium desktop在 ...

  6. 执行npm安装模块的命令 Cannot find module

    npm 安装了 appium 和 appium-doctor 运行命令,appium-doctor 提示找不到模块: C:\Users\autotest>appiummodule.js:471 ...

  7. APPcrawler基础原理解析及使用

    一.背景 一年前,我们一直在用monkey进行Android 的稳定性测试 ,主要目的就是为了测试app 是否会产生Crash,是否会有ANR,页面错误等问题,在monkey测试过程中,实现了脱离Ca ...

  8. appium-DesiredCapability详解与实战

    DesiredCapability对启动app至关重要,是启动app前的准备工作.如果配置错误,app不会成功启动. DesiredCapability有appium公共健值对.Android专有和I ...

  9. robotframework之APP混合H5自动化测试

    app中有webview的情况 手机淘宝的天猫国际页面是一个webview robotframework代码: *** Settings *** Suite Setup Suite Teardown ...

随机推荐

  1. Azure云服务托管恶意软件

    微软Azure云服务被用于托管恶意软件,可控制多达90台电脑 BleepingComputer称,在早期报道中,5月份陆续出现了两起与Azure相关的恶意软件攻击事件: 1.自5月10日以来,Azur ...

  2. mariadb数据库简介

    mariadb(默认端口3306) 什么是数据库? 白话:用来存放数据的仓库,这个仓库只不过是按照一定的数据结构来组织. 数据库模型分为三种: 层次式数据库 网络式数据库 关系型数据库和非关系数据库 ...

  3. python 反射、动态导入

    1. 反射 hasattr(obj,'name')            # 判断对象中是否含有字符串形式的方法名或属性名,返回True.False getattr(obj,'name',None)  ...

  4. VS插件CodeRush for Visual Studio发布v19.1.5|新的Inline Lambda重构

    CodeRush是一个强大的Visual Studio .NET 插件,它利用整合技术,通过促进开发者和团队效率来提升开发者体验.CodeRush能帮助你以极高的效率创建和维护源代码.Consume- ...

  5. oracle partition 分区

    --范围分区create table person( id int, name varchar2(20), birth date, sex char(2))partition by range (bi ...

  6. ZROI 19.07.30 简单字符串/ll

    写在前面:今天下午药丸--不会字符串,全程掉线/ll 给出字符串\(S\),\(q\)次询问,每次给出\(a,b,c,d\),询问\(S[a,b]\)的所有子串和\(S[c,d]\)最长公共前缀的最大 ...

  7. 初始Turtle

    ---恢复内容开始--- turtle库介绍 海龟作图最初源自20世纪60年代的Logo(创建于1967年,是一种教育编程语言)编程语言. 常用函数说明 画笔的属性 设置画笔的宽度   t.pensi ...

  8. 2019杭电多校&CCPC网络赛&大一总结

    多校结束了, 网络赛结束了.发现自己还是太菜了,多校基本就是爆零和签到徘徊,第一次打这种高强度的比赛, 全英文,知识点又很广,充分暴露了自己菜的事实,发现数学还是很重要的.还是要多刷题,少玩游戏. 网 ...

  9. LOJ-6277-数列分块入门1(分块)

    链接: https://loj.ac/problem/6277 题意: 给出一个长为 的数列,以及 个操作,操作涉及区间加法,单点查值. 思路: 线段树可以解决,用来学习分块. 分块概念就是,将序列分 ...

  10. 容器"共享"宿主机的hosts文件(终极方案)

    0.背景 有时候制作docker镜像生成容器时需要宿主机的hosts文件共享到容器中.首先想的是通过挂载的方式共享hosts文件,但是实践时发现根本行不通,hosts文件在/etc/目录下,如进行挂载 ...