连续复制
一键复制
一键打包
数据提取
根据jsonpath提取内容
${extract.jsonpath(resp.json,'$.code')}根据正则表达式提取内容
${extract.regx(resp.html,'<title>(.*?)</title>')}根据正则表达式提取内容
${extract.regx(resp.html,'<title>(.*?)</title>',1)}根据正则表达式提取内容
${extract.regx(resp.html,'<a href=\"(.*?)\">(.*?)</a>',[1,2])}根据正则表达式提取内容
${extract.regxs(resp.html,'<h2>(.*?)</h2>')}根据正则表达式提取内容
${extract.regxs(resp.html,'<h2>(.*?)</h2>',1)}根据正则表达式提取内容
${extract.regxs(resp.html,'<a href=\"(.*?)\">(.*?)</a>',[1,2])}根据xpath提取内容
${extract.xpath(resp.element(),'//title/text()')}根据xpath提取内容
${extract.xpath(resp.html,'//title/text()')}根据xpaths提取内容
${extract.xpaths(resp.element(),'//h2/text()')}根据xpaths提取内容
${extract.xpaths(resp.html,'//h2/text()')}根据css选择器提取内容
${extract.selectors(resp.html,'div > a')}根据css选择器提取内容
${extract.selector(resp.html,'div > a','text')}根据css选择器提取内容
${extract.selector(resp.html,'div > a','attr','href')}根据css选择器提取内容
${extract.selector(resp.html,'div > a')}根据css选择器提取内容
${extract.selectors(resp.html,'div > a','element')}根据css选择器提取内容
${extract.selectors(resp.html,'div > a','attr','href')}base64常用方法
根据byte[]进行base64加密
${base64.encode(resp.bytes)}根据String进行base64加密
${base64.encode(resp.bytes,'UTF-8')}根据String进行base64加密
${base64.encode(resp.html)}根据byte[]进行base64加密
${base64.encodeBytes(resp.bytes)}根据String进行base64加密
${base64.encodeBytes(resp.html,'UTF-8')}根据String进行base64加密
${base64.encodeBytes(resp.html)}根据String进行base64解密
${base64.decode(resp.html)}根据byte[]进行base64解密
${base64.decode(resp.bytes)}根据String进行base64解密
${base64.decodeString(resp.html)}根据byte[]进行base64解密
${base64.decodeString(resp.bytes)}根据byte[]进行base64解密
${base64.decodeString(resp.bytes,'UTF-8')}日期常用方法
格式化日期1
${date.format(date.now())}格式化日期2
${date.format(1569059534000l)}格式化日期3
${date.format(date.now(),'yyyy-MM-dd')}格式化日期4
${date.format(1569059534000l,'yyyy-MM-dd')}字符串转为日期类型
${date.parse('2019-01-01 00:00:00')}字符串转为日期类型
${date.parse('2019-01-01','yyyy-MM-dd')}数字为日期类型
${date.parse(1569059534000l)}获取当前时间
${date.now()}获取指定日期n年后的日期
${date.addYears(date.now(),2)}获取指定日期n月后的日期
${date.addMonths(date.now(),2)}获取指定日期n天后的日期
${date.addDays(date.now(),2)}获取指定日期n小时后的日期
${date.addHours(date.now(),2)}获取指定日期n分钟后的日期
${date.addMinutes(date.now(),2)}获取指定日期n秒后的日期
${date.addSeconds(date.now(),2)}file常用方法
写出文件1
${file.write('e:/result.html',resp.html,false)}写出文件2
${file.write('e:/result.html',resp.html,'UTF-8',false)}写出文件3
${file.write('e:/result.html',resp.stream,false)}写出文件4
${file.write('e:/result.html',resp.bytes,false)}写出文件5
${file.write('e:/result.html',resp.html)}写出文件6
${file.write('e:/result.html',resp.html,'UTF-8')}写出文件7
${file.write('e:/result.html',resp.bytes)}下载Url资源1
${file.download('e:/downloadPath',urls)}下载Url资源2
${file.download('e:/downloadPath',urls)}读取文件1
${file.bytes('e:/result.html')}读取文件2
${file.string('e:/result.html','UTF-8')}读取文件3
${file.string('e:/result.html')}json常用方法
将字符串转为json对象
${json.parse('{code : 1}')}将对象转为json字符串
${json.stringify(objVar)}list常用方法
获取list的长度
${list.length(listVar)}分割List
${list.split(listVar,10)}截取List
${list.sublist(listVar,fromIndex,toIndex)}过滤字符串list元素
${listVar.filterStr(pattern)}MD5常用方法
md5加密1
${md5.string(resp.html)}md5加密2
${md5.string(resp.bytes)}md5加密3
${md5.string(resp.stream)}md5加密4
${md5.bytes(resp.html)}md5加密5
${md5.bytes(resp.bytes)}md5加密6
${md5.bytes(resp.stream)}随机数生成方法
随机获取int
${random.randomInt(1,10)}随机获取double
${random.randomDouble(1,10)}随机获取long
${random.randomLong(1,10)}随机获取字符串
${random.string('abcde',10)}string常用方法
截取字符串方法1
${string.substring(str,5)}截取字符串方法2
${string.substring(str,0,str.length() - 1)}将字符串转为小写
${string.lower(str)}将字符串转为大写
${string.upper(str)}查找指定字符在字符串在中的位置
${string.indexOf(content,str)}查找指定字符在字符串中最后出现的位置
${string.lastIndexOf(content,str)}查找指定字符在字符串在中的位置
${string.indexOf(content,str,fromIndex)}将字符串转为int
${string.toInt(value)}将字符串转为Integer
${string.toInt(value,defaultValue)}字符串替换
${string.replace(content,source,target)}正则替换字符串
${string.replaceAll(content,regx,target)}正则替换字符串
${string.replaceFirst(content,regx,target)}正则替换字符串
${string.length(content)}去除字符串两边的空格
${string.trim(content)}分割字符串
${string.split(content,regx)}获取字符串的byte[]
${string.bytes(content)}获取字符串的byte[]
${string.bytes(content,charset)}byte[]转String
${string.newString(bytes)}byte[]转String
${string.newString(bytes,charset)}判断两个字符串是否相同
${string.newString(bytes,charset)}生成UUID
${string.uuid()}生成多个UUID
${string.uuid(size)}thread常用方法
线程休眠
${thread.sleep(1000L)}url操作
获取url参数
${url.parameter('http://www.baidu.com/s?wd=spider-flow','wd')}获取url全部参数
${url.parameterMap('http://www.baidu.com/s?wd=spider-flow&abbr=sf')}url编码1
${url.encode('http://www.baidu.com/s?wd=spider-flow')}url编码2
${url.encode('http://www.baidu.com/s?wd=spider-flow','UTF-8')}url解码3
${url.decode(strVar)}url解码4
${url.decode(strVar,'UTF-8')}组件
redis
选择数据源
${redis.use('aliasName')}或${redis.aliasName}获取数据
${redis.local.get(data[i].messageId)}设置数据
${redis.local.setex(data[i].messageId,3600*24*30,true)} oss
上传1
${resp.bytes.ossUpload('oss_id(配置的主键)','static/1.jpg')} 上传2
${'http://1.jpg'.ossUpload('oss_id(配置的主键)','static/1.jpg')}删除
${'static/1.jpg'.ossDelete()}扩展函数
Array
获取数组的长度
${arrayVar.size()}将数组拼接起来
${arrayVar.join()}将数组用separator拼接起来
${arrayVar.join('-')}将数组转为List
${arrayVar.toList()}Date
格式化日期
${dateVar.format()}格式化日期
${dateVar.format('yyyy-MM-dd HH:mm:ss')}Element
根据xpath提取内容
${elementVar.xpath('//title/text()')}根据xpath提取内容
${elementVar.xpaths('//h2/text()')}根据正则表达式提取内容
${elementVar.regx('<title>(.*?)</title>')}根据正则表达式提取内容
${elementVar.regx('<title>(.*?)</title>',1)}根据正则表达式提取内容
${elementVar.regx('<a href=\"(.*?)\">(.*?)</a>',[1,2])}根据正则表达式提取内容1
${elementVar.regxs('<h2>(.*?)</h2>')}根据正则表达式提取内容2
${elementVar.regxs('<h2>(.*?)</h2>',1)}根据正则表达式提取内容3
${elementVar.regxs('<a href=\"(.*?)\">(.*?)</a>',[1,2])}根据css选择器提取内容
${elementVar.selector('div > a')}根据css选择器提取内容
${elementVar.selectors('div > a')}获取同级节点
${elementVar.subling()}获取上级节点
${elementVar.parent()}获取上级节点
${elementVar.parents()}List
获取list的长度
${listVar.length()}将list拼接起来
${listVar.join()}将list用separator拼接起来
${listVar.join('-')}将list<String>排序
${listVar.sort()}将list打乱顺序
${listVar.shuffle()}Map
将map转换为List
${mapmVar.toList('=')}Object
将对象转为string类型
${objVar.string()}根据jsonpath提取内容
${objVar.jsonpath('$.code')}睡眠等待一段时间
${objVar.sleep(1000)}Response
将请求结果转为Element对象
${resp.element()}根据xpath在请求结果中查找
${resp.xpath('//title/text()')}根据xpath在请求结果中查找
${resp.xpaths('//a/@href')}根据正则表达式提取请求结果中的内容1
${resp.regx('<title>(.*?)</title>')}根据正则表达式提取请求结果中的内容2
${resp.regx('<a href=\"(.*?)\">(.*?)</a>',[1,2])}根据正则表达式提取请求结果中的内容3
${resp.regxs('<h2>(.*?)</h2>根据正则表达式提取请求结果中的内容4
${resp.regxs('<h2>(.*?)</h2>',1)}根据正则表达式提取请求结果中的内容
${resp.regxs('<a href=\"(.*?)\">(.*?)</a>',[1,2])}根据css选择器提取请求结果
${resp.selector('div > a')}根据css选择器提取请求结果
${resp.selectors('div > a')}根据jsonpath提取请求结果
${resp.jsonpath('$.code')}获取页面上的链接
${resp.links()}获取页面上的链接
${resp.links('https://www\\.xxx\\.com/xxxx/(.*?)')}获取当前页面所有图片链接
${resp.images()}Sql
下一指针
${rs.nextToMap()}String
根据正则表达式提取String中的内容1
${strVar.regx('<title>(.*?)</title>')}根据正则表达式提取String中的内容2
${strVar.regx('<title>(.*?)</title>',1)}根据正则表达式提取String中的内容3
${strVar.regx('<a href=\"(.*?)\">(.*?)</a>',[1,2])}根据正则表达式提取String中的内容4
${strVar.regxs('<h2>(.*?)</h2>')}根据正则表达式提取String中的内容5
${strVar.regxs('<h2>(.*?)</h2>',1)}根据正则表达式提取String中的内容6
${strVar.regxs('<a href=\"(.*?)\">(.*?)</a>',[1,2])}根据xpath在String变量中查找
${strVar.xpath('//title/text()')}根据xpath在String变量中查找
${strVar.xpaths('//a/@href')}将String变量转为Element对象
${strVar.element()}根据css选择器提取1
${strVar.selector('div > a')}根据css选择器提取2
${strVar.selectors('div > a')}将string转为json对象
${strVar.json()}根据jsonpath提取内容
${strVar.jsonpath('$.code')}将字符串转为int类型
${strVar.toInt(0)}将字符串转为int类型
${strVar.toInt()}将字符串转为double类型
${strVar.toDouble()}将字符串转为long类型
${strVar.toLong()}将字符串转为date类型
${strVar.toDate('yyyy-MM-dd HH:mm:ss')}反转义字符串
${strVar.unescape()}
评论已关闭