weditor的基本操作
什么是Activity?
Activity是Android系统中的四大组件之一,可以用于显示View。Activity是一个与用户交互的系统模块
An activity is a single, focused thing that the user can do. Almost all activities interact with the user, so the Activity class takes care of creating a window for you in which you can place your UI with setContentView(View).
Activity的控件
- TextView 显示文字
- EditText 输入框
- ImageView 显示图片
- Button 按钮
- CheckBox 复选框
- RadioButton 单选按钮
weditor的使用
安装
pip install weditor -i https://pypi.douban.com/simple在命令行输入 weditor
weditor的界面包括
- 移动设备选择区
- 控件属性区域
- 代码展示区
- 层级关系和结果展示区域
UiSelector和控件定位
定位方式
1 UiSelector
2 Xpath
Andrid基本布局
线性布局 linearLayout相对布局 RelativelLayout帧布局 FrameLayout表格布局 TableLayout绝对布局 AbsoluteLayout
控件的属性
| index | int | 索引 | 0 |
|---|---|---|---|
| instance | int | 实例 | 5 |
| class | Sting | 类名 | android.widget.TextView |
| package | Sting | 包名 | com.tl.kaoyan |
| check | boolean | 控件勾选状态 | false/true |
| enable/clickable | boolean | 控件可点击 | false/true |
| focused/focusable | boolean | 焦点 | false/true |
| Scrollable | boolean | 滚动条 | false/true |
| Long-clickable | boolean | 长按 | false/true |
| selected | boolean | 选择状态 | false/true |
文本定位的方式
Text 全文本匹配
textContains 文本包含
textMatches 正则表达式
textStartsWith 起始文本
ClassName定位的方式
className classNmae的值
classNameMatches 正则表达式匹配 classNmae的值
资源id进行定位
resourcdId 资源id
混合定位的方式
文本定位 资源id ClassName等可以配合使用来进行定位
坐标点定位法
坐标点定位法分为2种方式 一种是通过原始的坐标点来呈现。一种是通过%号的方式来呈现
xpath定位的方式
d.xpath(‘xpath语句’)
