一、表格数据获取
- Get Table Cell 【locator | row | col】 获取表格数据
Open Browser file:///D:/HBuilderX/workspace/Projects/student_msg.html gc ${msg} Get Table Cell xpath=/html/body/table 2 1 #获取第二行第一列数据 log ${msg} #结果如下 20200312 13:49:51.753 : INFO : ${msg} = 密码 20200312 13:49:51.753 : INFO : 密码
二、表格断言
- Table Cell Should Contain 【locator | row | column | expected】
- 断言表格包含文本内容
Open Browser file:///D:/HBuilderX/workspace/Projects/student_msg.html gc Sleep 1 Table Cell Should Contain xpath=/html/body/table 2 1 密码 #断言表格第二行第一列内容为 "密码" #结果如下 20200312 13:57:14.254 : INFO : Table cell contains '密码'.
- Table Column Should Contain 【locator | column | expected】
- 断言表格某列包含文本内容
Open Browser file:///D:/HBuilderX/workspace/Projects/student_msg.html gc Sleep 1 Table Column Should Contain xpath=/html/body/table 1 密码 Table Column Should Contain xpath=/html/body/table 1 性别 #断言表格第一列表包含 "密码" 和 "性别"
- Table Row Should Contain 【locator | row | expected】
- 断言表格某行包含文本内容
Open Browser file:///D:/HBuilderX/workspace/Projects/student_msg.html gc Sleep 1 Table Row Should Contain xpath=/html/body/table 1 用户名 #断言表格第一行包含 "用户名"
- Table Should Contain 【locator | expected】
- 断言表格包含内容
Open Browser file:///D:/HBuilderX/workspace/Projects/student_msg.html gc Sleep 1 Table Should Contain xpath=/html/body/table 用户名 #断言表格中包含 "用户名"