Robotium中文api(一)By类

来源:互联网 发布:c语言\n什么意思 编辑:程序博客网 时间:2024/06/06 15:50

忘记在那个版本了 robotium就对web识别做了支持,跟selenium的原理是一样的,根据html的属性、Dom路径去获取对应的元素信息,具体方法如下

className(String className) 根据className属性获取webElement
参数:className
返回值:className对象cssSelector(String selectors) 根据css获取web元素
参数:css 选择器
返回值:css 选择器对象getValue() 返回的value

返回值:String value

id(String id) 根据id获取web元素
参数:id值
返回值:id对象name(String name)根据name获取webElement
参数:name的值
返回值:name对象tagName(String tagName) 根据tagName获取webElement
参数:tagName的值
返回值:name的值textContent(String textContent) 使用textContent来获取webElement(可以使用正则表达式)
参数:text的值 String类型
返回值:text对象xpath(String xpath) 使用xpath来获取webElement
参数:xpath的值
返回值:xpath对象
0 0