阿里云社区领积分自动打卡Selenium IDE脚本

[复制链接]
发表于 2024-9-20 19:52:56 | 显示全部楼层 |阅读模式
脚本

感觉打卡比较贫苦,要点开点按钮这种机械化的操纵。
以是就自己整了个脚本:
  1. {
  2.   "id": "f9999777-9ad6-40e0-9435-4f105919c982",
  3.   "version": "2.0",
  4.   "name": "aliyun",
  5.   "url": "https://developer.aliyun.com",
  6.   "tests": [{
  7.     "id": "2178d9f7-7b83-4f03-9261-3dc1243df112",
  8.     "name": "aliyun_click",
  9.     "commands": [{
  10.       "id": "77870568-5bd0-4413-93d0-90a53cfd67ce",
  11.       "comment": "",
  12.       "command": "executeScript",
  13.       "target": "return ["弹性计算","云原生","云存储","飞天洛神云网络","数据库","PolarDB开源","大数据与机器学习","ModelScope模型即服务","云效DevOps","龙蜥操作系统"]",
  14.       "targets": [],
  15.       "value": "linkNames"
  16.     }, {
  17.       "id": "974aa7f8-2e7e-49c9-8f53-c45fbbb60129",
  18.       "comment": "",
  19.       "command": "executeScript",
  20.       "target": "return 0",
  21.       "targets": [],
  22.       "value": "index"
  23.     }, {
  24.       "id": "925dbfbc-bfa7-4954-a5e3-223ac028600b",
  25.       "comment": "",
  26.       "command": "while",
  27.       "target": "${index}<${linkNames}.length",
  28.       "targets": [],
  29.       "value": ""
  30.     }, {
  31.       "id": "3a563772-6b86-4264-bfbf-2260352b0da7",
  32.       "comment": "",
  33.       "command": "open",
  34.       "target": "/explore",
  35.       "targets": [],
  36.       "value": ""
  37.     }, {
  38.       "id": "789d4a80-0fc1-40ef-82a6-ad106d2d0226",
  39.       "comment": "",
  40.       "command": "executeScript",
  41.       "target": "return ${linkNames}[${index}]",
  42.       "targets": [],
  43.       "value": "linkName"
  44.     }, {
  45.       "id": "4997653f-febf-4ef8-ac38-90665de2ffad",
  46.       "comment": "",
  47.       "command": "click",
  48.       "target": "linkText=${linkName}",
  49.       "targets": [
  50.         ["linkText=云原生", "linkText"],
  51.         ["css=.community-list-item:nth-child(5) .community-list-item-top-name", "css:finder"],
  52.         ["xpath=(//a[contains(text(),'云原生')])[3]", "xpath:link"]
  53.       ],
  54.       "value": "",
  55.       "opensWindow": true,
  56.       "windowHandleName": "win7022",
  57.       "windowTimeout": 2000
  58.     }, {
  59.       "id": "995eac2f-3144-4ca7-8e87-e41f7839d2e1",
  60.       "comment": "",
  61.       "command": "selectWindow",
  62.       "target": "handle=${win7022}",
  63.       "targets": [],
  64.       "value": ""
  65.     }, {
  66.       "id": "d931eac2-569b-42a2-9445-68984c080035",
  67.       "comment": "",
  68.       "command": "pause",
  69.       "target": "1500",
  70.       "targets": [],
  71.       "value": ""
  72.     }, {
  73.       "id": "8c79adb4-b0ec-476c-b500-48a22c75681f",
  74.       "comment": "",
  75.       "command": "if",
  76.       "target": "document.getElementsByClassName('unlogin').length>0",
  77.       "targets": [],
  78.       "value": ""
  79.     }, {
  80.       "id": "8c431d44-57cb-4045-9d7f-6f3391dde7a5",
  81.       "comment": "",
  82.       "command": "click",
  83.       "target": "css=.unlogin",
  84.       "targets": [
  85.         ["css=.unlogin", "css:finder"],
  86.         ["xpath=//div[@id='sign-box']/div/div[2]/div[5]", "xpath:idRelative"],
  87.         ["xpath=//div[2]/div/div[2]/div[5]", "xpath:position"]
  88.       ],
  89.       "value": ""
  90.     }, {
  91.       "id": "2452c9ac-9ca9-4307-afb0-a4fe2ce277d6",
  92.       "comment": "",
  93.       "command": "pause",
  94.       "target": "1000",
  95.       "targets": [],
  96.       "value": ""
  97.     }, {
  98.       "id": "89954508-2db9-4659-b8c8-c9ff453c31cf",
  99.       "comment": "",
  100.       "command": "end",
  101.       "target": "",
  102.       "targets": [],
  103.       "value": ""
  104.     }, {
  105.       "id": "f13475ae-31c9-4c60-8ab1-b3f7d6bf982d",
  106.       "comment": "",
  107.       "command": "executeScript",
  108.       "target": "return ${index}+1",
  109.       "targets": [],
  110.       "value": "index"
  111.     }, {
  112.       "id": "50a88dc5-c98f-46d5-80ab-ab7150d1ba95",
  113.       "comment": "",
  114.       "command": "end",
  115.       "target": "",
  116.       "targets": [],
  117.       "value": ""
  118.     }, {
  119.       "id": "f7473ef9-cc2d-4efc-b2c9-ca31125ced97",
  120.       "comment": "",
  121.       "command": "close",
  122.       "target": "",
  123.       "targets": [],
  124.       "value": ""
  125.     }]
  126.   }],
  127.   "suites": [{
  128.     "id": "e71cffe2-e171-4d3d-a00d-73b33f06222a",
  129.     "name": "Default Suite",
  130.     "persistSession": false,
  131.     "parallel": false,
  132.     "timeout": 300,
  133.     "tests": ["2178d9f7-7b83-4f03-9261-3dc1243df112"]
  134.   }],
  135.   "urls": ["https://developer.aliyun.com/"],
  136.   "plugins": []
  137. }
复制代码
使用方法

1、把上边的文本内容放到一个text中,并把该text的后缀改成.side

2、用Selenium IDE加载并点击运行。


免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
继续阅读请点击广告

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×
回复

使用道具 举报

快速回复 返回顶部 返回列表