同步操作将从 览众科技/UiAuto 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
UiAuto提供插件开发脚手架,方便UiAuto插件开发者初始化插件目录、定义插件参数。降低开发复杂度和参数定义错误导致的时间和精力浪费,有效帮助开发者专注于代码实现。
命令行执行:
npm install -g uiauto-cli // 全局安装CLI
uiauto init "plugin_name" // 在当前目录初始化名为 plugin_name 的UiAuto插件项目
执行后命令行持续请求开发者输入配置,完成配置填写后CLI自动在当前路径创建名为“plugin_name”的项目文件夹
uiauto add // 在当前目录中向已存在的插件项目新增功能
执行后命令行持续请求开发者输入配置,完成配置填写后CLI自动在当前插件项目中添加新的功能配置。但新增的功能所需的参数配置,仍需手动配置,配置方法请继续向下阅读。
插件由描述文件及入口程序组成,入口程序主要是暴露插件每个操作的执行方法(基于Java语言开发的插件的入口程序是编译打包的jar包文件)。
对于基于Python语言开发的插件,通过添加requirements.txt文件来配置依赖库。
对于基于NodeJS语言开发的插件是在package.json文件内的dependencies属性配置依赖库。
对于基于Java语言开发的插件是在编译jar包时就需要把依赖库一起打包。
描述文件内容为标准JSON格式
{
"id": "hello-world",
"name": "hello-world", // must in English,
"description": "say hello from UiAuto!",
"version": "1.0.0",
"author": "UiAuto",
"language": "nodejs",
"license": "MIT",
"dependencies": {
"lodash": "4.17.11" // depandencies of the plugin
},
"uiauto_config": {
"operations": [{
"category_id": "plugin-template", // class of the operation, sort the opterations according to this param
"category_name": "模板插件", // name of the class, if we don't have the category_id above yet, this name will be shown on front-end
"operation_id": "plugin-one",
"operation_name": "插件一",
"method": "sayHello", // if this opteration is executed, function named "sayHello" in "./index.js" ("./index.py" in python) will be activated
"type":"Convention", // we have these types yet => [Start, Condition, Convention, Circulation, Script, End]. Only Condition and Convention can be defined
"input": [{
"name": "必填属性", // label of this input group
"id": "required",
"properties": [{
"id": "addressee", // id of this input
"name": "用户名", // label of this input
"type": "text", // type of this input, you can read the detail of various types below
"required": true, // is the value required
"value": "uiauto_group" // the default value
},
{
"id": "file",
"name": "文件",
"type": "file",
"required": true,
"value": ""
}
]
}, {
"name": "可选属性",
"id": "unrequired",
"properties": [{
"id": "drink",
"name": "饮品",
"required": false,
"type": "select",
"value": "tea" // default value 「默认值」
"options": {
"multiple": true, // required option, could the user make multiple choices or not
"choices": [{
"value":"juice",
"label":"果汁"
}, {
"value":"coffee",
"label":"咖啡"
}, {
"value":"tea",
"label":"茶"
}] // enumerate groups of value and label
}
}]
}],
"output": {
"is_allow_global_use": true,
"description": "返回执行结果,true 或者 false",
"value": ""
}
}]
}
}
{
"type": "text",
"value": "default value" // 默认值
}
result: <String>
*密码文本类型的前端展示形式是 “···”
{
"type": "password",
"value": "default value" // 默认值
}
result: <String>
该类型下的文本只做展示用途,不允许编辑
{
"type": "string",
"value": "value which can not be edited"
}
result: null
该类型目前仅支持选择一个文件
{
"type": "file"
}
result: <String <filePath>>
{
"type": "color",
"value": "#c71585" // default value 「默认值」,
"options": {
"predefineColors": [
"#ff4500",
"#ff8c00",
"#ffd700",
"#90ee90",
"#00ced1",
"#1e90ff",
"#c71585",
"rgba(255, 69, 0, 0.68)",
"rgb(255, 120, 0)",
"hsv(51, 100, 98)",
"hsva(120, 40, 94, 0.5)",
"hsl(181, 100%, 37%)",
"hsla(209, 100%, 56%, 0.73)",
"#c7158577"
]
}
}
result: <String>
{
"type": "checkbox",
"value": [], // default value 「默认值」
"options": {
"checked": [] // 默认选中
}
}
result: <Array>
options.type 不同,value 需求不同,但值可被兼容,若插件需要精确到时间,但默认值没有精确到时间(不推荐),则会默认设定为世界协调时间(UTC)/格林尼治时间(GMT) 00:00:00,即若在东八时区,则默认值为 08:00:00。
{
"type": "dateTimeRange",
"value": ["2019-05-01 00:00:00", "2019-10-01 12:00:00"] // default value 「默认值」
"options": {
"type": "daterange" // "datetimerange" | "daterange" | "monthrange"
}
}
result: <Array(2)>
{
"type": "inputNumber",
"value": 10 // 默认值
}
result: <Number>
该类型的值均为不等式字符串
{
"type": "conditions",
"value": ["value1 > 10", "value2 < 50"] // 默认值
}
result: <Array>
{
"type": "dateTime",
"value": "2019-05-01 00:00:00" // default value 「默认值」
"options": {
"type": "datetime" // "datetime" | "date" | "time"
}
}
result: <String>
{
"type": "radio",
"value": "tea" // default value 「默认值」
"options": {
"choices": ["juice", "coffee", "tea"] // enumerations
}
}
result: <String>
{
"type": "select",
"value": "tea" // default value 「默认值」
"options": {
"multiple": true, // required option, could the user make multiple choices or not
"choices": [{
"value":"juice",
"label":"果汁"
}, {
"value":"coffee",
"label":"咖啡"
}, {
"value":"tea",
"label":"茶"
}] // enumerate groups of value and label
}
}
!options.multiple
: result: <String>
options.multiple
: result: <Array>
{
"type": "slider",
"value": 10 // default value 「默认值」
"options": {
"step": 10, // unrequired option, default 0
"max": 100, // maximum, default 100
"min": 0 // minimum, defalut 0
"precision": 1 // precision, defalut 1
}
}
result: <String>
{
"type": "switch",
"value": false // default value 「默认值」
}
result: <Boolean>
{
"type": "json",
"value": {
"demo_key": "demo_value"
} // default value 「默认值」
}
result: <Boolean>
{
"type": "code",
"value": "print('Hello World!')" // default value 「默认值」
}
result: <Boolean>
{
"type": "screenshot",
"value: "" // image path
}
result: <String>
{
"type":"uiselector",
"value":{
"html":{
"html":{
"class":"head_wrapper",
"text":"",
"left":0,
"top":0,
"width":810,
"height":895,
"tag":"DIV",
"parent":{
"id":"head",
"text":"",
"left":0,
"top":0,
"width":810,
"height":895,
"tag":"DIV"
},
"clientX":580,
"clientY":535,
"screenX":598,
"screenY":625,
"offsetX":18,
"offsetY":90,
"bounding_client_rect":{
"x":0,
"y":0,
"width":810,
"height":895,
"top":0,
"right":810,
"bottom":895,
"left":0
}
},
"element_screenshot":"element_1563522215.6124997.png"
}
}
}
result: <Object>
如果你在使用UiAuto进行开发的时候,需要根据使用者的输入动态渲染/隐藏某些属性输入框或想实现其他复杂的具有联动需求的输入配置,则可以通过参数 "show_if" 进行配置。
{
...
"uiauto_config": {
"operations": [{
...
"input": [{
"name": "必填属性",
"id": "required",
"properties": [{
"id": "dishType",
"name": "菜品类型",
"required": true,
"type": "select",
"value": "single" // default value 「默认值」
"options": {
"multiple": false, // required option, could the user make multiple choices or not
"choices": [{
"value":"single",
"label":"单点"
}, {
"value":"package",
"label":"套餐"
}] // enumerate groups of value and label
}
},{
"id": "stapleFood",
"name": "主食",
"required": true,
"type": "select",
"value": "friedRice" // default value 「默认值」
"options": {
"multiple": false, // required option, could the user make multiple choices or not
"choices": [{
"value":"pasta",
"label":"意大利面"
}, {
"value":"friedRice",
"label":"炒饭"
}, {
"value":"steak",
"label":"牛排"
}] // enumerate groups of value and label
}
}]
}, {
"name": "可选属性",
"id": "unrequired",
"properties": [{
"id": "drink",
"name": "饮品",
"show_if": "$input.required.dishType==='package'",
"required": false,
"type": "select",
"value": "tea" // default value 「默认值」
"options": {
"multiple": false, // required option, could the user make multiple choices or not
"choices": [{
"value":"juice",
"label":"果汁"
}, {
"value":"coffee",
"label":"咖啡"
}, {
"value":"tea",
"label":"茶"
}] // enumerate groups of value and label
}
}]
}],
"output": {
"is_allow_global_use": true,
"description": "返回执行结果,true 或者 false",
"value": ""
}
}]
}
}
以上代码在可选属性里对“饮品”属性框配置了 "show_if": "$input.required.dishType==='package'" 则控制为: 当本插件输入框id为 "required",id为 "dishType" 的输入框值为 "package" 时,显示该属性配置。 目前 "show_if" 可配置javascript规范下的表达式,其中$input是指在本插件输入属性中查找。
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。