Best JavaScript code snippet using webdriverio-monorepo
无人值守.js
Source:无人值守.js
...52 await setLocations(xky);53 await xky.sleep(3 * 1000);54 //åæ¢è´¦å·55 await xky.setAppSnapshot("com.tencent.mm", cCode);56 await elementClick(xky, "å
许", 3);57 await elementClick(xky, "å
许", 1);58 await elementClick(xky, "å
³éåºç¨", 3);59 await elementClick(xky, "è¿å", 1);60 //æ¥çæ¯å¦å¯å¨å®æ¯,å¦ææ¶é´è¿é¿ä¼æ¥åä¿¡æ¯61 let isError = await userError(xky, "com.tencent.mm:id/d7b")62 switch (isError) {63 case 1:64 //è¿è¡æ£å¸¸,æ乱顺åº65 var maincheck1 = await upsetArray(args.main_check)66 //æ§è¡æ¨¡å67 await doModule(xky, args, xutil, maincheck1, qqq);68 break;69 case 2:70 //å¯å¨å¡ä½71 xky.log("<<<<<<æ示1,æ20ç§ç¡®è®¤æ¯å¦ä¸ºæªåºç°è¿çæ
éæ·»å å°å¼å¸¸å¤çåº!!!>>>>>>>");72 xky.log("<<<<<<æ示2,æ20ç§ç¡®è®¤æ¯å¦ä¸ºæªåºç°è¿çæ
éæ·»å å°å¼å¸¸å¤çåº!!!>>>>>>>");73 xky.log(qqq)74 xky.log("<<<<<<æ示3,æ20ç§ç¡®è®¤æ¯å¦ä¸ºæªåºç°è¿çæ
éæ·»å å°å¼å¸¸å¤çåº!!!>>>>>>>");75 xky.log("<<<<<<æ示4,æ20ç§ç¡®è®¤æ¯å¦ä¸ºæªåºç°è¿çæ
éæ·»å å°å¼å¸¸å¤çåº!!!>>>>>>>");76 await xky.sleep(20 * 1000);77 await xky.toast("å é¤æ¬å°æ槽ç»æ微信");78 await xky.killApp('com.tencent.mm');//ç»æå¨è¿è¡ç微信79 await xky.sleep(2 * 1000);80 await xky.delAppSnapshot("com.tencent.mm", "all");//å é¤0181 break;82 case 5:83 //å
¶ä»è®¾å¤ç»éå¼å¸¸84 xky.log("<<<<<<æ£å¨å¤çå¼å¸¸è´¦å·>>>>>>>");85 xky.log(qqq);86 xky.log("<<<<<<æ£å¨å¤çå¼å¸¸è´¦å·>>>>>>>");87 await xky.sleep(5000);88 var isGood = await repairError(xky, args, xutil, qqq);89 if (isGood == 1) {90 //è¿è¡æ£å¸¸91 await findUseFunction(xky, "com.tencent.mm:id/d7b", "è¿å");92 //æ乱顺åº93 var maincheck12 = await upsetArray(args.main_check)94 //æ§è¡æ¨¡å95 await doModule(xky, args, xutil, maincheck12, qqq);96 }97 break;98 }99 }100}101102async function allDepot(xky, args, xutil) {103 //è·åä»åº104 let getPot = await getDepot(xky, xutil, 1);105 let depotArrObj = [];106 for (let i = 5; i < getPot.data.data.length; i++) {107 depotArrObj.push(getPot.data.data[i].id)108 }109 //ä»åºéæ©å¨110 let depotIndex = 0;111 while (1) {112 //åå§åè·åè´¦å·113 //appç¼å·114 let appNum = 1;115 let qqq = "";116 //åæ¢è´¦å·åä»åº117 while (1) {118 await xky.sleep(2000);119 if (depotIndex >= depotArrObj.length) {120 xky.log("***************ææä»åºæ´»è·å®æ***************")121 await xky.toast('ææä»åºæ´»è·å®æ');122 await setChuDong(xky, args, xutil, 2, "绵é³");123 return;124 }125 await xky.toast(`å¼å§æ§è¡${depotArrObj[depotIndex]}åº`);126 //è·åè´¦å·127 qqq = await getData(xky, xutil, appNum, depotArrObj[depotIndex]);128 //åæ¢ä»åº129 if (qqq.data.msg == "该åºæ´»è·å·²å®æ") {130 await xky.toast('该åºæ´»è·å®æ,æ£å¨åæ¢ä»åº');131 depotIndex++;132 //设置代çç¼å·133 } else {134 await setChuDong(xky, args, xutil, 3, qqq.data.data.city);135 await setChuDong(xky, args, xutil, 2, qqq.data.data.city);136 break;137 }138 }139 //xky.log(qqq)140 //æ¸
空è系人141 await xky.toast("æ¸
空æ§è系人,æ·»å è´¦å·è系人");142 await xky.clearContacts();143 //è·åextend144 let data = JSON.parse(qqq.data.data.extend);145 let cCode = data.cCode;146 //æ·»å è系人147 await xky.insertContacts(data.addressbook);148 //ä¸è½½è¿åæ槽信æ¯149 await donwlondWeFile(xky, "WeChat", "com.tencent.mm", cCode);150 //设置å®ä½åVPN151 await xky.toast("设置å®ä½åVPN");152 //åæ¢ä»£ç(触å¨ç²¾çµ)153 await setChuDong(xky, args, xutil, 1, qqq.data.data.city);154 //å®ä½155 await setLocations(xky);156 await xky.sleep(3 * 1000);157 //åæ¢è´¦å·158 await xky.setAppSnapshot("com.tencent.mm", cCode);159 await elementClick(xky, "å
许", 3);160 await elementClick(xky, "å
许", 1);161 await elementClick(xky, "å
³éåºç¨", 3);162 await elementClick(xky, "è¿å", 1);163164 //æ¥çæ¯å¦å¯å¨å®æ¯,å¦ææ¶é´è¿é¿ä¼æ¥åä¿¡æ¯165 let isError = await userError(xky, "com.tencent.mm:id/d7b")166167 switch (isError) {168 case 1:169 //è¿è¡æ£å¸¸,æ乱顺åº170 var maincheck1 = await upsetArray(args.main_check)171 //æ§è¡æ¨¡å172 await doModule(xky, args, xutil, maincheck1, qqq);173 break;174 case 2:175 //å¯å¨å¡ä½176 xky.log("<<<<<<æ示1,æ20ç§ç¡®è®¤æ¯å¦ä¸ºæªåºç°è¿çæ
éæ·»å å°å¼å¸¸å¤çåº!!!>>>>>>>");177 xky.log("<<<<<<æ示2,æ20ç§ç¡®è®¤æ¯å¦ä¸ºæªåºç°è¿çæ
éæ·»å å°å¼å¸¸å¤çåº!!!>>>>>>>");178 xky.log(qqq)179 xky.log("<<<<<<æ示3,æ20ç§ç¡®è®¤æ¯å¦ä¸ºæªåºç°è¿çæ
éæ·»å å°å¼å¸¸å¤çåº!!!>>>>>>>");180 xky.log("<<<<<<æ示4,æ20ç§ç¡®è®¤æ¯å¦ä¸ºæªåºç°è¿çæ
éæ·»å å°å¼å¸¸å¤çåº!!!>>>>>>>");181 await xky.sleep(20 * 1000);182 await xky.toast("å é¤æ¬å°æ槽ç»æ微信");183 await xky.killApp('com.tencent.mm');//ç»æå¨è¿è¡ç微信184 await xky.sleep(2 * 1000);185 await xky.delAppSnapshot("com.tencent.mm", "all");//å é¤01186 break;187 case 5:188 //å
¶ä»è®¾å¤ç»éå¼å¸¸189 xky.log("<<<<<<æ£å¨å¤çå¼å¸¸è´¦å·>>>>>>>");190 xky.log(qqq);191 xky.log("<<<<<<æ£å¨å¤çå¼å¸¸è´¦å·>>>>>>>");192 await xky.sleep(5000);193 var isGood = await repairError(xky, args, xutil, qqq);194 if (isGood == 1) {195 //è¿è¡æ£å¸¸196 await findUseFunction(xky, "com.tencent.mm:id/d7b", "è¿å");197 //æ乱顺åº198 var maincheck12 = await upsetArray(args.main_check)199 //æ§è¡æ¨¡å200 await doModule(xky, args, xutil, maincheck12, qqq);201 }202 break;203 }204 }205}206207//æ§è¡æ¨¡å208async function doModule(xky, args, xutil, maincheck, qqq) {209 if (maincheck) {210 for (let i = 0; i < maincheck.length; i++) {211 await xky.sleep(1 * 1000);212 await xky.toast(`å¼å§æ§è¡ ${maincheck[i]} 模å`);213 switch (maincheck[i]) {214 case "æ¸
é¤çº¢ç¹":215 await wxhdss(xky, xutil);216 break;217 case "å 群æ人":218 await adCrowdAdPop(xky, args);219 break;220 case "æ¢çº¢å
":221 await redPacket(xky, args, xutil);222 break;223 case "å®åæµç§°":224 await isAuthentiNick(xky, xutil, qqq);225 break;226 case "æ·»å é讯å½":227 await AddTxlFriend(xky, args, xutil, qqq);228 break;229 case "ä¿®æ¹å¾®ä¿¡å·":230 await setVXId(xky, xutil, qqq);231 break;232 case "æ·»å å
é¨å¥½å":233 await addPetopFriend(xky, args, xutil, qqq);234 break;235 case "æ¶è":236 await collect(xky);237 break;238 case "å
³æ³¨å
¬ä¼å·":239 await officialAccounts(xky, args, xutil);240 break;241 case "åæ¶å
³æ³¨å
¬ä¼å·":242 await delAccounts(xky, args, xutil);243 break;244 case "建群":245 await Jianqun(xky);246 break;247 case "åæåå":248 await friendCircle(xky, args, xutil);249 break;250 case "çä¸çé
读":251 await lookRead(xky);252 break;253 case "æä¸ææç´¢":254 await SearchHotspot(xky);255 break;256 case "æ¢å¤´å":257 await exchangeHeaderPic(xky);258 break;259 case "个æ§ç¾å":260 await autograph(xky, xutil);261 break;262 case "ä¸è½½è¡¨æ
":263 await LowerExpression(xky);264 break;265 case "éæºæååå¯è§æ¶é´":266 await friendLookTome(xky);267 break;268 case "å
³éææºå 好å":269 await closePhoneAddFriend(xky, "close");//close/open270 break;271 case "æå¼ææºå 好å":272 await closePhoneAddFriend(xky, "open");//close/open273 break;274 case "å
³æ³¨å°ç¨åº":275 await miniProgram(xky, args, xutil);276 break;277 case "ç»å®APP":278 await wechatLogin(xky, args, xutil);279 break;280 case "å®å认è¯":281 await realNameAuthentication(xky, xutil);282 break;283 case "å
³éæ°æ¶æ¯æé":284 await closeTis(xky)285 break;286 }287 }288 } else {289 await xky.toast("没æéæ©æ§è¡æ¨¡å");290 }291 await xky.sleep(5 * 1000);292 await xky.toast("æ£å¨ä¸ä¼ æ槽信æ¯");293 await xky.killApp('com.tencent.mm');294 await setChuDong(xky, args, xutil, 2, "绵é³");295 //ä¸ä¼ æ槽信æ¯296 let aa = await xky.getCurrentAppSnapshot("com.tencent.mm");297 await uplondWeFile(xky, "WeChat", "com.tencent.mm", aa.name);//æå¡å¨æ件å,å
å,æ槽å298 await xky.sleep(2 * 1000);299 await xky.toast("å é¤æ¬å°æ槽ç»æ微信");300 await xky.delAppSnapshot("com.tencent.mm", "all");//å é¤01301 let finish = await upData(xky, xutil, qqq.data.data.id);302 xky.log(finish)303}304305//å¤æå¼å¸¸å·306async function userError(xky, element) {307 let startTime = new Date();308 while (1) {309 let elementArr = await getElementMassage(xky, element, 1);310 if (elementArr) {311 return 1;312 }313 let endTime = new Date();314 let useTime = endTime - startTime;315 if (useTime > 18000) {316 if (useTime > 45000) {317 return 2;318 }319 //ç»éç¶æå¼å¸¸320 let denglu = await getElementMassage(xky, "ç»å½", 1);321 if (denglu) {322 return 5;323 }324 //è´¦å·å¼å¸¸325 let tisa = await xky.findUiObjects('å¸å·ç¶æå¼å¸¸', { regex: true, timeout: 2000 });326 if (tisa.uiObjects != "") {327 await elementClick(xky, "ç¡®å®");328 return 5;329 }330 let qq1 = await getElementMassage(xky, "请填å微信å¯ç ", 1);331 if (qq1) {332 return 5;333 }334335 //å
¶ä»è®¾å¤ç»é336 let cc = await xky.findUiObjects('ä½ ç微信å¸å·äº', { regex: true, timeout: 2000 });337 let dd = await xky.findUiObjects('ä½ çå¸å·äº', { regex: true, timeout: 2000 });338 let ee = await xky.findUiObjects('å½åå¸å·äº', { regex: true, timeout: 2000 });339 if (cc.uiObjects != "" || dd.uiObjects != "" || ee.uiObjects != "") {340 await elementClick(xky, "ç¡®å®");341 return 5;342 }343344 //ç»éåºç°é误345 let aaa = await xky.findUiObjects('éæ°ç»å½', { regex: true, timeout: 2000 });346 if (aaa.uiObjects != "") {347 await elementClick(xky, "ç¡®å®");348 return 5;349 }350351 //被çå¼å¸¸352 let aaas = await xky.findUiObjects('被ç', { regex: true, timeout: 2000 });353 if (aaas.uiObjects != "") {354 await elementClick(xky, "ç¡®å®");355 return 5;356 }357 }358 await xky.sleep(3000);359 }360}361362//å¤çå¼å¸¸å·363async function repairError(xky, args, xutil, qqq) {364 while (1) {365 while (1) {366 var qqwe1 = await xky.findUiObjects("请填å微信å¯ç ");367 var qqwe2 = await xky.findUiObjects("请填åææºå·");368 var qqwe3 = await xky.findUiObjects("ç»å½");369 var qqwe4 = await xky.findUiObjects("ä¸ä¸æ¥");370 var qqwe5 = await xky.findUiObjects("tcaptcha_drag_thumb");371 var qqwe6 = await xky.findUiObjects("å¼å§éªè¯ ");372 var qqwe7 = await xky.findUiObjects("æ¯");373 var qqwe8 = await xky.findUiObjects('å¼å¸¸', { regex: true });374 var qqwe9 = await xky.findUiObjects('æ¹é', { regex: true });375 var qqwe10 = await xky.findUiObjects('å¯ç é误', { regex: true });376 var qqwe11 = await xky.findUiObjects('åºæ¥è系人', { regex: true });377 let goodUser = await getElementMassage(xky, "com.tencent.mm:id/d7b", 1);378 if (qqwe1.uiObjects != "") {379 await findElementIput(xky, "请填å微信å¯ç ", qqq.data.data.password);380 break;381 } else if (qqwe2.uiObjects != "") {382 await findElementIput(xky, "请填åææºå·", qqq.data.data.mobile);383 break;384 } else if (qqwe3.uiObjects != "" && qqwe1.uiObjects == "") {385 await elementClick(xky, "ç»å½", 1);386 await xky.sleep(2000);387 break;388 } else if (qqwe4.uiObjects != "" && qqwe1.uiObjects == "") {389 await elementClick(xky, "ä¸ä¸æ¥", 1);390 await xky.sleep(2000);391 break;392 } else if (qqwe5.uiObjects != "") {393 await slideWecatJigsaw(xky, "tcaptcha_drag_thumb");394 await xky.sleep(3000);395 break;396 } else if (qqwe6.uiObjects != "") {397 await elementClick(xky, "å¼å§éªè¯ ");398 break;399 } else if (qqwe7.uiObjects != "") {400 await elementClick(xky, "æ¯");401 await xky.sleep(5 * 1000);402 return 1;403 } else if (qqwe8.uiObjects != "" || qqwe9.uiObjects != "" || qqwe10.uiObjects != "") {404 await moveTepot(xky, xutil, 1002, qqq);405 return 2;406 } else if (qqwe11.uiObjects != "") {407 return 1;408 } else if (goodUser) {409 return 1;410 }411 }412 }413}414415//å¼å¯å¾®ä¿¡æé416async function openVxQx(xky) {417 await xky.restartApp("com.android.settings")418 await xky.sleep(2000);419 await rollFindElement(xky, "åºç¨", "xia", 6);420 await elementClick(xky, "åºç¨");421 await xky.sleep(2000);422 await rollFindElement(xky, "微信", "xia", 6);423 await elementClick(xky, "微信");424 await elementClick(xky, "æé");425 await xky.sleep(2000);426 while (1) {427 let sdd = await elementClick(xky, "å
³é", 2);428 if (!sdd) {429 await elementClick(xky, "身ä½ä¼ æå¨");430 break;431 }432 }433 await xky.killApp('com.android.settings');434}435436//å
³éæ°æ¶æ¯æé437async function closeTis(xky) {438 await elementClick(xky, "æ");439 await elementClick(xky, "设置");440 await elementClick(xky, "æ°æ¶æ¯æé");441 await xky.sleep(2000);442 let getnewmsg = await getElementMassage(xky, "com.tencent.mm:id/j7");443 if (getnewmsg["0"].contentDesc == "å·²å¼å¯") {444 await elementClick(xky, "å·²å¼å¯");445 await elementClick(xky, "确认å
³é", 3);446 } else {447 xky.log("æ¶æ¯æéå·²ç»å
³é")448 }449 await findUseFunction(xky, "com.tencent.mm:id/d7b", "è¿å");450}451452//移åº453async function moveTepot(xky, xutil, depot, qqq) {454 await xky.sleep(2 * 1000);455 let extendData = JSON.parse(qqq.data.data.extend)456 let saveUser = await saveData(xky, xutil, 1, qqq.data.data.id, depot, qqq.data.data.account, qqq.data.data.password, qqq.data.data.mobile, qqq.data.data.nickname, qqq.data.data.rawid, qqq.data.data.city, extendData);457 xky.log(saveUser);458 let aa = await xky.getCurrentAppSnapshot("com.tencent.mm")459 await xky.sleep(2 * 1000);460 await xky.toast("å é¤æ¬å°æ槽ç»æ微信");461 await xky.delAppSnapshot("com.tencent.mm", "all");//å é¤01462 xky.log(`------------------------------------`);463 xky.log(`${qqq.data.data.id}å·²ç»è½¬ç§»è³${depot}åº`);464 xky.log(`------------------------------------`);465}466467//å
³éä¸ä¿çæ´»å¨468async function closeNoSave(xky) {469 await xky.restartApp("com.android.settings")470 await xky.sleep(2000)471 while (1) {472 let sss = await xky.findUiObjects('WLAN');473 if (sss.uiObjects != "") {474 await xky.swipe(0.5, 0.9, 0.5, 0.15, 2);475 break;476 }477 }478 await xky.sleep(2000)479 let bb = await elementClick(xky, "å¼åè
é项", 2);480 if (!bb) {481 xky.log("å¼åè
模å¼æ²¡ææå¼")482 await rollFindElement(xky, "å
³äºææº", "xia", 6);//å·²numæ ¼çé度æ¥æ¾483 await elementClick(xky, "å
³äºææº");484 await rollFindElement(xky, "çæ¬å·", "xia", 5);//å·²numæ ¼çé度æ¥æ¾485 await elementClick(xky, "çæ¬å·");486 await elementClick(xky, "çæ¬å·");487 await elementClick(xky, "çæ¬å·");488 await elementClick(xky, "çæ¬å·");489 await elementClick(xky, "çæ¬å·");490 await elementClick(xky, "çæ¬å·");491 await elementClick(xky, "çæ¬å·");492 await elementClick(xky, "çæ¬å·");493 await elementClick(xky, "èå");494 await elementClick(xky, "å¼åè
é项");495 }496 await xky.sleep(2 * 1000);497 await await xky.swipe(0.5, 0.9, 0.5, 0.15, 2);498 await xky.sleep(2000)499 await rollFindElement(xky, "ä¸ä¿çæ´»å¨", "shang", 2);//å·²numæ ¼çé度æ¥æ¾500 await xky.sleep(2000)501 await elementClick(xky, "ON", 2);502}503504//å®åæµç§°æ´æ¹505async function isAuthentiNick(xky, xutil, qqq) {506 await elementClick(xky, "æ");507 await elementClick(xky, "æ¯ä»");508 await elementClick(xky, "æ´å¤");509 let yirenzheng = await getElementMassage(xky, "已认è¯", 3);510 if (yirenzheng) {511 let extendData = JSON.parse(qqq.data.data.extend)512 await findUseFunction(xky, "com.tencent.mm:id/d7b", "è¿å");513 await elementClick(xky, "æ");514 await xky.sleep(2000);515 let yigai = await getElementMassage(xky, "com.tencent.mm:id/a63");516 let smmmm = yigai["0"].text.indexOf("mars")517 if (smmmm < 0) {518 await elementClick(xky, "com.tencent.mm:id/py");519 await elementClick(xky, "æµç§°");520 await findElementIput(xky, "com.tencent.mm:id/e6r", `${yigai["0"].text}mars`);521 await xky.sleep(2000);522 await elementClick(xky, "ä¿å");523 await findUseFunction(xky, "com.tencent.mm:id/d7b", "è¿å");524 await xky.sleep(2 * 1000);525 if (!extendData.isShiMing) {526 extendData.isShiMing = 1;527 }528 let nickSave = await saveData(xky, xutil, 1, qqq.data.data.id, qqq.data.data.depot, qqq.data.data.account, qqq.data.data.password, qqq.data.data.mobile, `${yigai["0"].text}mars`, qqq.data.data.rawid, qqq.data.data.city, extendData);529 xky.log(nickSave);530 } else {531 if (!extendData.isShiMing) {532 extendData.isShiMing = 1;533 let nickSave = await saveData(xky, xutil, 1, qqq.data.data.id, qqq.data.data.depot, qqq.data.data.account, qqq.data.data.password, qqq.data.data.mobile, qqq.data.data.nickname, qqq.data.data.rawid, qqq.data.data.city, extendData);534 xky.log(nickSave);535 }536 }537 } else {538 await findUseFunction(xky, "com.tencent.mm:id/d7b", "è¿å");539 }540}541542//å®å认è¯543async function realNameAuthentication(xky, xutil) {544 await elementClick(xky, "æ");545 await elementClick(xky, "æ¯ä»");546 await elementClick(xky, "æ´å¤");547 let ewmArr = await getElementMassage(xky, "已认è¯", 3);548 if (ewmArr) {549 await findUseFunction(xky, "com.tencent.mm:id/d7b", "è¿å");550 return 1;551 }552 await elementClick(xky, "å®å认è¯");553 let mm = await getElementMassage(xky, "ç³»ç»ç¹å¿ï¼è¯·ç¨ååè¯", 3);554 if (mm) {555 await elementClick(xky, "ç¡®å®", 1);556 await findUseFunction(xky, "com.tencent.mm:id/d7b", "è¿å");557 return 1;558 }559 await elementClick(xky, "éªè¯å§åå身份è¯å·ç ");560 await elementClick(xky, "åæ");561 let [ppp, qqq, aa] = [0, "", ""];562 while (1) {563 while (1) {564 qqq = await xutil.http.get("http://119.23.32.104:91/com/get/real")565 aa = await xutil.http.get(`https://www.fesugar.com/get_identitycards?id=${qqq.data.data.card}`)566 if (aa.data.msg) {567 xky.log("身份è¯ä¿¡æ¯é误")568 await xky.sleep(2000);569 } else {570 break;571 }572 }573 await findElementIput(xky, "请è¾å
¥æ¬äººå§å", qqq.data.data.name);574 await findElementIput(xky, "è¾å
¥èº«ä»½è¯å·", qqq.data.data.card);575 await elementClick(xky, "èä¸");576 await elementClick(xky, "å
¶ä»");577 await xky.sleep(2 * 1000);578 let tasksave = await getElementMassage(xky, "android.widget.EditText");579 if (tasksave["0"].text == "请è¾å
¥æ¬äººå§å" || tasksave["1"].text == "è¾å
¥èº«ä»½è¯å·") {580 xky.log("ä¸æ´»å¨ä¿çå¤äºæå¼ç¶æ,æ£å¨å
³é")581 await closeNoSave(xky);582 await xky.restartApp('com.tencent.mm');583 await xky.sleep(6 * 1000);584 await findUseFunction(xky, "com.tencent.mm:id/d7b", "è¿å");585 await elementClick(xky, "æ");586 await elementClick(xky, "æ¯ä»");587 await elementClick(xky, "æ´å¤");588 await elementClick(xky, "å®å认è¯");589 await elementClick(xky, "éªè¯å§åå身份è¯å·ç ");590 } else {591 await elementClick(xky, "å°åº");592 await elementClick(xky, "å
许", 3);593 await elementClick(xky, "com.tencent.mm:id/c1");594 let bb = aa.data.data.address;595 let cc = bb.split("ç");596 let dd = cc[1].split("å¸");597 await findElementIput(xky, "com.tencent.mm:id/kh", cc[0]);598 await elementClick(xky, "com.tencent.mm:id/d8t");599 await elementClick(xky, "com.tencent.mm:id/c1");600 await findElementIput(xky, "com.tencent.mm:id/kh", dd[0]);601 await elementClick(xky, "com.tencent.mm:id/d8t");602 await elementClick(xky, "æ¶èµ·é®ç", 2);603 await elementClick(xky, "ä¸ä¸æ¥");604 let fff = await getElementMassage(xky, "设置æ¯ä»å¯ç ", 5);605 if (fff) {606 break;607 } else {608 await elementClick(xky, "ç¡®å®");609 await elementClick(xky, "è¿å");610 ppp++;611 if (ppp > 2) {612 xky.log("ä¸è½è¿å¤çå°è¯å®å")613 await findUseFunction(xky, "com.tencent.mm:id/d7b", "è¿å");614 return 1;615 }616 await elementClick(xky, "éªè¯ä¸å½å¤§é身份è¯");617 }618 }619 }620 await xky.sleep(3000);621 await coordinatesClick(xky, "android.widget.RelativeLayout", 0.17, 0.67);622 await coordinatesClick(xky, "android.widget.RelativeLayout", 0.17, 0.67);623 await coordinatesClick(xky, "android.widget.RelativeLayout", 0.17, 0.77);624 await coordinatesClick(xky, "android.widget.RelativeLayout", 0.16, 0.86);625 await coordinatesClick(xky, "android.widget.RelativeLayout", 0.50, 0.86);626 await coordinatesClick(xky, "android.widget.RelativeLayout", 0.51, 0.77);627 await xky.sleep(3000);628 await coordinatesClick(xky, "android.widget.RelativeLayout", 0.17, 0.67);629 await coordinatesClick(xky, "android.widget.RelativeLayout", 0.17, 0.67);630 await coordinatesClick(xky, "android.widget.RelativeLayout", 0.17, 0.77);631 await coordinatesClick(xky, "android.widget.RelativeLayout", 0.16, 0.86);632 await coordinatesClick(xky, "android.widget.RelativeLayout", 0.50, 0.86);633 await coordinatesClick(xky, "android.widget.RelativeLayout", 0.51, 0.77);634 await elementClick(xky, "å®æ", 3);635 let yj = await getElementMassage(xky, "ä½ å·²éè¿èº«ä»½è¯å·å®å注å两个微信æ¯ä»è´¦æ·ï¼è¾¾å°ä¸ªæ°éå¶ã请éè¿æ·»å é¶è¡å¡å®ææ¬æ¬¡å®å注å", 2);636 if (yj) {637 await elementClick(xky, "ç¡®å®");638 await elementClick(xky, "com.tencent.mm:id/eyy");639 await elementClick(xky, "æ¯");640 }641 await findUseFunction(xky, "com.tencent.mm:id/d7b", "è¿å");642}643644//ä¿®æ¹å¾®ä¿¡ID645async function setVXId(xky, xutil, qqq) {646 await elementClick(xky, "æ");647 await elementClick(xky, "com.tencent.mm:id/py");648 let ewmArr = await getElementMassage(xky, "android:id/summary");649 if (!ewmArr[1].text.indexOf("wxid_")) {650 let len = 3;651 let $chars =652 "abcdefhijkmnprstwxyz"; //é»è®¤å»æäºå®¹ææ··æ·çå符oOLl,9gq,Vv,Uu,I1653 let maxPos = $chars.length;654 let pwd = "";655 for (let i = 0; i < len; i++) {656 pwd += $chars.charAt(Math.floor(Math.random() * maxPos));657 }658 let VXheader = pwd;659 let newVXID = `${VXheader}${qqq.data.data.mobile.substring(5, 11)}`660 await elementClick(xky, "微信å·");661 await findElementIput(xky, "com.tencent.mm:id/e69", newVXID);662 await elementClick(xky, "ä¿å");663 await elementClick(xky, "ç¡®å®");664 let IDhave = await getElementMassage(xky, "å¸å·å·²ç»åå¨ï¼è¯·æ¢å
¶å®å¸å·", 5);665 if (IDhave) {666 newVXID = `${VXheader}${qqq.data.data.mobile.substring(5, 11)}a1`;667 await elementClick(xky, "ç¡®å®");668 await findElementIput(xky, "com.tencent.mm:id/e69", newVXID);669 await elementClick(xky, "ä¿å");670 await elementClick(xky, "ç¡®å®");671 }672 await xky.sleep(3 * 1000);673 //ä¸ä¼ ä¿®æ¹ä¿¡æ¯ä¿¡æ¯674 let extendData = JSON.parse(qqq.data.data.extend);675 let saveUser = await saveData(xky, xutil, 1, qqq.data.data.id, qqq.data.data.depot, qqq.data.data.account, qqq.data.data.password, qqq.data.data.mobile, qqq.data.data.nickname, newVXID, qqq.data.data.city, extendData);676 xky.log(saveUser);677 xky.log("******微信å·ä¿®æ¹å®æ******");678 await findUseFunction(xky, "com.tencent.mm:id/d7b", "è¿å");679 } else {680 xky.log("******该账å·å·²ç»è®¾ç½®è¿å¾®ä¿¡å·äº******")681 await findUseFunction(xky, "com.tencent.mm:id/d7b", "è¿å");682 }683}684685//æ·»å å
é¨å¥½å686async function addPetopFriend(xky, args, xutil, qqq) {687 await elementClick(xky, "com.tencent.mm:id/d7b");688 await elementClick(xky, "æ´å¤åè½æé®");689 await elementClick(xky, "æ·»å æå");690 await elementClick(xky, "微信å·/QQå·/ææºå·");691 let friendVXID = "";692 let kkk = 0;693 while (1) {694 await xky.sleep(2000);695 let sss = await getInteriorFriendData(xky, xutil, 1, qqq.data.data.depot, qqq.data.data.id);696 if (sss.data.msg == "ok") {697 friendVXID = sss.data.data.rawid;698 break;699 }700 kkk++;701 if (kkk > 3) {702 xky.log("好å请æ±æ¥å£å¼å¸¸,请æ£æ¥!!")703 xky.log(sss)704 xky.log("好å请æ±æ¥å£å¼å¸¸,请æ£æ¥!!")705 }706 }707 await findElementIput(xky, "com.tencent.mm:id/kh", friendVXID);708 await elementClick(xky, "com.tencent.mm:id/d7b", 1);709 let noUser = await elementClick(xky, "æ·»å å°é讯å½", 5);710 if (noUser) {711 await elementClick(xky, "åé", 5);712 await xky.sleep(2000);713 }714 await findUseFunction(xky, "com.tencent.mm:id/d7b", "è¿å");715}716717//å 群æ人718async function adCrowdAdPop(xky, args) {719 //æ¸
空å¾ç720 await xky.adbShell(" rm /storage/emulated/0/Download/*.jpg");721 await xky.sleep(1000);722 //ä¸è½½äºç»´ç 723 await xky.adbShell(`curl '${args.addQunUrl}' -o /storage/emulated/0/Download/1.jpg`);724 await xky.sleep(3000);725 //æ´æ°å¾ç726 await xky.insertMedia(`/storage/emulated/0/Download/1.jpg`);727 await elementClick(xky, "com.tencent.mm:id/d7b");728 await elementClick(xky, "æ´å¤åè½æé®");729 await elementClick(xky, "æ«ä¸æ«");730 await elementClick(xky, "com.tencent.mm:id/jy");731 await elementClick(xky, "ä»ç¸åéåäºç»´ç ");732 await elementClick(xky, "ææå¾ç");733 await elementClick(xky, "Download");734 await elementClick(xky, "com.tencent.mm:id/akq");735 await elementClick(xky, "å å
¥è¯¥ç¾¤è", 8);736 await xky.sleep(3000);737 let elmArr = await getElementMassage(xky, "com.tencent.mm:id/k3");738 let aaaa = elmArr["0"].text.replace(/[^0-9]/ig, "")739 if ((aaaa) > 95) {740 xky.log("å 群人æ°å·²è¾¾å°è¦æ±")741 return742 }743 await xky.sleep(5000);744 await elementClick(xky, "com.tencent.mm:id/jy");745 await elementClick(xky, "è天信æ¯", 1);746 await xky.sleep(2000);747 await rollFindElement(xky, "æ·»å æå", "xia", 3);748 await elementClick(xky, "æ·»å æå");749 await xky.sleep(3000);750 await coordinatesClick(xky, "com.tencent.mm:id/ib", 0.97, 0.61);751 await xky.sleep(3000);752 let [classify, region] = args.addQunFenLei.split(",");753 await findElementIput(xky, "com.tencent.mm:id/b8a", `${classify}_${region}`);754 let pops = await xky.findUiObjects(`${classify}_${region}`, { regex: true, timeout: 3000 });755 if (pops.uiObjects != "") {756 await elementClick(xky, pops.uiObjects["0"].text);757 await xky.sleep(2000)758 for (let i = 1; i < pops.uiObjects.length; i++) {759 await xky.sleep(2000)760 await findElementIput(xky, "com.tencent.mm:id/b8a", `${classify}_${region}`);761 await xky.sleep(2000)762 await elementClick(xky, pops.uiObjects[i].text);763 }764 await elementClick(xky, "com.tencent.mm:id/jx");765 await elementClick(xky, "é请", 3);766 await elementClick(xky, "é请", 3);767 await elementClick(xky, "ç¡®å®", 3);768 }769 //æååå é¤å¾ç770 await xky.delString(`/storage/emulated/0/Download/1.jpg`);771 await findUseFunction(xky, "com.tencent.mm:id/d7b", "è¿å");772}773774//æ¢çº¢å
775async function redPacket(xky, args, xutil) {776 await elementClick(xky, "com.tencent.mm:id/d7b");777 let dashen = await getElementMassage(xky, args.qhbName, 5);778 if (dashen) {779 await elementClick(xky, args.qhbName);780 let hongbao = await elementClick(xky, "æååè´¢ï¼å¤§å大å©", 3);781 if (hongbao) {782 await elementClick(xky, "com.tencent.mm:id/cyf", 3);783 await elementClick(xky, "com.tencent.mm:id/cv0", 3);784 await elementClick(xky, "è¿å", 3);785 }786 }787 await findUseFunction(xky, "com.tencent.mm:id/d7b", "è¿å");788 await xky.sleep(2000);789 if (args.isFaHongBao) {790 await faRedPacket(xky, args);791 }792}793//å红å
794async function faRedPacket(xky, args) {795 await elementClick(xky, "æ");796 await elementClick(xky, "æ¯ä»");797 await xky.sleep(2000);798 let elmArr = await getElementMassage(xky, "com.tencent.mm:id/d1c");799 let klk = elmArr["0"].text.replace("Â¥", "");800 await findUseFunction(xky, "com.tencent.mm:id/d7b", "è¿å");801 if (klk >= 0.01) {802 await elementClick(xky, "com.tencent.mm:id/d7b");803 await elementClick(xky, args.qhbName);804 await elementClick(xky, "æ´å¤åè½æé®ï¼å·²æå ");805 await elementClick(xky, "红å
");806 await findElementIput(xky, "com.tencent.mm:id/cvb", 0.01);807 await findElementIput(xky, "å¡«å个æ°", 1);808 await elementClick(xky, "æ¶èµ·é®ç", 2);809 await elementClick(xky, "å¡é±è¿çº¢å
");810 await elementClick(xky, "ç«å³æ¯ä»", 2);811 await xky.sleep(3000);812 await coordinatesClick(xky, "android.widget.RelativeLayout", 0.17, 0.67);813 await xky.sleep(1000);814 await coordinatesClick(xky, "android.widget.RelativeLayout", 0.17, 0.67);815 await xky.sleep(1000);816 await coordinatesClick(xky, "android.widget.RelativeLayout", 0.17, 0.77);817 await xky.sleep(1000);818 await coordinatesClick(xky, "android.widget.RelativeLayout", 0.16, 0.86);819 await xky.sleep(1000);820 await coordinatesClick(xky, "android.widget.RelativeLayout", 0.50, 0.86);821 await xky.sleep(1000);822 await coordinatesClick(xky, "android.widget.RelativeLayout", 0.51, 0.77);823 }824 await findUseFunction(xky, "com.tencent.mm:id/d7b", "è¿å");825}826//æ£æ¥å é讯å½827async function examineAddTxl(xky, args, xutil, qqq) {828 let sss = await contactCheck(xky, xutil, qqq.data.data.id)829 if (sss.data.data == "") {830 return;831 }832 xky.log(sss)833 let mylength = sss.data.data.length;834 await elementClick(xky, "é讯å½");835 await elementClick(xky, "com.tencent.mm:id/iq");836 for (let i = 0; i < mylength; i++) {837 if (sss.data.data[i].type && sss.data.data[i].city) {838 await findElementIput(xky, "com.tencent.mm:id/kh", `${sss.data.data[i].type}_${sss.data.data[i].city}_${sss.data.data[i].id}`);839 await xky.sleep(3000);840 let isAdd = await getElementMassage(xky, `${sss.data.data[i].type}_${sss.data.data[i].city}_${sss.data.data[i].id}`, 2);841 if (isAdd.length > 1) {842 let iss = await contactFinish(xky, xutil, qqq.data.data.id, 2, sss.data.data[i].number)//type:1åå¤æ³¨ç¼å· 2å®ææ·»å 3æé»,number:è·åçå·ç 843 // await elementClick(xky, "com.tencent.mm:id/q0");844 // await coordinatesClick(xky, "com.tencent.mm:id/nu", 0.08, 0.22);845 // await elementClick(xky, "设置å¤æ³¨åæ ç¾");846 // await elementClick(xky, "com.tencent.mm:id/b4w");847 // await findElementIput(xky, "com.tencent.mm:id/b4v", "");848 // await elementClick(xky, "å®æ");849 // await findUseFunction(xky, "com.tencent.mm:id/ki", "è¿å");850 }851 await xky.sleep(1000);852 }853 }854 await findUseFunction(xky, "com.tencent.mm:id/d7b", "è¿å");855}856//æ·»å é讯å½857async function AddTxlFriend(xky, args, xutil, qqq) {858 await examineAddTxl(xky, args, xutil, qqq);859 await elementClick(xky, "com.tencent.mm:id/d7b");860 await elementClick(xky, "æ´å¤åè½æé®");861 await elementClick(xky, "æ·»å æå");862 await elementClick(xky, "微信å·/QQå·/ææºå·");863 let addNum = args.addNums;864 let cishu = 0;865 while (1) {866 cishu++;867 if (cishu > 10) {868 await findUseFunction(xky, "com.tencent.mm:id/d7b", "è¿å");869 return 2;870 }871 //è·åå·ç 872 let getTxlNum = await contactGet(xky, xutil, qqq.data.data.id)//微信ID873 await findElementIput(xky, "com.tencent.mm:id/kh", getTxlNum.data.data.number);874 await elementClick(xky, "com.tencent.mm:id/mf");875 let isTxl = await getElementMassage(xky, "æ·»å å°é讯å½", 5);876 if (isTxl) {877 let sssq = await contactFinish(xky, xutil, qqq.data.data.id, 1, getTxlNum.data.data.number)//type:1åå¤æ³¨ç¼å· 2å®ææ·»å 3æé»,number:è·åçå·ç 878 //xky.log(sssq.data.data.id)879 await elementClick(xky, "设置å¤æ³¨åæ ç¾");880 await findElementIput(xky, "com.tencent.mm:id/b4v", `${getTxlNum.data.data.type}_${getTxlNum.data.data.city}_${sssq.data.data.id}`);881 await elementClick(xky, "ä¿å");882 await elementClick(xky, "æ·»å å°é讯å½");883 await elementClick(xky, "åé", 5);884 addNum--;885 if (addNum < 1) {886 await findUseFunction(xky, "com.tencent.mm:id/d7b", "è¿å");887 return 1;888 }889 } else {890 await xky.sleep(2000);891 //ä¸åå¨ç´æ¥3æé»892 // let sssq = await contactFinish(xky, xutil, qqq.data.data.id, 3, getTxlNum.data.data.number)//type:1åå¤æ³¨ç¼å· 2å®ææ·»å 3æé»,number:è·åçå·ç 893 // xky.log(sssq)894 }895 await findUseFunction(xky, "com.tencent.mm:id/kh", "è¿å");896 await elementClick(xky, "微信å·/QQå·/ææºå·", 1);897 }898}899900//综å红ç¹(1)901async function wxhdss(xky, xutil) {902 await elementClick(xky, "com.tencent.mm:id/d7b");903 //æ¯å¦æ家人群904 let jiaruqun = await getElementMassage(xky, "家人", 5);905 if (jiaruqun) {906 if (jiaruqun.length > 1) {907 for (let i = 1; i < jiaruqun.length; i++) {908 await elementClick(xky, "家人", 5);909 await elementClick(xky, "com.tencent.mm:id/jy", 5);910 await rollFindElement(xky, "å é¤å¹¶éåº", "xia", 5);911 await xky.sleep(2000);912 await elementClick(xky, "å é¤å¹¶éåº");913 await elementClick(xky, "离å¼ç¾¤è", 3);914 await elementClick(xky, "ç¡®å®", 3);915 await xky.sleep(2000);916 }917 }918 await elementClick(xky, "家人");919 var jiarensjs = await sjs(1, 2);920 switch (jiarensjs) {921 case 1:922 //æå923 var msg1 = await getPyqMsg(xky, xutil);924 await findElementIput(xky, "android.widget.EditText", msg1.data.data.content.substring(0, 15));925 await elementClick(xky, "åé", 3);926 await findUseFunction(xky, "com.tencent.mm:id/d7b", "è¿å");927 break;928 case 2:929 //表æ
930 await elementClick(xky, "表æ
");931 await elementClick(xky, "ç³»ç»è¡¨æ
");932 await xky.sleep(3 * 1000);933 await sjElementClick(xky, "com.tencent.mm:id/xs");934 await elementClick(xky, "åé", 3);935 await findUseFunction(xky, "com.tencent.mm:id/d7b", "è¿å");936 break;937 }938 }939 while (1) {940 let fris = await elementClick(xky, "com.tencent.mm:id/mv", 5);941 if (!fris) {942 break;943 }944 let news = await elementClick(xky, "com.tencent.mm:id/a7b", 3);945 if (news) {946 await xky.sleep(5 * 1000);947 await xky.wheel(0.5, 0.5, -6); //å¾ä¸æ»å¨-2个ä½ç½®948 await xky.sleep(2 * 1000);949 await xky.wheel(0.5, 0.5, -6); //å¾ä¸æ»å¨-2个ä½ç½®950 await xky.sleep(2 * 1000);951 await xky.wheel(0.5, 0.5, -6); //å¾ä¸æ»å¨-2个ä½ç½®952 await xky.sleep(2 * 1000);953 await xky.wheel(0.5, 0.5, -6); //å¾ä¸æ»å¨-2个ä½ç½®954 await xky.sleep(2 * 1000);955 await xky.wheel(0.5, 0.5, -6); //å¾ä¸æ»å¨-2个ä½ç½®956 await findUseFunction(xky, "com.tencent.mm:id/d7b", "è¿å");957 }958 let friend = await elementClick(xky, "android.widget.EditText", 2);959 if (friend && !news) {960 var sjsa = await sjs(1, 2);961 switch (sjsa) {962 case 1:963 //æå964 var msg2 = await getPyqMsg(xky, xutil);965 await findElementIput(xky, "android.widget.EditText", msg2.data.data.content.substring(0, 15));966 await elementClick(xky, "åé", 3);967 await findUseFunction(xky, "com.tencent.mm:id/d7b", "è¿å");968 break;969 case 2:970 //表æ
971 await elementClick(xky, "表æ
");972 await elementClick(xky, "ç³»ç»è¡¨æ
");973 await xky.sleep(3 * 1000);974 await sjElementClick(xky, "com.tencent.mm:id/xs");975 await elementClick(xky, "åé", 3);976 await findUseFunction(xky, "com.tencent.mm:id/d7b", "è¿å");977 break;978 }979 }980 if (!friend && !news) {981 await findUseFunction(xky, "com.tencent.mm:id/d7b", "è¿å");982 }983 await xky.wheel(0.5, 0.5, -1); //å¾ä¸æ»å¨-2个ä½ç½®984 await xky.sleep(2 * 1000);985 }986 //æ¯å¦æ人å æ987 await findUseFunction(xky, "com.tencent.mm:id/d7b", "è¿å");988 await elementClick(xky, "é讯å½");989 let Addme = await elementClick(xky, "com.tencent.mm:id/brf", 3);990 if (Addme) {991 await xky.sleep(3000);992 let ffd = 0;993 while (1) {994 if (ffd > 1) {995 break;996 }997 let Add = await elementClick(xky, "com.tencent.mm:id/brs", 1);998 if (!Add) {999 break;1000 }1001 await elementClick(xky, "å®æ", 3);1002 await xky.sleep(3000);1003 await findUseFunction(xky, "æ·»å æå", "è¿å");1004 ffd++;1005 }1006 await findUseFunction(xky, "com.tencent.mm:id/d7b", "è¿å");1007 }1008}10091010//æ¶è(1)1011async function collect(xky) {1012 await elementClick(xky, "com.tencent.mm:id/d7b");1013 await elementClick(xky, "è
¾è®¯æ°é»");1014 await elementClick(xky, "com.tencent.mm:id/an_");1015 await xky.sleep(3000);1016 await xky.wheel(0.5, 0.5, -6);//å¾ä¸æ»å¨-2个ä½ç½®1017 await xky.sleep(3000);1018 await xky.wheel(0.5, 0.5, -6);//å¾ä¸æ»å¨-2个ä½ç½®1019 await xky.sleep(3000);1020 await xky.wheel(0.5, 0.5, -6);//å¾ä¸æ»å¨-2个ä½ç½®1021 await elementClick(xky, "æ´å¤");1022 await elementClick(xky, "æ¶è");1023 await elementClick(xky, "æç¥éäº", 3);1024 await findUseFunction(xky, "com.tencent.mm:id/d7b", "è¿å");1025}10261027//å
³æ³¨å
¬ä¼å·(2)1028async function officialAccounts(xky, args, phone) {1029 //1030}10311032//å é¤å
¬ä¼å·(2)1033async function delAccounts(xky, args, phone) {1034 //1035}10361037//建群è(2)1038async function Jianqun(xky) {1039 await elementClick(xky, "com.tencent.mm:id/d7b");1040 let jiahanve = await elementClick(xky, "家人", 3);1041 if (jiahanve) {1042 xky.log("**家人群已åå¨,æ£å¨æ¥çæ¯å¦å¦å®¶äººè¿ç¾¤**");1043 await xky.sleep(2000);1044 let jiahanveob = await getElementMassage(xky, "com.tencent.mm:id/jw");1045 let shangxian = 9;1046 let nowpep = jiahanveob["0"].text.replace(/[^0-9]/ig, "");1047 if (nowpep < shangxian) {1048 xky.log(`ç°å¨æ${nowpep}人,éè¦æ人`)1049 await elementClick(xky, "com.tencent.mm:id/jy");1050 await elementClick(xky, "æ·»å æå");1051 await xky.sleep(2000);1052 let txzk = await getElementMassage(xky, "com.tencent.mm:id/zk");1053 for (let i = 0; i < txzk.length; i++) {1054 await elementClick(xky, "com.tencent.mm:id/zk", 1, i);1055 }1056 await xky.sleep(2000);1057 await elementClick(xky, "com.tencent.mm:id/jq");1058 await xky.sleep(3000);1059 await elementClick(xky, "ç¡®å®");1060 await findUseFunction(xky, "com.tencent.mm:id/d7b", "è¿å");1061 } else {1062 await findUseFunction(xky, "com.tencent.mm:id/d7b", "è¿å");1063 }1064 } else {1065 await elementClick(xky, "é讯å½");1066 await elementClick(xky, "群è");1067 await elementClick(xky, "æ°ç¾¤è");10681069 let allPeople = await getElementMassage(xky, "com.tencent.mm:id/zk");1070 if (allPeople.length > 2) {1071 for (let i = 0; i < allPeople.length; i++) {1072 await coordinatesClick(xky, "com.tencent.mm:id/zk", allPeople[i].x, allPeople[i].y);1073 }1074 } else {1075 xky.log("***å°äº3人ä¸è½å»ºç¾¤***")1076 xky.log("***å°äº3人ä¸è½å»ºç¾¤***")1077 await findUseFunction(xky, "com.tencent.mm:id/d7b", "è¿å");1078 return;1079 }1080 await elementClick(xky, "com.tencent.mm:id/jq");1081 let louser = await getElementMassage(xky, "å起群è失败", 3);1082 if (louser) {1083 await elementClick(xky, "åæ¶");1084 await findUseFunction(xky, "com.tencent.mm:id/d7b", "è¿å");1085 return;1086 }1087 await elementClick(xky, "è天信æ¯");1088 await elementClick(xky, "群èå称");1089 await findElementIput(xky, "android.widget.EditText", "家人");1090 await elementClick(xky, "ä¿å");1091 await findUseFunction(xky, "com.tencent.mm:id/d7b", "è¿å");1092 }1093}10941095//æåå(3)1096async function friendCircle(xky, args, xutil) {1097 //ä¸è½½æ´æ°å¾ç1098 let sjPic = await sjs(1, 774);1099 await xky.downloadFile(`friendPic/pyq (${sjPic}).jpg`, `/storage/emulated/0/Pictures/pyq (${sjPic}).jpg`);1100 await xky.insertMedia(`/storage/emulated/0/Pictures/pyq (${sjPic}).jpg`);1101 //å建æ¶æ¯1102 let sarss = "";1103 while (1) {1104 let sarArr = await getPyqMsg(xky, xutil);1105 if (sarArr.data.msg == "ok") {1106 sarss = sarArr.data.data.content;1107 break;1108 }1109 await xky.sleep(3000);1110 }1111 await elementClick(xky, "åç°");1112 await elementClick(xky, "æåå");1113 await elementClick(xky, "æç
§å享");1114 await elementClick(xky, "ä»ç¸åéæ©");1115 await elementClick(xky, "æç¥éäº", 2);1116 await elementClick(xky, "com.tencent.mm:id/e2a");1117 await elementClick(xky, "Pictures");1118 await elementClick(xky, "com.tencent.mm:id/bot");1119 await elementClick(xky, "com.tencent.mm:id/jx");1120 //éæºæ¶æ¯1121 await findElementIput(xky, "è¿ä¸å»çæ³æ³...", sarss);1122 await elementClick(xky, "å表");1123 //å é¤å¾ç1124 await xky.delString(`/storage/emulated/0/Pictures/pyq (${sjPic}).jpg`);1125 //ç¹èµçè¨1126 await xky.sleep(2 * 1000);1127 await zanAndSay(xky, xutil);1128}11291130//çè¨åç¹èµ(3)1131async function zanAndSay(xky, xutil) {1132 await findUseFunction(xky, "com.tencent.mm:id/d7b", "è¿å");1133}11341135//çä¸çé
读(3)1136async function lookRead(xky) {1137 await elementClick(xky, "åç°");1138 await elementClick(xky, "çä¸ç");1139 await elementClick(xky, "ç¥éäº", 3);1140 await elementClick(xky, "ç²¾é");1141 await xky.sleep(3 * 1000);1142 await xky.wheel(0.5, 0.5, -5);//å¾ä¸æ»å¨-2个ä½ç½®1143 await xky.sleep(2 * 1000);1144 await xky.wheel(0.5, 0.5, -5);//å¾ä¸æ»å¨-2个ä½ç½®1145 await xky.sleep(2 * 1000);1146 await sjXYClick(xky, "0.06|0.16", "0.84|0.90");1147 await sjXYClick(xky, "0.06|0.16", "0.84|0.90");1148 await sjXYClick(xky, "0.06|0.16", "0.84|0.90");1149 await xky.sleep(3 * 1000);1150 let sjs = await sjs(6, 10);1151 for (let i = 0; i < sjs; i++) {1152 await xky.sleep(1000);1153 await xky.wheel(0.5, 0.5, -3);//å¾ä¸æ»å¨-2个ä½ç½®1154 }1155 await findUseFunction(xky, "com.tencent.mm:id/d7b", "è¿å");1156}11571158//æä¸ææç´¢(3)1159async function SearchHotspot(xky) {1160 await elementClick(xky, "åç°");1161 await elementClick(xky, "æä¸æ");1162 let searchArr = ["", "ç¾å¥³", "åå¦å", "è¡£æ", "æé
", "éå", "å¤å¥", "ææ", "读书", "æ½®ç·", "åè´§"];1163 let sjs = await sjs(1, searchArr.length - 1);1164 await elementClick(xky, "å
许", 3);1165 await findElementIput(xky, "android.widget.TextView", searchArr[sjs]);1166 let keyboard = await getElementMassage(xky, "com.android.inputmethod.latin:id/keyboard_view", 2);1167 if (!keyboard) {1168 await xky.showInputMethod();1169 await elementClick(xky, "è±è¯(ç¾å½)");1170 }1171 await coordinatesClick(xky, "com.android.inputmethod.latin:id/keyboard_view", 0.92, 0.95);1172 await getElementMassage(xky, "android.widget.ListView");1173 let searchNo = ["", "å
¬ä¼å·", "å°ç¨åº", "æç« ", "é³ä¹", "è§é¢"];1174 let sjsNo = await sjs(1, 5);1175 await elementClick(xky, searchNo[sjsNo], 1);1176 await xky.sleep(3000);1177 await xky.wheel(0.5, 0.5, -5)1178 await xky.sleep(2000);1179 await xky.wheel(0.5, 0.5, -5)1180 await xky.sleep(5000);1181 while (1) {1182 await xky.sleep(2000);1183 await sjXYClick(xky, "0.03|0.03", "0.96|0.98");1184 await xky.sleep(2000);1185 await sjXYClick(xky, "0.03|0.03", "0.96|0.98");1186 let comeIn = await getElementMassage(xky, "com.tencent.mm:id/jy", 3);1187 let comeIn2 = await getElementMassage(xky, "android.widget.ImageButton", 1);1188 if (comeIn || comeIn2) {1189 break;1190 }1191 }1192 await xky.sleep(5000);1193 await xky.wheel(0.5, 0.5, -6)1194 await xky.sleep(3000);1195 await xky.wheel(0.5, 0.5, -6)1196 await xky.sleep(3000);1197 while (1) {1198 await xky.pressKey(4); //æä¸è¿åé®1199 await xky.sleep(2 * 1000);1200 await elementClick(xky, "å
³é", 1);1201 await elementClick(xky, "è¿å", 1);1202 let sss = await getElementMassage(xky, "com.tencent.mm:id/d7b", 1);1203 if (sss) {1204 break;1205 }1206 }1207}12081209//æ¢å¤´å(4)1210async function exchangeHeaderPic(xky) {1211 //ä¸è½½æ´æ°å¾ç1212 let sjPic = await sjs(1, 1620);1213 await xky.downloadFile(`herdpics/touxiang (${sjPic}).jpg`, `/storage/emulated/0/headpics/pyq (${sjPic}).jpg`);1214 await xky.insertMedia(`/storage/emulated/0/headpics/pyq (${sjPic}).jpg`);1215 await elementClick(xky, "æ");1216 await elementClick(xky, "com.tencent.mm:id/py");1217 await elementClick(xky, "头å");1218 await elementClick(xky, "ææå¾ç");1219 await elementClick(xky, "headpics");1220 await elementClick(xky, "com.tencent.mm:id/dkb");1221 await elementClick(xky, "使ç¨");1222 //å é¤å¾ç1223 await xky.delString(`/storage/emulated/0/headpics/pyq (${sjPic}).jpg`);1224 await findUseFunction(xky, "com.tencent.mm:id/d7b", "è¿å");1225}12261227//个æ§ç¾å(4)1228async function autograph(xky, xutil) {1229 await elementClick(xky, "æ");1230 await elementClick(xky, "com.tencent.mm:id/py");1231 await elementClick(xky, "æ´å¤");1232 await elementClick(xky, "个æ§ç¾å");12331234 let psArr = "";1235 while (1) {1236 let sarArr = await getPyqMsg(xky, xutil);1237 if (sarArr.data.msg == "ok") {1238 psArr = sarArr.data.data.content.substring(0, 29);1239 break;1240 }1241 await xky.sleep(3000);1242 }1243 await findElementIput(xky, "com.tencent.mm:id/lk", psArr);1244 await elementClick(xky, "ä¿å", 1);1245 await findUseFunction(xky, "com.tencent.mm:id/d7b", "è¿å");1246}12471248//ä¸è½½è¡¨æ
ï¼4ï¼1249async function LowerExpression(xky) {1250 await elementClick(xky, "æ");1251 await elementClick(xky, "表æ
");1252 await elementClick(xky, "æ´å¤è¡¨æ
");1253 await xky.sleep(2 * 1000);1254 let sjweizhi = await sjs(1, 5);1255 for (let i = 0; i < sjweizhi; i++) {1256 await xky.wheel(0.5, 0.5, -5);//å¾ä¸æ»å¨-2个ä½ç½®1257 await xky.sleep(2 * 1000);1258 }1259 await sjElementClick(xky, "com.tencent.mm:id/bdc");1260 await elementClick(xky, "æ·»å ");1261 await getElementMassage(xky, "å表æ
");1262 await findUseFunction(xky, "com.tencent.mm:id/d7b", "è¿å");1263}12641265//éæºæååå¯è§æ¶é´(4)1266async function friendLookTome(xky) {1267 await elementClick(xky, "æ");1268 await elementClick(xky, "设置");1269 await elementClick(xky, "éç§");1270 //æ»é项1271 let allTimeArr = ["æè¿åå¹´", "æè¿ä¸å¤©", "å
¨é¨"]1272 let nowSetArr = await getElementMassage(xky, "android:id/summary");1273 //å©ä½é项1274 let aa = [];1275 for (let i = 0; i < allTimeArr.length; i++) {1276 if (allTimeArr[i] != nowSetArr[1].text) {1277 aa.push(allTimeArr[i])1278 }1279 }1280 await elementClick(xky, "å
许æåæ¥çæååçèå´");1281 let sjs = await sjs(0, 1);1282 if (sjs) {1283 await elementClick(xky, aa[sjs]);1284 } else {1285 await elementClick(xky, aa[0]);1286 }1287 await findUseFunction(xky, "com.tencent.mm:id/d7b", "è¿å");1288}12891290//å
³é/å¼å¯ææºå 好å(4)1291async function closePhoneAddFriend(xky, closeOrOpen) {1292 await elementClick(xky, "æ");1293 await elementClick(xky, "设置");1294 await elementClick(xky, "éç§");1295 await elementClick(xky, "æ·»å æçæ¹å¼");1296 let phonePosition = await getElementMassage(xky, "com.tencent.mm:id/j7");1297 switch (closeOrOpen) {1298 case "close":1299 if (phonePosition[1].contentDesc == "å·²å¼å¯") {1300 await elementClick(xky, "com.tencent.mm:id/j7", 1, 1);1301 } else {1302 await xky.toast('该åè½å·²ç»å
³é');1303 xky.log('该åè½å·²ç»å
³é');1304 }1305 break;1306 case "open":1307 if (phonePosition[1].contentDesc == "å·²å
³é") {1308 await elementClick(xky, "com.tencent.mm:id/j7", 1, 1);1309 } else {1310 await xky.toast('该åè½å·²ç»å¼å¯');1311 xky.log('该åè½å·²ç»å¼å¯');1312 }1313 break;1314 }1315 await findUseFunction(xky, "com.tencent.mm:id/d7b", "è¿å");1316}13171318//å
³æ³¨å°ç¨åº(5)1319async function miniProgram(xky, args, xutil) {1320 //1321}13221323//ç»å®APP(5)1324async function wechatLogin(xky, args, xutil) {1325 //1326}13271328//2019/03/251329//ä¸è½½å¾ç1330//let sjPic = await sjs(1, 774);1331//await xky.downloadFile(`friendPic/pyq ${sjPic}.jpg`, `/storage/emulated/0/Pictures/pyq ${sjPic}.jpg`);13321333//æ´æ°å¾åº1334//await xky.insertMedia(`/storage/emulated/0/Pictures/pyq ${sjPic}.jpg`);13351336//å é¤å¾ç1337//await xky.delString(`/storage/emulated/0/Pictures/pyq ${sjPic}.jpg`);13381339//è·åå
ç´ ä¿¡æ¯ >>å¿
é¡»æ¾å°,éæ¶æ¥æ¾,éæ¶æ¥æ¾ç¬¬index-1个å
ç´ (ä»0å¼å§ç)1340// let elmArr = await getElementMassage(xky,"微信");1341// let elmArr = await getElementMassage(xky,"微信", 1);1342// let elmArr = await getElementMassage(xky,"微信", 1, index);1343// xky.log(elmArr);13441345//éæºæ°1346// let sjss = await sjs(1, 24);1347// xky.log(sjss);13481349//æ°ç»æä¹±éæº >>ä¼ å
¥æ°ç»1350// let arrays = await upsetArray(oldArray)13511352//å
ç´ ç¹å» >>å¿
é¡»ç¹,éæ¶xç§å
ç¹å»,éæ¶xç§å
ç¹å»ç¬¬index个å
ç´ (ä¸æ 0为第ä¸ä¸ª)1353// await elementClick(xky,"注å");1354// await elementClick(xky,"注å", x);1355// await elementClick(xky,"注å", x, index);13561357//æ£åç¹å»1358// await regularClick(xky, element);1359// await regularClick(xky, element,index);13601361//åæ ç¹å»1362// await coordinatesClick(xky,"com.android.documentsui:id/icon_thumb", x, y);13631364//éæºç¹å»å
ç´ å
¶ä¸ä¸ä¸ª >>è¿åç¹å»çå
ç´ 1365//await sjElementClick(xky,"注å");13661367//éæºèå´ç¹å» >>ç¹å»å¹¶è¿åéæºåæ 1368// let qqq = await sjXYClick(xky,"minX|minY" ,"maxX|maxY");1369//xky.log(qqq);13701371//é¿ææ§å¶ >>é¿æå¤å¶,é¿æç²è´´1372// await longCopyPaste(xky,"注å", "copy",);1373// await longCopyPaste(xky,"注å", "paste");13741375//æ¾å°å
ç´ è¾å
¥ >>timeréæ¶æ¾å°è¾å
¥1376// await findElementIput(xky,"请填åææºå·", phone);1377// await findElementIput(xky,"请填åææºå·", phone,timer);13781379//使ç¨æ¹æ³æ¾å°å
ç´ >>æ¹æ³(å¦åè¿,è¿å,åéç)1380//await findUseFunction(xky,"é¦é¡µ", "æ¹æ³");13811382//æ»å¨æ¥æ¾å
ç´ >>å·²numæ ¼çé度æ¥æ¾1383// await rollFindElement(xky,"延å±é
读", "xia/shang",num);13841385//æ¥æ¾å
ç´ è¶
æ¶æ¥é >>dataæ¥éå
å®¹ä¼ ä»ä¹æ°æ®é½è¡,è¶
åº60ç§æ¥é1386//let qqq = await FindElementTimeout(xky,"é¦é¡µ",data,60);1387//xky.log(qqq);13881389//çæéæºå符串 >>é¿åº¦51390// let qqq = await randomString(5);1391// xky.log(qqq);13921393//å建æ槽 >>ä¼ å
¥å
åï¼æ槽ç é¿åº¦15ï¼è¿åæ槽ç 1394// let qqq = await creatSlot(xky,"com.tencent.mm"ï¼15);1395// xky.log(qqq);13961397// 微信æ»å¨æ¼å¾1398// await slideWecatJigsaw(xky,"tcaptcha_drag_thumb");13991400//éæºçæå§å(æ¬å°) >>è¿åå§å1401//let qqq = await getName();1402//xky.log(qqq);14031404//è·åå®åä¿¡æ¯1405// let RealNameInformation = await xutil.http.get("http://119.23.32.104:91/com/get/real");1406// xky.log(RealNameInformation);14071408//æ¥å£æ¹éçææ·»å è系人 >>çæ5个,è¿åè系人æ°ç»1409//let qqq = await toLeadInsCon(xky,xutil,5);1410//xky.log(qqq);14111412//设置触å¨ç²¾çµä»£ç >>1å¼å¯,2å
³é,3设置å°åº,4设置账å·1413//await setChuDong(xky, args, xutil, 1, "绵é³");14141415//æ°æ®åå¨ >>æ°å·ID为空"", æ´æ°æ¶å¿
须填1416//let qqq = await saveData(xky, xutil, appName,id,depot,account,password,mobile,nickname,rawid,city,extend);1417//xky.log(qqq);14181419// è·åAPPåºå·1420// let qqq = await getDepot(xky,xutil,app);1421// xky.log(qqq);14221423// è·åæ°æ®1424// let qqq = await getData(xky,xutil,app,depot);1425// xky.log(qqq);14261427//æ´»è·å®æéç¥1428//let qqq = await upData(xky, xutil,id);1429//xky.log(qqq);14301431//æ°æ®å»ç»1432//let qqq = await dataFrozen(xky, xutil,id);1433//xky.log(qqq);14341435//è·åå
é¨å¥½åæ°æ®1436// let qqq = await getInteriorFriendData(xky,xutil,app,depot,id);1437// xky.log(qqq);14381439//é置活è·1440//let qqq = await resetActive(xky,xutil,id);1441//xky.log(qqq);14421443//éç½®åºæ´»è·1444//let qqq = await resetDepot(xky,xutil,depot);1445//xky.log(qqq);14461447//ipæ¥è¯¢1448//let qqq = await ipWhere(xky,xutil,ip,type);1449//xky.log(qqq);14501451//è·å代ç1452//let qqq = await getAgency(xky, xutil, city);1453//xky.log(qqq);14541455//è·ååå¤å
容1456//let qqq = await replyMessage(xky,xutil,id,msg);1457//xky.log(qqq);14581459//è·åä»»å¡1460//let qqq = await getTask(xky,xutil,id);1461//xky.log(qqq);14621463//æäº¤ä»»å¡ >>taskidä»»å¡ID,extendæ©å±å¯ä¸ºç©º1464//let qqq = await taskFinish(xky,xutil,id,taskid,extend);1465//xky.log(qqq);14661467//æ´»è·ååç¶æ >>fieldå称èªå·±åå,åæ°æ®æå¡«value1468// let qqq = await activeSaveGet(xky, xutil, id, field, value);1469// xky.log(qqq);14701471//é讯å½åå· >>微信ID1472// let qqq = await contactGet(xky, xutil, id);1473// xky.log(qqq);14741475//é讯å½å¤ç >>type:1åå¤æ³¨ç¼å· 2å®ææ·»å 3æé»,number:è·åçå·ç 1476// let qqq = await contactFinish(xky, xutil, id, type, number);1477// xky.log(qqq);14781479//é讯å½æ£æ¥ >>id:微信ID1480// let qqq = await contactCheck(xky, xutil, id);1481// xky.log(qqq);14821483//è·åæµç§° >>cnä¸æ,enè±æ1484//let qqq = await getNikeName(xky,xutil,"cn/en");1485//xky.log(qqq);14861487//å½å±å°æ¥è¯¢1488//let qqq = await phoneWhere(xky,xutil,phone);1489//xky.log(qqq);14901491//设置å®ä½ >>æ ¹æ®å½åIPå®æå®ä½,è¿ååæ 1492//let qqq = await setLocations(xky);1493//xky.log(qqq);14941495//ç½ç»æ£æµ >>ä¼ å
¥å½åip1496//let qqq = await networkDetection(xky,ip);1497//xky.log(qqq);14981499//è·å头å1500//let qqq = await getHeadPic(xky,,xutil);1501//xky.log(qqq);15021503//è·åæååå
容1504//let qqq = await getPyqMsg(xky,xutil);1505//xky.log(qqq);15061507//ä¸ä¼ æ槽å°æ¬å°æå¡å¨ >>æå¡å¨æ件å,å
å,æ槽å1508//await uplondWeFile(xky, "WeChat", "com.tencent.mm", "dfhfh2557114");15091510//ä»æ¬å°æå¡å¨ä¸è½½æ槽å°ç¿æº >>æå¡å¨æ件å,å
å,æ槽å1511//await donwlondWeFile(xky, "WeChat", "com.tencent.mm", "dfhfh2557114");1512//======================================================================1513//è·åå
ç´ ä¿¡æ¯1514async function getElementMassage(xky, element, timer, nums) {1515 while (1) {1516 let elementObj = await xky.findUiObjects(element);1517 let elementArr = elementObj.uiObjects;1518 if (elementArr != "") {1519 if (timer) {1520 if (nums || nums >= 0) {1521 return elementArr[nums];1522 }1523 return elementArr;1524 }1525 return elementArr;1526 } else {1527 if (timer) {1528 await xky.sleep(1000);1529 timer--;1530 if (timer < 1) {1531 break;1532 }1533 } else {1534 await xky.sleep(1000);1535 }1536 }1537 }1538}15391540//éæºæ°1541async function sjs(min, max) {1542 return parseInt(Math.random() * (max - min + 1) + min, 10);1543}15441545//æ°ç»æä¹±éæº1546async function upsetArray(oldarray) {1547 let pos = oldarray.length, i;1548 while (pos) {1549 i = (Math.random() * pos--) >>> 0;1550 [oldarray[pos], oldarray[i]] = [oldarray[i], oldarray[pos]]1551 }1552 return oldarray;1553}15541555//å
ç´ ç¹å»1556async function elementClick(xky, element, timer, nums) {1557 if (timer) {1558 if (nums) {1559 let qqq = await getElementMassage(xky, element, timer, nums);1560 if (qqq) {1561 await xky.findAndClick(element, { index: nums });1562 return qqq;1563 }1564 }1565 let qqq = await getElementMassage(xky, element, timer);1566 if (qqq) {1567 await xky.findAndClick(element);1568 return qqq;1569 }1570 } else {1571 let qqq = await getElementMassage(xky, element);1572 await xky.findAndClick(element);1573 return qqq;1574 }1575}15761577//æ£åç¹å»1578async function regularClick(xky, element, ind) {1579 while (1) {1580 let qqq = await xky.findUiObjects(element, { regex: true, timeout: 1000 });1581 if (qqq.uiObjects != "") {1582 if (qqq.uiObjects[0].contentDesc == "") {1583 if (ind) {1584 await xky.findAndClick(qqq.uiObjects[ind].text);1585 return qqq.uiObjects;1586 }1587 await xky.findAndClick(qqq.uiObjects["0"].text);1588 return qqq.uiObjects;1589 } else {1590 if (ind) {1591 await xky.findAndClick(qqq.uiObjects[ind].contentDesc);1592 return qqq.uiObjects;1593 }1594 await xky.findAndClick(qqq.uiObjects["0"].contentDesc);1595 return qqq.uiObjects;1596 }1597 }1598 }1599}16001601//åæ ç¹å»1602async function coordinatesClick(xky, element, x, y) {1603 await getElementMassage(xky, element);1604 await xky.click(x, y);1605}16061607//éæºç¹å»å
ç´ å
¶ä¸ä¸ä¸ª1608async function sjElementClick(xky, element) {1609 let qqq = await getElementMassage(xky, element);1610 let sjsEl = await sjs(0, qqq.length - 1);1611 await xky.findAndClick(element, { index: sjsEl });1612 return qqq[sjsEl];1613}16141615//éæºèå´ç¹å»1616async function sjXYClick(xky, minXY, maxXY) {1617 let [minX, minY] = minXY.split("|");1618 let [maxX, maxY] = maxXY.split("|");1619 let X = await sjs(xky, minX * 100, maxX * 100);1620 let Y = await sjs(xky, minY * 100, maxY * 100);1621 await xky.click(X / 100, Y / 100);1622 return {1623 x: X / 100,1624 y: Y / 1001625 }1626}16271628//é¿ææ§å¶1629async function longCopyPaste(xky, element, copyOrPaste) {1630 let elmArr = await getElementMassage(xky, element);1631 if (copyOrPaste == "copy") {1632 await xky.mousedown(elmArr[0].x - 0.1, elmArr[0].y);1633 await elementClick(xky, "å
¨é");1634 await xky.sleep(1000);1635 await xky.copy()1636 } else {1637 await elementClick(xky, element);1638 await xky.paste();1639 }1640}16411642//æ¾å°å
ç´ è¾å
¥1643async function findElementIput(xky, element, inp, timer) {1644 if (timer) {1645 let elementTimer = await getElementMassage(xky, element, timer);1646 if (elementTimer) {1647 await xky.findAndInput(element, inp);1648 return elementTimer;1649 }1650 } else {1651 let qqq = await getElementMassage(xky, element);1652 await xky.findAndInput(element, inp);1653 return qqq;1654 }1655}16561657//使ç¨æ¹æ³æ¾å°å
ç´ 1658async function findUseFunction(xky, element, fun) {1659 while (1) {1660 let elmArr = await getElementMassage(xky, element, 1);1661 if (elmArr) {1662 return elmArr;1663 }1664 await elementClick(xky, fun, 2);1665 await xky.sleep(1000);1666 }1667}16681669//æ»å¨æ¥æ¾å
ç´ 1670async function rollFindElement(xky, element, direction, speed, timer) {1671 while (1) {1672 let elmArr = await getElementMassage(xky, element, 1);1673 if (elmArr) {1674 return elmArr;1675 }1676 if (direction == "xia") {1677 await xky.wheel(0.5, 0.5, -speed);1678 } else {1679 await xky.wheel(0.5, 0.5, speed);1680 }1681 if (timer) {1682 timer--;1683 if (timer < 1) {1684 return "æ¥æ¾è¶
æ¶";1685 }1686 }1687 }1688}16891690//æ¥æ¾å
ç´ è¶
æ¶æ¥é1691async function FindElementTimeout(xky, element, data, timer) {1692 let startTime = new Date();1693 while (1) {1694 let elmArr = await getElementMassage(xky, element, 1);1695 if (elmArr) {1696 await xky.sleep(1000);1697 return elmArr;1698 } else {1699 let endTime = new Date();1700 let useTime = endTime - startTime;1701 if (useTime > timer * 1000) {1702 xky.log("***************æ¥æ¾æ¤å
ç´ è¶
è¿éå®æ¶é´,请æ£æ¥è´¦å·æ
åµå代ç æ
åµ***************")1703 xky.log(data)1704 xky.log("***************æ¥æ¾æ¤å
ç´ è¶
è¿éå®æ¶é´,请æ£æ¥è´¦å·æ
åµå代ç æ
åµ***************")1705 return;1706 }1707 }1708 }1709}17101711//çæéæºå符串1712async function randomString(long) {1713 let len = long;1714 let chars = "abcdefhijkmnprstwxyz1234567890"; //é»è®¤å»æäºå®¹ææ··æ·çå符oOLl,9gq,Vv,Uu,I11715 let maxPos = chars.length;1716 let pwd = "";1717 for (let i = 0; i < len; i++) {1718 pwd += chars.charAt(Math.floor(Math.random() * maxPos));1719 }1720 return pwd;1721}17221723//å建æ槽1724async function creatSlot(xky, PackageName, long) {1725 let randomStringcode = await randomString(long);//é¿åº¦51726 while (1) {1727 let qqq = await xky.createAppSnapshot(PackageName, randomStringcode);1728 if (qqq.msg == "å¿«ç
§å建æå") {1729 return randomStringcode;1730 } else {1731 await xky.sleep(1000);1732 }1733 }1734}17351736//微信æ»å¨æ¼å¾1737async function slideWecatJigsaw(xky, element) {1738 let qqq = await getElementMassage(xky, element);1739 while (1) {1740 await xky.sleep(1000);1741 await xky.swipe(0.2, 0.54, 0.8, 0.54, 60);1742 await xky.sleep(1000);1743 qqq = await getElementMassage(xky, element, 2);1744 if (qqq) {1745 await xky.swipe(0.2, 0.54, 0.7, 0.54, 60);1746 await xky.sleep(1000);1747 qqq = await getElementMassage(xky, element, 2);1748 if (qqq) {1749 await xky.swipe(0.2, 0.54, 0.75, 0.54, 60);1750 await xky.sleep(1000);1751 } else {1752 break;1753 }1754 } else {1755 break;1756 }1757 }1758}17591760//éæºçæå§å(æ¬å°)1761async function getName() {1762 var familyNames = new Array(1763 "èµµ", "é±", "å", "æ", "å¨", "å´", "é", "ç", "å¯", "é",1764 "è¤", "å«", "è", "æ²", "é©", "æ¨", "æ±", "秦", "å°¤", "许",1765 "ä½", "å", "æ½", "å¼ ", "å", "æ¹", "严", "å", "é", "é",1766 "é¶", "å§", "æ", "è°¢", "é¹", "å»", "æ", "æ°´", "窦", "ç« ",1767 "äº", "è", "æ½", "è", "å¥", "è", "å½", "é", "é²", "é¦",1768 "æ", "马", "è", "å¤", "è±", "æ¹", "ä¿", "ä»»", "è¢", "æ³",1769 "é
", "é²", "å²", "å", "è´¹", "å»", "å²", "è", "é·", "è´º",1770 "åª", "汤", "æ»", "æ®·", "ç½", "æ¯", "é", "é¬", "å®", "常",1771 "ä¹", "äº", "æ¶", "å
", "ç®", "å", "é½", "康", "ä¼", "ä½",1772 "å
", "å", "顾", "å", "å¹³", "é»", "å", "ç©", "è§", "å°¹"1773 );1774 var givenNames = new Array(1775 "åç", "æ·¼", "å½æ ", "夫å", "çå ", "ç", "æ", "å°", "å½è´¤", "贺祥", "æ¨æ¶",1776 "æ轩", "æ轩", "çè¾°", "çå¸", "çå", "ç¾æ¥", "ç¾æ", "æ¥é½", "æ¨", "ææ",1777 "ä¸ä¸", "éé", "浩æ¨", "ç涵", "溶溶", "å°æ«", "欣欣", "å®è±ª", "欣æ
§", "建æ¿",1778 "ç¾æ¬£", "æ·æ
§", "æ轩", "ææ°", "欣æº", "å¿ æ", "æ¦æ¶¦", "欣æ±", "æ
§å", "æ°å»º",1779 "建æ", "亦è²", "æ", "å°æ´", "佳欣", "涵涵", "禹辰", "æ·³ç¾", "æ³½æ ", "ä¼æ´",1780 "涵è¶", "润丽", "ç¿", "æ·å", "æ¶è¹", "åæ¶", "è溪", "é¨æ¶µ", "åæ¡", "ä½³æ¯
",1781 "åè¾°", "ä½³çª", "紫轩", "çè¾°", "æè", "è", "æè¿", "欣å®", "æ³½è¿", "欣æ¡",1782 "ä½³æ¡", "ä½³æ ", "æ¨è", "æ¨ç", "è¿æ", "æ±é«", "æ·å", "æ¶æ»¢", "润è", "æ¦æ±",1783 "ä½³é°", "ä½³ç", "æåº", "ä¸é¸£", "è¯æ¨", "æ·»æ± ", "æ·»æ", "é¨æ³½", "é
æ", "é
涵",1784 "æ¸
å¦", "è¯æ¦", "åä¹", "æ¨æ¶µ", "天赫", "ç¥å²", "ä½³æ", "天æ", "èè", "è¥è"1785 );1786 var i = parseInt(10 * Math.random()) * 10 + parseInt(10 * Math.random());1787 var familyName = familyNames[i];1788 var j = parseInt(10 * Math.random()) * 10 + parseInt(10 * Math.random());1789 var givenName = givenNames[i];1790 var name = familyName + givenName;1791 return name;1792}17931794//æ¥å£æ¹éçæè系人1795async function toLeadInsCon(xky, xutil, num) {1796 let PhoneNums = await xutil.http.get(`http://192.168.2.216:8090/sou/mobelRand?num=${num}`)1797 //å建æ¶éå¨1798 let AllMassage = [];1799 let NumArr = PhoneNums.data.split(",")1800 for (let i = 0; i < NumArr.length - 1; i++) {1801 let EmpretMassage = { name: "", number: "" }1802 EmpretMassage.name = await getName();1803 EmpretMassage.number = NumArr[i];1804 AllMassage.push(EmpretMassage)1805 }1806 await xky.insertContacts(AllMassage);1807 return AllMassage;1808}18091810//设置触å¨ç²¾çµä»£ç1811async function setChuDong(xky, args, xutil, stats, loc) {1812 var locitionNum = {1813 "ä¸æµ·": 1, "å京": 2, "天津": 16, "éåº": 10, "èå·": 17, "å京": 20, "æ é¡": 21, "åé": 31, "å¾å·": 40, "常å·": 41,1814 "è¿äºæ¸¯": 81, "æ·®å®": 82, "çå": 83, "æ¬å·": 84, "éæ±": 85, "æ³°å·": 86, "宿è¿": 87, "æå·": 12, "å®æ³¢": 23, "温å·": 42,1815 "ç»å
´": 43, "åå
´": 88, "æ¹å·": 89, "éå": 90, "è¡¢å·": 91, "èå±±": 92, "å°å·": 93, "丽水": 94, "éå²": 11, "çå°": 27,1816 "æµå": 28, "æ½å": 39, "æµå®": 45, "æ·å": 46, "æ£åº": 113, "ä¸è¥": 114, "æ³°å®": 115, "å¨æµ·": 116, "æ¥ç
§": 117,1817 "临æ²": 118, "å¾·å·": 119, "èå": 120, "滨å·": 121, "èæ³½": 122, "å¦é¨": 13, "æ³å·": 30, "ç¦å·": 36, "èç°": 102,1818 "ä¸æ": 103, "æ¼³å·": 104, "åå¹³": 105, "é¾å²©": 106, "å®å¾·": 107, "åå±±": 32, "ç³å®¶åº": 38, "秦çå²": 48, "é¯é¸": 49,1819 "é¢å°": 50, "ä¿å®": 51, "å¼ å®¶å£": 52, "æ¿å¾·": 53, "沧å·": 54, "å»å": 55, "è¡¡æ°´": 56, "æ·±å³": 9, "广å·": 15, "ä½å±±": 22,1820 "ä¸è": 29, "é¶å
³": 152, "ç æµ·": 153, "æ±å¤´": 154, "æ±é¨": 155, "æ¹æ±": 156, "èå": 157, "èåº": 158, "æ å·": 159,1821 "æ¢
å·": 160, "æ±å°¾": 161, "æ²³æº": 162, "é³æ±": 163, "æ¸
è¿": 164, "ä¸å±±": 165, "æ½®å·": 166, "æé³": 167, "äºæµ®": 168,1822 "æ¦æ±": 18, "é»ç³": 134, "åå °": 135, "å®æ": 136, "åæ": 137, "èå·": 138, "é»å": 139, "æé½": 19, "泸å·": 178,1823 "å¾·é³": 179, "绵é³": 180, "ä¹å±±": 181, "åå
": 182, "çå±±": 183, "å®å®¾": 184, "大è¿": 24, "æ²é³": 26, "éå±±": 72,1824 "æ顺": 73, "é¦å·": 74, "çé¦": 75, "éå·": 25, "å¼å°": 123, "æ´é³": 124, "平顶山": 125, "å®é³": 126, "æ°ä¹¡": 127,1825 "ç¦ä½": 128, "许æ": 129, "åé³": 130, "åä¸": 131, "ä¿¡é³": 132, "å¨å£": 133, "西å®": 33, "å®é¸¡": 199, "å¸é³": 200,1826 "æ¸å": 201, "å®åº·": 202, "åå°æ»¨": 34, "大åº": 47, "é½é½åå°": 79, "ç¡ä¸¹æ±": 80, "åè¥": 35, "èæ¹": 95, "èå ": 96,1827 "马éå±±": 97, "æ·®å": 98, "å®åº": 99, "æ»å·": 100, "å
å®": 101, "é¿æ¥": 37, "åæ": 76, "åå¹³": 77, "延边": 78,1828 "éå°å¤æ¯": 44, "å¼å浩ç¹": 65, "å
头": 66, "赤峰": 67, "éè¾½": 68, "å¼ä¼¦è´å°": 69, "巴彦æ·å°": 70, "ä¹å
°å¯å¸": 71,1829 "太å": 57, "大å": 58, "é³æ³": 59, "é¿æ²»": 60, "æä¸": 61, "è¿å": 62, "å¿»å·": 63, "临汾": 64, "åæ": 108, "èµ£å·": 109,1830 "åå®": 110, "æå·": 111, "ä¸é¥¶": 112, "é¿æ²": 140, "æ ªæ´²": 141, "æ¹æ½": 142, "è¡¡é³": 143, "éµé³": 144, "å²³é³": 145, "常德": 146,1831 "å¼ å®¶ç": 147, "çé³": 148, "é´å·": 149, "æå": 150, "å¨åº": 151, "åå®": 169, "æ³å·": 170, "æ¡æ": 171, "梧å·": 172, "åæµ·": 173,1832 "贵港": 174, "çæ": 175, "ç¾è²": 176, "æµ·å£": 177, "è´µé³": 185, "éµä¹": 186, "é»ä¸å": 187, "ææ": 188, "æ²é": 189, "ç溪": 190,1833 "ä¿å±±": 191, "临沧": 192, "æ¥é": 193, "红河": 194, "æå±±": 195, "西åç纳": 196, "大ç": 197, "å¾·å®": 198, "å
°å·": 203,1834 "西å®": 204, "ä¹é²æ¨é½": 205, "æå": 206, "å·´é³éæ¥": 207, "ä¼ç": 2081835 }1836 let [usesIp, ewmArr] = ["", ""];1837 var ewmArr1 = await getElementMassage(xky, "start.lua", 3);1838 if (!ewmArr1) {1839 while (1) {1840 await xky.restartApp('com.touchsprite.android');1841 await elementClick(xky, "éæ°æå¼åºç¨", 3);1842 await elementClick(xky, "ç¥éäº", 3);1843 var closeAPP = await elementClick(xky, "å
³éåºç¨", 3);1844 if (closeAPP) {1845 await xky.restartApp('com.touchsprite.android');1846 await elementClick(xky, "éæ°æå¼åºç¨", 3);1847 }1848 var kkk = await elementClick(xky, "忽ç¥æ¤çæ¬", 3);1849 if (kkk) {1850 await elementClick(xky, "com.touchsprite.android:id/iv_experience");1851 await elementClick(xky, "com.touchsprite.android:id/title_bar_tv_left");1852 await elementClick(xky, "æçè´¦å·");1853 await rollFindElement(xky, "èªå¨æ£æµæ´æ°", "xia", 5);1854 await elementClick(xky, "èªå¨æ£æµæ´æ°");1855 await elementClick(xky, "com.touchsprite.android:id/more_sb_service_switch");1856 await elementClick(xky, "com.touchsprite.android:id/title_bar_tv_left");1857 await elementClick(xky, "æçèæ¬");1858 }1859 var ewmArrqqq = await getElementMassage(xky, "start.lua", 3);1860 if (ewmArrqqq) {1861 ewmArr = ewmArrqqq;1862 break;1863 }1864 }1865 } else {1866 ewmArr = ewmArr1;1867 }1868 switch (stats) {1869 case 1:1870 await elementClick(xky, "start.lua");1871 while (1) {1872 await coordinatesClick(xky, "com.touchsprite.android:id/image_file_arrows2", 0.95, ewmArr["0"].y);1873 await elementClick(xky, "ç«å³è¿è¡");1874 var ffff = await getElementMassage(xky, "com.touchsprite.android:id/text_main");1875 var ipwherre = await ipWhere(xky, xutil, ffff["0"].text.split("IP: ")[1], 1);1876 xky.log(`${ffff["0"].text}çå°åºä¸º:${ipwherre.data.data.city}`);1877 var bb = ipwherre.data.data.city.indexOf(loc)1878 if (bb >= 0) {1879 usesIp = ffff["0"].text.split("IP: ")[1];1880 break;1881 } else {1882 var iploser = ffff["0"].text.indexOf("string")1883 if (iploser >= 0) {1884 await elementClick(xky, "ç¡®å®", 2);1885 }1886 }1887 }1888 await elementClick(xky, "ç¡®å®", 2);1889 return usesIp;1890 case 2:1891 await elementClick(xky, "stop.lua");1892 var ewmArre = await getElementMassage(xky, "stop.lua");1893 await coordinatesClick(xky, "com.touchsprite.android:id/image_file_arrows2", 0.95, ewmArre["0"].y);1894 await elementClick(xky, "ç«å³è¿è¡");1895 await xky.sleep(2000)1896 break;1897 case 3:1898 await xky.mousedown(ewmArr["0"].x, ewmArr["0"].y);1899 await elementClick(xky, "ç¼è¾");1900 var jpyn = await getElementMassage(xky, "com.android.inputmethod.latin:id/keyboard_view", 3);1901 if (jpyn) {1902 await xky.showInputMethod();1903 await elementClick(xky, "Xè¾å
¥æ³");1904 }1905 await xky.sleep(2000);1906 await xky.mousedown(0.60, 0.57);1907 await xky.sleep(2000);1908 await xky.setClipboardText(locitionNum[loc]);1909 await xky.paste();1910 var ccc = await elementClick(xky, "ä¿å", 2);1911 if (!ccc) {1912 await elementClick(xky, "com.touchsprite.android:id/title_bar_tv_left");1913 }1914 break;1915 case 4:1916 await xky.mousedown(ewmArr["0"].x, ewmArr["0"].y);1917 await elementClick(xky, "ç¼è¾");1918 var jpyn2 = await getElementMassage(xky, "com.android.inputmethod.latin:id/keyboard_view", 3);1919 if (jpyn2) {1920 await xky.showInputMethod();1921 await elementClick(xky, "Xè¾å
¥æ³");1922 }1923 var userVpnObj = [{1924 users: "b819deee8d17ed1022f4281c4240584a",1925 password: "7eb3e95a8d4dfb67b36560ed9d6dd4ee"1926 }, {1927 users: "494ffbb1c3d2c55b523acd11ddefa0dd",1928 password: "779f9871aafe9a4d0423d6da7377d89f"1929 }, {1930 users: "f11f5dfd7b8726d9a795dbc1000e8840",1931 password: "9198ae0cedf91137086283abacbb8145"1932 }]1933 if (!args.setChuDongUser) {1934 xky.log("******请å
é
ç½®åæ°æè½éæ©è´¦å·******")1935 xky.log("******åæ°ä¸º:è´¦å·ä¸è´¦å·äºè´¦å·ä¸******")1936 xky.log("******请å
é
ç½®åæ°æè½éæ©è´¦å·******")1937 }1938 await xky.mousedown(0.54, 0.27);1939 await xky.sleep(3000);1940 switch (args.setChuDongUser) {1941 case "è´¦å·ä¸":1942 await xky.setClipboardText(userVpnObj["0"].users);1943 await xky.paste();1944 await xky.sleep(2000);1945 await xky.mousedown(0.56, 0.30);1946 await xky.sleep(2000);1947 await xky.setClipboardText(userVpnObj["0"].password);1948 await xky.paste();1949 break;1950 case "è´¦å·äº":1951 await xky.setClipboardText(userVpnObj["1"].users);1952 await xky.paste();1953 await xky.sleep(2000);1954 await xky.mousedown(0.56, 0.30);1955 await xky.sleep(2000);1956 await xky.setClipboardText(userVpnObj["1"].password);1957 await xky.paste();1958 break;1959 case "è´¦å·ä¸":1960 await xky.setClipboardText(userVpnObj["2"].users);1961 await xky.paste();1962 await xky.sleep(2000);1963 await xky.mousedown(0.56, 0.30);1964 await xky.sleep(2000);1965 await xky.setClipboardText(userVpnObj["2"].password);1966 await xky.paste();1967 break;1968 }1969 var www = await elementClick(xky, "ä¿å", 3);1970 if (!www) {1971 await elementClick(xky, "com.touchsprite.android:id/title_bar_tv_left");1972 }1973 break;1974 }1975}19761977//æ°æ®åå¨1978async function saveData(xky, xutil, appName, id, depot, account, password, mobile, nickname, rawid, city,extend) {1979 let oldData = {1980 app: appName,//APPç¼å·1981 id: id, //æ°å·ä¸å¡«, æ´æ°æ¶å¿
须填1982 depot: depot, //åºå·,è¿ä¸ªåºè¯¥å¨çé¢ä¸å¯ä»¥å¡«å,ä¸æ¯åæ»ç1983 account: account, //微信账å·æ²¡æå¯ä»¥ä¸å¡«1984 password: password,//å¯ç 1985 mobile: mobile,//ææº
...
nvD3Events.js
Source:nvD3Events.js
1function processEvents(chart, scope) {2 if (chart.dispatch) {3 if (chart.dispatch.tooltipShow) {4 chart.dispatch.on('tooltipShow.directive', function (event) {5 scope.$emit('tooltipShow.directive', event);6 });7 }8 if (chart.dispatch.tooltipHide) {9 chart.dispatch.on('tooltipHide.directive', function (event) {10 scope.$emit('tooltipHide.directive', event);11 });12 }13 if (chart.dispatch.beforeUpdate) {14 chart.dispatch.on('beforeUpdate.directive', function (event) {15 scope.$emit('beforeUpdate.directive', event);16 });17 }18 if (chart.dispatch.stateChange) {19 chart.dispatch.on('stateChange.directive', function (event) {20 scope.$emit('stateChange.directive', event);21 });22 }23 if (chart.dispatch.changeState) {24 chart.dispatch.on('changeState.directive', function (event) {25 scope.$emit('changeState.directive', event);26 });27 }28 }29 if (chart.lines) {30 chart.lines.dispatch.on('elementMouseover.tooltip.directive', function (event) {31 scope.$emit('elementMouseover.tooltip.directive', event);32 });33 chart.lines.dispatch.on('elementMouseout.tooltip.directive', function (event) {34 scope.$emit('elementMouseout.tooltip.directive', event);35 });36 chart.lines.dispatch.on('elementClick.directive', function (event) {37 scope.$emit('elementClick.directive', event);38 });39 }40 if (chart.stacked && chart.stacked.dispatch) {41 chart.stacked.dispatch.on('areaClick.toggle.directive', function (event) {42 scope.$emit('areaClick.toggle.directive', event);43 });44 chart.stacked.dispatch.on('tooltipShow.directive', function (event) {45 scope.$emit('tooltipShow.directive', event);46 });47 chart.stacked.dispatch.on('tooltipHide.directive', function (event) {48 scope.$emit('tooltipHide.directive', event);49 });50 }51 if (chart.interactiveLayer) {52 if (chart.interactiveLayer.elementMouseout) {53 chart.interactiveLayer.dispatch.on('elementMouseout.directive', function (event) {54 scope.$emit('elementMouseout.directive', event);55 });56 }57 if (chart.interactiveLayer.elementMousemove) {58 chart.interactiveLayer.dispatch.on('elementMousemove.directive', function (event) {59 scope.$emit('elementMousemove.directive', event);60 });61 }62 }63 if (chart.discretebar) {64 chart.discretebar.dispatch.on('elementMouseover.tooltip.directive', function (event) {65 scope.$emit('elementMouseover.tooltip.directive', event);66 });67 chart.discretebar.dispatch.on('elementMouseout.tooltip.directive', function (event) {68 scope.$emit('elementMouseover.tooltip.directive', event);69 });70 chart.discretebar.dispatch.on('elementClick.directive', function (event) {71 scope.$emit('elementClick.directive', event);72 });73 }74 if (chart.multibar) {75 chart.multibar.dispatch.on('elementMouseover.tooltip.directive', function (event) {76 scope.$emit('elementMouseover.tooltip.directive', event);77 });78 chart.multibar.dispatch.on('elementMouseout.tooltip.directive', function (event) {79 scope.$emit('elementMouseover.tooltip.directive', event);80 });81 chart.multibar.dispatch.on('elementClick.directive', function (event) {82 scope.$emit('elementClick.directive', event);83 });84 }85 if (chart.pie) {86 chart.pie.dispatch.on('elementMouseover.tooltip.directive', function (event) {87 scope.$emit('elementMouseover.tooltip.directive', event);88 });89 chart.pie.dispatch.on('elementMouseout.tooltip.directive', function (event) {90 scope.$emit('elementMouseover.tooltip.directive', event);91 });92 93 chart.pie.dispatch.on('elementClick.directive', function(event) {94 scope.$emit('elementClick.directive', event);95 });96 }97 if (chart.scatter) {98 chart.scatter.dispatch.on('elementMouseover.tooltip.directive', function (event) {99 scope.$emit('elementMouseover.tooltip.directive', event);100 });101 chart.scatter.dispatch.on('elementMouseout.tooltip.directive', function (event) {102 scope.$emit('elementMouseover.tooltip.directive', event);103 });104 }105 if (chart.bullet) {106 chart.bullet.dispatch.on('elementMouseover.tooltip.directive', function (event) {107 scope.$emit('elementMouseover.tooltip.directive', event);108 });109 chart.bullet.dispatch.on('elementMouseout.tooltip.directive', function (event) {110 scope.$emit('elementMouseover.tooltip.directive', event);111 });112 }113 if (chart.legend) {114 //'legendClick', 'legendDblclick', 'legendMouseover'115 //stateChange116 chart.legend.dispatch.on('stateChange.legend.directive', function (event) {117 scope.$emit('stateChange.legend.directive', event);118 });119 chart.legend.dispatch.on('legendClick.directive', function (d, i) {120 scope.$emit('legendClick.directive', d, i);121 });122 chart.legend.dispatch.on('legendDblclick.directive', function (d, i) {123 scope.$emit('legendDblclick.directive', d, i);124 });125 chart.legend.dispatch.on('legendMouseover.directive', function (d, i) {126 scope.$emit('legendMouseover.directive', d, i);127 });128 }129 if (chart.controls) {130 if (chart.controls.legendClick) {131 chart.controls.dispatch.on('legendClick.directive', function (d, i) {132 scope.$emit('legendClick.directive', d, i);133 });134 }135 }...
Signup.spec.js
Source:Signup.spec.js
...15 afterEach(async () => {16 await driver.reset();17 });18 it('Signup with invalid age', async () =>{19 await driver.elementClick(SignupPOM.signupButtonPOM() );20 await driver.elementClick(SignupPOM.emailSignupButtonPOM() );21 22 await driver.elementSendKeys(SignupPOM.ageTextBoxPOM(),"10");23 24 await driver.elementClick(SignupPOM.ageNextButtonPOM() );25 26 const assertion = await ScreenContains("next")27 driver.waitUntil (()=>assertion)28 })29 30 it('Signup with invalid email', async () => {31 32 await driver.elementClick( SignupPOM.signupButtonPOM() );33 await driver.elementClick( SignupPOM.emailSignupButtonPOM() );34 35 await driver.elementSendKeys( SignupPOM.ageTextBoxPOM(),"20");36 37 await driver.elementClick( SignupPOM.ageNextButtonPOM() );38 39 await driver.elementSendKeys( SignupPOM.nameTextBoxPOM(),"ssthsrth2lm");40 41 await driver.elementSendKeys( SignupPOM.emailTextBoxPOM(),"ziadgmail.com");42 43 await driver.elementSendKeys( SignupPOM.passwordTextBoxPOM(),"Qwer1234##");44 await driver.elementClick( SignupPOM.signupDoneButtonPOM() );45 46 })47 48 it('Signup with invalid blog name', async () => {49 50 await driver.elementClick( SignupPOM.signupButtonPOM() );51 await driver.elementClick( SignupPOM.emailSignupButtonPOM() );52 53 await driver.elementSendKeys( SignupPOM.ageTextBoxPOM(),"20");54 55 await driver.elementClick( SignupPOM.ageNextButtonPOM() );56 57 await driver.elementSendKeys( SignupPOM.emailTextBoxPOM(),"ziad@gmail.com");58 59 await driver.elementSendKeys( SignupPOM.passwordTextBoxPOM(),"Qwer1234##");60 await driver.elementClick( SignupPOM.signupDoneButtonPOM() );61 })62 63 it('Signup with invalid password name', async () => {64 65 await driver.elementClick( SignupPOM.signupButtonPOM() );66 await driver.elementClick( SignupPOM.emailSignupButtonPOM() );67 68 await driver.elementSendKeys( SignupPOM.ageTextBoxPOM(),"20");69 70 await driver.elementClick( SignupPOM.ageNextButtonPOM() );71 72 await driver.elementSendKeys( SignupPOM.nameTextBoxPOM(),"ssthsrth2lm");73 74 await driver.elementSendKeys( SignupPOM.emailTextBoxPOM(),"ziad@gmail.com");75 76 await driver.elementSendKeys( SignupPOM.passwordTextBoxPOM(),"Qw");77 await driver.elementClick( SignupPOM.signupDoneButtonPOM() );78 79 })80 81 it('Full valid test', async () => {82 83 await driver.elementClick( SignupPOM.signupButtonPOM() );84 await driver.elementClick( SignupPOM.emailSignupButtonPOM() );85 86 await driver.elementSendKeys( SignupPOM.ageTextBoxPOM(),"20");87 88 await driver.elementClick( SignupPOM.ageNextButtonPOM() );89 90 await driver.elementSendKeys( SignupPOM.nameTextBoxPOM(),"fdbfdb");91 92 await driver.elementSendKeys( SignupPOM.emailTextBoxPOM(),"ziadfgsg@gmail.com");93 94 await driver.elementSendKeys( SignupPOM.passwordTextBoxPOM(),"Qwfdgs131$#!");95 await driver.elementClick( SignupPOM.signupDoneButtonPOM() );96 })...
utilsLogin.js
Source:utilsLogin.js
...12// const HomePOM = new Home();13module.exports.LoginWithEmail = async () => {14 const LoginButton = LoginPOM.loginButtonPOM();15 const SignupButton = SignupPOM.signupButtonPOM();16 await driver.elementClick(LoginButton);17 const LoginWithEmailButton = LoginPOM.loginWithEmailButtonPOM();18 await driver.elementClick(LoginWithEmailButton);19}20module.exports.EnterEmail = async (inputEmail = '') => {21 // inputEmail = inputEmail === '' ? 'email' : inputEmail;22 let EmailField = LoginPOM.emailFieldPOM();23 let ContinueButton = LoginPOM.ContinueButtonPOM();24 await driver.elementSendKeys(EmailField, inputEmail);25 let email = await driver.getElementText(EmailField);26 expect(email).toBe(inputEmail);27 await driver.elementClick(ContinueButton);28 EmailField = LoginPOM.email2FieldPOM();29 ContinueButton = LoginPOM.EnterPasswordButtonPOM();30 let EmailClear = LoginPOM.email2FieldClearPOM();31 email = await driver.getElementText(EmailField);32 expect(email).toBe(inputEmail);33 await driver.elementClick(ContinueButton);34}35module.exports.EnterPassword = async (inputEmail = '', inputPassword = '') => {36 // inputEmail = inputEmail === '' ? 'email' : inputEmail;37 // inputPassword = inputPassword === '' ? 'password' : inputPassword;38 let EmailField = LoginPOM.email3FieldPOM();39 let PasswordField = LoginPOM.passwordFieldPOM();40 let EmailClear = LoginPOM.email3FieldClearPOM();41 let PasswordShow = LoginPOM.showPasswordButtonPOM();42 let email = await driver.getElementText(EmailField);43 expect(email).toBe(inputEmail);44 await driver.elementSendKeys(PasswordField, inputPassword);45 await driver.elementClick(PasswordShow);46 await driver.elementClick(PasswordShow);47 await driver.elementClick(PasswordShow);48 await driver.elementClick(PasswordShow);49 let password = await driver.getElementText(PasswordField);50 expect(password).toBe(inputPassword);51 // expect(password).not.toBe(inputPassword);52}53module.exports.EmptyEmailPasswordAssertion = async (email, password) => {54 const emailText = await driver.getElementText(LoginPOM.email3FieldPOM());55 const passwordText = await driver.getElementText(LoginPOM.passwordFieldPOM());56 expect(emailText.toString()).toBe(email);57 expect(passwordText.toString()).toBe(password);58}59module.exports.SuccessLoginAssertion = async (email, password) => {60 await driver.elementClick(HomePOM.HomeScreenButton());61 await driver.elementClick(HomePOM.SearchScreenButton());62 await driver.elementClick(HomePOM.MessageScreenButton());63 await driver.elementClick(HomePOM.ProfileScreenButton());...
init.js
Source:init.js
1$(document).ready(function(){23 $('.owl-carousel').owlCarousel({4 loop:false,5 margin:0,6 nav:true,7 items:1,8 autoHeight:true,9 dots:false,10 navSpeed:30011 })12 13 $('.element-1').lightGallery({1415 });16 1718 $('.menu-burger__header').click(function(){19 $('.menu-burger__header').toggleClass('open-menu');20 $('.header-inner .nav').toggleClass('open-menu');21 $('.shadow').toggleClass('active');22 });2324 $("a.footer-link").click(function() {25 var elementClick = $(this).attr("href")26 var destination = $(elementClick).offset().top;27 jQuery("html:not(:animated),body:not(:animated)").animate({28 scrollTop: destination29 }, 800);30 return false;31 }); 3233 $("a.catalog1").click(function() {34 var elementClick = $(this).attr("href")35 var destination = $(elementClick).offset().top;36 jQuery("html:not(:animated),body:not(:animated)").animate({37 scrollTop: destination38 }, 800);39 return false;40 });4142 $("a.about1").click(function() {43 var elementClick = $(this).attr("href")44 var destination = $(elementClick).offset().top;45 jQuery("html:not(:animated),body:not(:animated)").animate({46 scrollTop: destination47 }, 800);48 return false;49});50 51 $("a.stages1").click(function() {52 var elementClick = $(this).attr("href")53 var destination = $(elementClick).offset().top;54 jQuery("html:not(:animated),body:not(:animated)").animate({55 scrollTop: destination56 }, 800);57 return false;58 });59 60 $("a.vorteile1").click(function() {61 var elementClick = $(this).attr("href")62 var destination = $(elementClick).offset().top;63 jQuery("html:not(:animated),body:not(:animated)").animate({64 scrollTop: destination65 }, 800);66 return false;67 });68 69 $("a.gallery1").click(function() {70 var elementClick = $(this).attr("href")71 var destination = $(elementClick).offset().top;72 jQuery("html:not(:animated),body:not(:animated)").animate({73 scrollTop: destination74 }, 800);75 return false;76 });77 78 $("a.contacts1").click(function() {79 var elementClick = $(this).attr("href")80 var destination = $(elementClick).offset().top;81 jQuery("html:not(:animated),body:not(:animated)").animate({82 scrollTop: destination83 }, 800);84 return false;85 });
...
main.js
Source:main.js
1$(function (){2 $("a.btn").click(function() {3 var elementClick = $(this).attr("href")4 var destination = $(elementClick).offset().top;5 jQuery("html:not(:animated),body:not(:animated)").animate({6 scrollTop: destination7 }, 800);8 return false;9 });10 $('a.call-btn').click( function(event){11 event.preventDefault();12 $('#myOverlay').fadeIn(297, function(){13 $('#myModal') 14 .css('display', 'block')15 .animate({opacity: 1}, 198);16 });17 });1819 $('#myModal__close, #myOverlay').click( function(){20 $('#myModal').animate({opacity: 0}, 198, function(){21 $(this).css('display', 'none');22 $('#myOverlay').fadeOut(297);23 });24 });25 $('.btn-routs').click(function (e) {26 e.preventDefault();27 $('.destinations-more').toggleClass('destinations-visible');28 if ($('.destinations-more').hasClass('destinations-visible')) {29 $(this).text('СвеÑнÑÑÑ');30 }31 else {32 $(this).text('СмоÑÑеÑÑ ÐµÑе ÑÑÑанÑ');33 }34 });35 $("a.where").click(function() {36 var elementClick = $(this).attr("href")37 var destination = $(elementClick).offset().top;38 jQuery("html:not(:animated),body:not(:animated)").animate({39 scrollTop: destination40 }, 800);41 return false;42 });43 $("a.about").click(function() {44 var elementClick = $(this).attr("href")45 var destination = $(elementClick).offset().top;46 jQuery("html:not(:animated),body:not(:animated)").animate({47 scrollTop: destination48 }, 800);49 return false;50 });51 $("a.cont").click(function() {52 var elementClick = $(this).attr("href")53 var destination = $(elementClick).offset().top;54 jQuery("html:not(:animated),body:not(:animated)").animate({55 scrollTop: destination56 }, 800);57 return false;58 });59 $("a.arrow").click(function() {60 var elementClick = $(this).attr("href")61 var destination = $(elementClick).offset().top;62 jQuery("html:not(:animated),body:not(:animated)").animate({63 scrollTop: destination64 }, 800);65 return false;66 });
...
index.js
Source:index.js
1const list = document.querySelector(".taskList");2const submit = document.querySelector(".submit");3const inputTask = document.querySelector(".task");45const createTask = (value) => {6 const elementLi = document.createElement("li");7 const contentLi = document.createTextNode(value);8 elementLi.appendChild(contentLi);9 elementLi.appendChild(createDeleteBtn());10 list.appendChild(elementLi);11 inputTask.value = "";12};1314const createDeleteBtn = () => {15 const elementBtn = document.createElement("button");16 elementBtn.appendChild(document.createTextNode("X"));17 elementBtn.classList.add("remove");18 return elementBtn;19};202122document.addEventListener("click", (e) => {23 const elementClick = e.target;24 console.log(elementClick.tagName);2526 if (elementClick.classList.contains("submit")) {27 const value = inputTask.value;28 const valueLong = value.length;29 if (valueLong > 0) createTask(value);30 };31 if (elementClick.tagName === "LI") {32 elementClick.classList.toggle("complete");33 }34 if (elementClick.classList.contains("remove")) {35 const elementDelete = elementClick.parentNode;36 list.removeChild(elementDelete);37 }
...
backend.js
Source:backend.js
1$(function () {2 $("a.skroll").click(function () {3 let elementClick = $(this).attr("href")4 let destination = $(elementClick).offset().top;5 $("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination }, 1000);6 return false;7 });8});910$(function () {11 $("a.skroll_1").click(function () {12 let elementClick = $(this).attr("href")13 let destination = $(elementClick).offset().top;14 $("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination }, 1000);15 return false;16 });17});1819$(function () {20 $("a.skroll_2").click(function () {21 let elementClick = $(this).attr("href")22 let destination = $(elementClick).offset().top;23 $("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination }, 1000);24 return false;25 });26});2728$(function () {29 $("a.skroll_3").click(function () {30 let elementClick = $(this).attr("href")31 let destination = $(elementClick).offset().top;32 $("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination }, 1000);33 return false;34 });
...
Using AI Code Generation
1var webdriverio = require('webdriverio');2var options = {3 desiredCapabilities: {4 }5};6 .remote(options)7 .init()8 .setValue('#lst-ib', 'webdriverio')9 .click('#_fZl')10 .getTitle().then(function(title) {11 console.log('Title was: ' + title);12 })13 .end();
Using AI Code Generation
1describe('webdriver.io page', () => {2 it('should have the right title', () => {3 const title = browser.getTitle()4 expect(title).toEqual('WebdriverIO · Next-gen browser and mobile automation test framework for Node.js')5 browser.pause(3000)6 })7})8describe('webdriver.io page', () => {9 it('should have the right title', () => {10 const title = browser.getTitle()11 expect(title).toEqual('WebdriverIO · Next-gen browser and mobile automation test framework for Node.js')12 browser.pause(3000)13 })14})
Using AI Code Generation
1describe('webdriver.io page', () => {2 it('should have the right title', () => {3 const title = browser.getTitle()4 expect(title).toEqual('WebdriverIO · Next-gen browser and mobile automation test framework for Node.js')5 })6 it('should click on the link', () => {7 browser.elementClick('a[href="/docs/gettingstarted"]')8 })9})10browser.click('=Getting Started')11browser.click('a[href="/docs/gettingstarted"]')12browser.click('a[href="/docs/gettingstarted"]')13browser.click('a[href="/docs/gettingstarted"]')14browser.click('a[href="/docs/gettingstarted"]')15browser.click('a[href="/docs/gettingstarted"]')16browser.click('a[href="/docs/gettingstarted"]')17browser.click('a[href="/docs/gettingstarted"]')18browser.click('a[href="/docs/gettingstarted"]')19browser.click('a[href="/docs/gettingstarted"]')20browser.click('a[href="/docs/get
Using AI Code Generation
1browser.elementClick('#myElement');2browser.click('#myElement');3browser.elementSendKeys('#myElement', 'text');4browser.setValue('#myElement', 'text');5browser.execute(function() { return document.body.innerHTML; });6browser.getText('body', function(result) {7 console.log(result);8});9browser.moveToObject('#myElement', 10, 10);10browser.moveToElement('#myElement', 10, 10);11browser.pause(3000);12browser.pause(3000);13browser.frame('#myFrame');14browser.frame(null);15browser.frame('myFrame');16browser.frame(null);17browser.waitForExist('#myElement', 3000);18browser.waitForElementPresent('#myElement', 3000);19browser.waitForVisible('#myElement', 3000);20browser.waitForElementVisible('#myElement', 3000);21browser.saveScreenshot('screenshot.png');22browser.saveScreenshot('screenshot.png');23browser.getSource();24browser.getSource(function(result) {25 console.log(result);26});27browser.getTitle();28browser.getTitle(function(result) {
Using AI Code Generation
1browser.elementClick('#elementID');2browser.elementClick('#elementID');3browser.elementClick('#elementID');4browser.elementClick('#elementID');5browser.elementClick('#elementID');6browser.elementClick('#elementID');7browser.elementClick('#elementID');8browser.elementClick('#elementID');9browser.elementClick('#elementID');10browser.elementClick('#elementID');11browser.elementClick('#elementID');12browser.elementClick('#elementID');13browser.elementClick('#elementID');14browser.elementClick('#elementID');15browser.elementClick('#elementID');16browser.elementClick('#elementID');17browser.elementClick('#elementID');18browser.elementClick('#elementID');19browser.elementClick('#elementID');20browser.elementClick('#elementID');21browser.elementClick('#elementID');22browser.elementClick('#elementID');23browser.elementClick('#elementID');
Using AI Code Generation
1browser.elementClick('css selector', 'div#someId', function(err, res) {2 console.log(err, res);3});4browser.element('css selector', 'div#someId', function(err, res) {5 console.log(err, res);6 browser.elementIdClick(res.value.ELEMENT, function(err, res) {7 console.log(err, res);8 });9});10browser.element('css selector', 'div#someId', function(err, res) {11 console.log(err, res);12 browser.elementIdClick(res.value.ELEMENT, function(err, res) {13 console.log(err, res);14 });15});16browser.element(by.css('div#someId')).click();17var element = driver.findElement(By.css('div#someId'));18element.click();19driver.elementByCssSelector('div#someId').click();20driver.elementByCssSelector('div#someId').click();21browser.elementByCssSelector('div#someId').click();22browser.element('css selector', 'div#someId').click();23browser.element('css selector', 'div#someId').click();24browser.element('css selector', 'div#someId').click();25browser.element('css selector', 'div#someId').click();26browser.element('css selector', 'div#someId').click();27browser.element('css selector', 'div#someId').click();28browser.element('css selector', 'div#someId').click();29browser.element('css selector', 'div#someId').click();
Wondering what could be a next-gen browser and mobile test automation framework that is also simple and concise? Yes, that’s right, it's WebdriverIO. Since the setup is very easy to follow compared to Selenium testing configuration, you can configure the features manually thereby being the center of attraction for automation testing. Therefore the testers adopt WedriverIO to fulfill their needs of browser testing.
Learn to run automation testing with WebdriverIO tutorial. Go from a beginner to a professional automation test expert with LambdaTest WebdriverIO tutorial.
Running Your First Automation Script - Learn the steps involved to execute your first Test Automation Script using WebdriverIO since the setup is very easy to follow and the features can be configured manually.
Selenium Automation With WebdriverIO - Read more about automation testing with WebdriverIO and how it supports both browsers and mobile devices.
Browser Commands For Selenium Testing - Understand more about the barriers faced while working on your Selenium Automation Scripts in WebdriverIO, the ‘browser’ object and how to use them?
Handling Alerts & Overlay In Selenium - Learn different types of alerts faced during automation, how to handle these alerts and pops and also overlay modal in WebdriverIO.
How To Use Selenium Locators? - Understand how Webdriver uses selenium locators in a most unique way since having to choose web elements very carefully for script execution is very important to get stable test results.
Deep Selectors In Selenium WebdriverIO - The most popular automation testing framework that is extensively adopted by all the testers at a global level is WebdriverIO. Learn how you can use Deep Selectors in Selenium WebdriverIO.
Handling Dropdown In Selenium - Learn more about handling dropdowns and how it's important while performing automated browser testing.
Automated Monkey Testing with Selenium & WebdriverIO - Understand how you can leverage the amazing quality of WebdriverIO along with selenium framework to automate monkey testing of your website or web applications.
JavaScript Testing with Selenium and WebdriverIO - Speed up your Javascript testing with Selenium and WebdriverIO.
Cross Browser Testing With WebdriverIO - Learn more with this step-by-step tutorial about WebdriverIO framework and how cross-browser testing is done with WebdriverIO.
Get 100 minutes of automation test minutes FREE!!