{"id":105,"date":"2026-07-31T13:05:42","date_gmt":"2026-07-31T05:05:42","guid":{"rendered":"https:\/\/www.deartester.com\/index.php\/2026\/09\/01\/%e9%80%9a%e8%bf%87%e5%a4%a7%e6%a8%a1%e5%9e%8b%e8%a7%a3%e5%86%b3android-harmonyos%e5%8f%af%e6%8a%98%e5%8f%a0%e8%ae%be%e5%a4%87%e4%b8%8a%e7%9a%84%e5%85%bc%e5%ae%b9%e6%80%a7%e6%b5%8b%e8%af%95\/"},"modified":"2026-09-03T23:17:27","modified_gmt":"2026-09-03T15:17:27","slug":"%e9%80%9a%e8%bf%87%e5%a4%a7%e6%a8%a1%e5%9e%8b%e8%a7%a3%e5%86%b3android-harmonyos%e5%8f%af%e6%8a%98%e5%8f%a0%e8%ae%be%e5%a4%87%e4%b8%8a%e7%9a%84%e5%85%bc%e5%ae%b9%e6%80%a7%e6%b5%8b%e8%af%95","status":"publish","type":"post","link":"https:\/\/www.deartester.com\/index.php\/2026\/07\/31\/%e9%80%9a%e8%bf%87%e5%a4%a7%e6%a8%a1%e5%9e%8b%e8%a7%a3%e5%86%b3android-harmonyos%e5%8f%af%e6%8a%98%e5%8f%a0%e8%ae%be%e5%a4%87%e4%b8%8a%e7%9a%84%e5%85%bc%e5%ae%b9%e6%80%a7%e6%b5%8b%e8%af%95\/","title":{"rendered":"\u901a\u8fc7\u5927\u6a21\u578b\u89e3\u51b3Android\/HarmonyOS\u53ef\u6298\u53e0\u8bbe\u5907\u4e0a\u7684\u517c\u5bb9\u6027\u6d4b\u8bd5"},"content":{"rendered":"<table>\n<tbody>\n<tr>\n<td data-colwidth=\"576\">\n<section><span style=\"color: rgba(255, 255, 255, 0.7);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: center;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;\" data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 12px;color: #888888;font-weight: bold;\">AI \u751f\u6210\u81ea\u52a8\u5316\u811a\u672c + ADB \/ HDC \u6298\u53e0\u72b6\u6001\u63a7\u5236 + \u89c6\u89c9 AI \u5206\u6790\u4e00\u5957\u4ee3\u7801\u8dd1\u5b8c\u5c55\u5f00 \/ \u6298\u53e0\u5168\u6d41\u7a0b\uff0c\u96f6\u6b7b\u89d2\u68c0\u6d4b\u754c\u9762\u5f02\u5e38<\/span><\/span><\/span><\/section>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2 style=\"box-sizing: border-box;margin: 40px 0px 20px;padding: 0px 0px 10px;font-size: 1.3rem;color: rgb(67, 56, 202);border-bottom: 2px solid rgb(99, 102, 241);font-weight: 800;display: flex;align-items: center;gap: 8px;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\">\ud83d\udcd6 \u5bfc\u8bfb\uff1a\u5148\u770b\u771f\u5b9e\u6848\u4f8b\uff0c\u518d\u770b\u600e\u4e48\u89e3\u51b3<\/span><\/h2>\n<h3 style=\"box-sizing: border-box;margin: 16px 0px 10px;padding: 0px;font-size: 1rem;color: rgb(67, 56, 202);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u573a\u666f\u4e00\uff1a\u65b0\u95fb App \u9876\u90e8 Banner \u79bb\u5947\u6d88\u5931<\/span><\/h3>\n<p style=\"box-sizing: border-box;margin: 0px 0px 12px;padding: 0px;line-height: 1.9;color: rgb(55, 48, 163);font-size: 0.95rem;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: #797baa;\">\u67d0\u5934\u90e8\u65b0\u95fb App \u5728\u6298\u53e0\u5c4f\u5c55\u5f00\u65f6\uff0c\u9876\u90e8 Banner \u663e\u793a\u6b63\u5e38\u3002\u6298\u53e0\u624b\u673a\u540e\uff0cBanner \u533a\u57df\u76f4\u63a5\u88ab&#8221;\u622a\u65ad&#8221;\uff0c\u53ea\u5269\u534a\u622a\u6587\u5b57\u3002\u539f\u56e0\uff1aApp \u5728\u6298\u53e0\u6001\u91cd\u65b0 layout \u65f6\uff0c\u9876\u90e8\u5b89\u5168\u533a\u8ba1\u7b97\u9519\u8bef\uff0c\u628a Banner \u7684 topMargin \u5f53\u6210\u4e86\u72b6\u6001\u680f\u9ad8\u5ea6\u53e0\u52a0\uff0c\u5bfc\u81f4\u5185\u5bb9\u88ab\u63a8\u51fa\u53ef\u89c6\u533a\u3002\u8fd9\u662f\u5178\u578b\u7684\u6298\u53e0\u5c4f\u5e03\u5c40\u9002\u914d\u7f3a\u9677\u3002<\/span><\/span><\/p>\n<h3 style=\"box-sizing: border-box;margin: 16px 0px 10px;padding: 0px;font-size: 1rem;color: rgb(67, 56, 202);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u573a\u666f\u4e8c\uff1a\u7535\u5546 App \u5546\u54c1\u5361\u7247\u91cd\u53e0<\/span><\/h3>\n<p style=\"box-sizing: border-box;margin: 0px 0px 12px;padding: 0px;line-height: 1.9;color: rgb(55, 48, 163);font-size: 0.95rem;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: #797baa;\">\u4e00\u6b3e\u65e5\u6d3b 300 \u4e07\u7684\u7535\u5546 App\uff0c\u5728\u6298\u53e0\u5c4f\u5c55\u5f00\u65f6\u5546\u54c1\u5217\u8868\u4e3a 3 \u5217\u5e03\u5c40\uff1b\u6298\u53e0\u540e\u7cfb\u7edf\u5207\u6362\u5230&#8221;\u624b\u673a\u6a21\u5f0f&#8221;\uff0c\u5e03\u5c40\u9700\u8981\u91cd\u65b0\u8ba1\u7b97\u4e3a 2 \u5217\u3002\u4f46\u5f00\u53d1\u8005\u5728\u6298\u53e0\u56de\u8c03\u4e2d\u6f0f\u6389\u4e86 notifyDataSetChanged\uff0cRecyclerView \u6ca1\u6709\u5237\u65b0\u5217\u6570\uff0c\u5bfc\u81f4\u5361\u7247\u5bbd\u5ea6\u8ba1\u7b97\u9519\u8bef\u3001\u6587\u5b57\u548c\u56fe\u7247\u91cd\u53e0\u5728\u4e00\u8d77\u3002\u7528\u6237\u4ee5\u4e3a\u662f App \u5d29\u6e83\uff0c\u5b9e\u9645\u4e0a\u662f\u5e03\u5c40\u5f02\u5e38\u3002<\/span><\/span><\/p>\n<h3 style=\"box-sizing: border-box;margin: 16px 0px 10px;padding: 0px;font-size: 1rem;color: rgb(67, 56, 202);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u573a\u666f\u4e09\uff1a\u793e\u4ea4 App \u8f93\u5165\u6846\u88ab\u94f0\u94fe\u906e\u6321<\/span><\/h3>\n<p style=\"box-sizing: border-box;margin: 0px 0px 12px;padding: 0px;line-height: 1.9;color: rgb(55, 48, 163);font-size: 0.95rem;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: #797baa;\">\u67d0\u793e\u4ea4 App \u7684\u804a\u5929\u8f93\u5165\u6846\u56fa\u5b9a\u5728\u5c4f\u5e55\u5e95\u90e8 60dp \u5904\u3002\u6298\u53e0\u5c4f\u94f0\u94fe\u533a\u57df\u6070\u597d\u5728\u5c4f\u5e55\u4e2d\u95f4\u504f\u4e0b\uff0c\u6298\u53e0\u6001\u65f6\u8f93\u5165\u6846\u5e95\u90e8\u6070\u597d&#8221;\u9a91&#8221;\u5728\u94f0\u94fe\u4e0a\uff0c\u6587\u5b57\u65e0\u6cd5\u70b9\u51fb\u8f93\u5165\u3002\u8fd9\u662f\u786c\u4ef6\u7269\u7406\u7279\u6027\u4e0e\u8f6f\u4ef6\u5e03\u5c40\u7684\u51b2\u7a81\u2014\u2014\u6ca1\u6709\u6298\u53e0\u5c4f\u8bbe\u5907\u7684\u56e2\u961f\u6839\u672c\u6d4b\u4e0d\u51fa\u6765\u3002<\/span><\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"576\">\n<p data-pm-slice=\"3 2 []\"><strong style=\"box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(15, 23, 42);font-weight: 700;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: #ff2941;\">\u4f20\u7edf\u6d4b\u8bd5\u7684\u56f0\u5883\uff1a<\/span><\/span><\/strong><span leaf=\"\"><br  \/><\/span><\/p>\n<p data-pm-slice=\"3 2 []\" style=\"text-indent: 2em;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;\">\u4e00\u53f0\u6298\u53e0\u5c4f\u624b\u673a\u6570\u5343\u5143\uff0c\u56e2\u961f\u5f80\u5f80\u53ea\u6709 1-2 \u53f0\uff1b\u4eba\u5de5\u6298\u53e0\u6d4b\u8bd5\u6548\u7387\u4f4e\uff08\u6298\u53e0\u4e00\u6b21\u81f3\u5c11 10 \u79d2\uff09\u3001\u5bb9\u6613\u6f0f\u68c0\uff08\u622a\u56fe\u5bf9\u6bd4\u7eaf\u9760\u8089\u773c\uff09\u3001\u65e0\u6cd5\u56de\u5f52\uff08\u6bcf\u6b21\u53d1\u7248\u90fd\u8981\u91cd\u590d\u6298\u53e0\uff09\u3002<\/span><\/span><br style=\"box-sizing: border-box;margin: 0px;padding: 0px;\"  \/><br style=\"box-sizing: border-box;margin: 0px;padding: 0px;\"  \/><strong style=\"box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(15, 23, 42);font-weight: 700;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: #407600;\">\u672c\u6587\u7684\u89e3\u51b3\u601d\u8def\uff1a<\/span><\/span><\/strong><span leaf=\"\"><br  \/><\/span><\/p>\n<p data-pm-slice=\"3 2 []\" style=\"text-indent: 2em;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;\">AI \u751f\u6210\u811a\u672c\u81ea\u52a8\u63a7\u5236\u6298\u53e0\/\u5c55\u5f00\u72b6\u6001 + \u622a\u56fe \u2192 AI \u89c6\u89c9\u5206\u6790\u81ea\u52a8\u8bc6\u522b\u754c\u9762\u5f02\u5e38\uff0c\u4e00\u5957\u4ee3\u7801\u8986\u76d6&#8221;\u5c55\u5f00\u6267\u884c \u2192 \u6298\u53e0\u6267\u884c \u2192 AI \u5206\u6790&#8221;\u5168\u94fe\u8def\uff0c\u4efb\u4f55\u4eba\u62ff\u7740\u811a\u672c\u5728\u8bbe\u5907\u4e0a\u8dd1\u4e00\u904d\u5c31\u80fd\u51fa\u62a5\u544a\u3002<\/span><\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"box-sizing: border-box;margin: 16px 0px 10px;padding: 0px;font-size: 1rem;color: rgb(67, 56, 202);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: center;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\"><span textstyle=\"\" style=\"background-color: #ffa900;color: #021eaa;\">\u672c\u6587\u4f60\u80fd\u5f97\u5230\u4ec0\u4e48<\/span><\/span><\/p>\n<ul style=\"box-sizing: border-box;margin: 8px 0px 12px 20px;padding: 0px;color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: medium;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" class=\"list-paddingleft-1\">\n<li style=\"box-sizing: border-box;margin: 0px 0px 6px;padding: 0px;line-height: 1.7;color: rgb(55, 48, 163);font-size: 0.95rem;\">\n<section><span leaf=\"\">\u53ef\u76f4\u63a5\u590d\u5236\u7684&nbsp;<\/span><strong style=\"box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(15, 23, 42);font-weight: 700;\"><span leaf=\"\">Douyin \u6298\u53e0\u5c4f\u6d4b\u8bd5 Skill<\/span><\/strong><span leaf=\"\">\uff08Android \/ HarmonyOS \u4e24\u5957\u811a\u672c\uff09<\/span><\/section>\n<\/li>\n<li style=\"box-sizing: border-box;margin: 0px 0px 6px;padding: 0px;line-height: 1.7;color: rgb(55, 48, 163);font-size: 0.95rem;\">\n<section><span leaf=\"\">\u7528 ADB\uff08Android\uff09\u548c HDC\uff08HarmonyOS\uff09\u63a7\u5236\u6298\u53e0\u72b6\u6001\u7684\u5b8c\u6574\u4ee3\u7801<\/span><\/section>\n<\/li>\n<li style=\"box-sizing: border-box;margin: 0px 0px 6px;padding: 0px;line-height: 1.7;color: rgb(55, 48, 163);font-size: 0.95rem;\">\n<section><span leaf=\"\">\u96c6\u6210 AI \u89c6\u89c9\u5206\u6790\u7684\u81ea\u52a8\u5316\u811a\u672c\uff08\u811a\u672c\u8dd1\u5b8c \u2192 AI \u81ea\u52a8\u5206\u6790 \u2192 \u8f93\u51fa\u62a5\u544a\uff09<\/span><\/section>\n<\/li>\n<li style=\"box-sizing: border-box;margin: 0px 0px 6px;padding: 0px;line-height: 1.7;color: rgb(55, 48, 163);font-size: 0.95rem;\">\n<section><span leaf=\"\">\u521d\u5b66\u8005\u8ddf\u7740\u505a\u4e5f\u80fd\u8dd1\u901a\u7684\u5b8c\u6574\u64cd\u4f5c\u6b65\u9aa4<\/span><\/section>\n<\/li>\n<\/ul>\n<hr style=\"border-style: solid;border-width: 1px 0 0;border-color: rgba(0,0,0,0.1);-webkit-transform-origin: 0 0;-webkit-transform: scale(1, 0.5);transform-origin: 0 0;transform: scale(1, 0.5);\"  \/>\n<p data-pm-slice=\"0 0 []\"><span style=\"box-sizing: border-box;margin: 0px;padding: 3px 10px;font-size: 0.75rem;background: rgba(255, 255, 255, 0.25);border-radius: 99px;letter-spacing: 1px;font-weight: 700;\"><span leaf=\"\"><br  \/><\/span><\/span><\/p>\n<p data-pm-slice=\"0 0 []\"><span style=\"box-sizing: border-box;margin: 0px;padding: 3px 10px;font-size: 0.75rem;background: rgba(255, 255, 255, 0.25);border-radius: 99px;letter-spacing: 1px;font-weight: 700;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 18px;color: #d6a841;font-weight: bold;\">\u7b2c\u4e00\u7ae0<\/span><span textstyle=\"\" style=\"font-size: 17px;font-weight: bold;\">&nbsp;<\/span><span textstyle=\"\" style=\"font-size: 17px;color: #021eaa;font-weight: bold;\">\u6574\u4f53\u65b9\u6848\u8bbe\u8ba1\uff1aAI + \u6298\u53e0\u63a7\u5236 + \u89c6\u89c9\u5206\u6790<\/span><\/span><\/span><\/p>\n<p style=\"box-sizing: border-box;margin: 0px 0px 14px;padding: 0px;line-height: 1.9;color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: medium;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\">\u6298\u53e0\u5c4f\u517c\u5bb9\u6027\u6d4b\u8bd5\u7684\u6838\u5fc3\u95ee\u9898\u4e0d\u662f&#8221;\u811a\u672c\u600e\u4e48\u5199&#8221;\uff0c\u800c\u662f<\/span><strong style=\"box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(15, 23, 42);font-weight: 700;\"><span leaf=\"\">\u5982\u4f55\u8ba9\u811a\u672c\u81ea\u52a8\u63a7\u5236\u6298\u53e0\u72b6\u6001\u5e76\u81ea\u52a8\u5224\u65ad\u7ed3\u679c<\/span><\/strong><span leaf=\"\">\u3002\u672c\u6587\u7684\u65b9\u6848\u8bbe\u8ba1\u56f4\u7ed5\u4e09\u4e2a\u6838\u5fc3\u73af\u8282\u5c55\u5f00\uff1a<\/span><\/p>\n<h3 style=\"box-sizing: border-box;margin: 24px 0px 12px;padding: 0px;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 16px;color: #7a4fd6;\">1.1 \u5168\u6d41\u7a0b\u67b6\u6784<\/span><\/span><\/h3>\n<p style=\"box-sizing: border-box;margin: 0px 0px 14px;padding: 0px;line-height: 1.9;color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: medium;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u6574\u4e2a\u65b9\u6848\u5206\u4e3a\u4e09\u4e2a\u5c42\u6b21\uff0c\u6bcf\u5c42\u89e3\u51b3\u4e00\u4e2a\u95ee\u9898\uff1a<\/span><\/p>\n<section style=\"text-align: center;\" nodeleaf=\"\">\n<figure class=\"wx-qr-wrap\"><img decoding=\"async\" class=\"rich_pages wxw-img\" data-aistatus=\"1\" data-imgfileid=\"100000574\" data-s=\"300,640\" data-type=\"png\" type=\"block\" src=\"https:\/\/mmbiz.qpic.cn\/sz_mmbiz_png\/BWmfcibGhS1Liap7fNwRmhbe1zDkcpxLZiaNodHmDXaUaroibr0UnrlMnJZLY9WFQdxJPfjBO8UxwoSbJQpOZViaBSSvVmuialiba4O7kgUAhquRao\/640?wx_fmt=png&#038;from=appmsg\" \/><figcaption class=\"wx-qr-tip\"><img decoding=\"async\" src=\"https:\/\/www.deartester.com\/wp-content\/uploads\/2026\/09\/wechat-qr.jpg\" alt=\"\u5fae\u4fe1\u516c\u4f17\u53f7\u4e8c\u7ef4\u7801\" loading=\"lazy\"><span>\u56fe\u7247\u5f15\u81ea\u5fae\u4fe1\u516c\u4f17\u53f7\uff0c\u626b\u7801\u5173\u6ce8\u9605\u8bfb\u539f\u6587<\/span><\/figcaption><\/figure>\n<\/section>\n<p data-pm-slice=\"0 0 []\" style=\"text-align: center;\"><span style=\"box-sizing: border-box;margin: 0px;padding: 3px 10px;font-size: 0.75rem;background: rgba(255, 255, 255, 0.25);border-radius: 99px;letter-spacing: 1px;font-weight: 700;\"><span style=\"color: rgb(100, 116, 139);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: 13.12px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\" data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 12px;\">AI \u751f\u6210\u811a\u672c \u2192 \u6298\u53e0\u72b6\u6001\u63a7\u5236 \u2192 \u6267\u884c\u622a\u56fe \u2192 AI \u89c6\u89c9\u5206\u6790\uff0c\u4e09\u4e2a\u73af\u8282\u4f9d\u6b21\u8854\u63a5\u6700\u7ec8\u8f93\u51fa\u62a5\u544a<\/span><\/span><\/span><\/span><\/p>\n<h3 style=\"box-sizing: border-box;margin: 24px 0px 12px;padding: 0px;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 16px;color: #7a4fd6;\">1.2 \u5de5\u5177\u94fe\u8bf4\u660e<\/span><\/span><\/h3>\n<table style=\"box-sizing: border-box;margin: 16px 0px;padding: 0px;width: 864px;border-collapse: collapse;font-size: 0.9rem;color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\">\n<tbody>\n<tr style=\"box-sizing: border-box;margin: 0px;padding: 0px;\">\n<th style=\"box-sizing: border-box;margin: 0px;padding: 10px 14px;background: none 0% 0% \/ auto repeat scroll padding-box border-box rgb(15, 23, 42);color: rgb(255, 255, 255);text-align: left;font-weight: 700;\">\n<section style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;color: #d6a841;\">\u5de5\u5177<\/span><\/span><\/section>\n<\/th>\n<th style=\"box-sizing: border-box;margin: 0px;padding: 10px 14px;background: none 0% 0% \/ auto repeat scroll padding-box border-box rgb(15, 23, 42);color: rgb(255, 255, 255);text-align: left;font-weight: 700;\">\n<section style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;color: #d6a841;\">\u7528\u9014<\/span><\/span><\/section>\n<\/th>\n<th style=\"box-sizing: border-box;margin: 0px;padding: 10px 14px;background: none 0% 0% \/ auto repeat scroll padding-box border-box rgb(15, 23, 42);color: rgb(255, 255, 255);text-align: left;font-weight: 700;\">\n<section style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;color: #d6a841;\">\u5907\u6ce8<\/span><\/span><\/section>\n<\/th>\n<\/tr>\n<tr style=\"box-sizing: border-box;margin: 0px;padding: 0px;\">\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);background: rgb(248, 250, 252);\">\n<section><span leaf=\"\">Appium + UiAutomator2<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);background: rgb(248, 250, 252);\">\n<section><span leaf=\"\">Android \u7aef UI \u81ea\u52a8\u5316<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);background: rgb(248, 250, 252);\">\n<section><span leaf=\"\">\u63a7\u5236 APP \u64cd\u4f5c\u4e0e\u622a\u56fe<\/span><\/section>\n<\/td>\n<\/tr>\n<tr style=\"box-sizing: border-box;margin: 0px;padding: 0px;\">\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);\">\n<section><span leaf=\"\">Appium + HarmonyOS \u9a71\u52a8<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);\">\n<section><span leaf=\"\">HarmonyOS \u7aef UI \u81ea\u52a8\u5316<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);\">\n<section><span leaf=\"\">\u901a\u8fc7 DevEco \u5de5\u5177\u94fe\u8fde\u63a5<\/span><\/section>\n<\/td>\n<\/tr>\n<tr style=\"box-sizing: border-box;margin: 0px;padding: 0px;\">\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);background: rgb(248, 250, 252);\">\n<section><span leaf=\"\">ADB<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);background: rgb(248, 250, 252);\">\n<section><span leaf=\"\">Android \u6298\u53e0\u72b6\u6001\u63a7\u5236<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);background: rgb(248, 250, 252);\">\n<section><span leaf=\"\">wm size \u5207\u6362\u5206\u8fa8\u7387\u6a21\u62df\u6298\u53e0<\/span><\/section>\n<\/td>\n<\/tr>\n<tr style=\"box-sizing: border-box;margin: 0px;padding: 0px;\">\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);\">\n<section><span leaf=\"\">HDC<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);\">\n<section><span leaf=\"\">HarmonyOS \u6298\u53e0\u72b6\u6001\u63a7\u5236<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);\">\n<section><span leaf=\"\">hdc shell bm setDisplayMode<\/span><\/section>\n<\/td>\n<\/tr>\n<tr style=\"box-sizing: border-box;margin: 0px;padding: 0px;\">\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);background: rgb(248, 250, 252);\">\n<section><span leaf=\"\">\u901a\u4e49\u5343\u95ee \/ GPT-4V<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);background: rgb(248, 250, 252);\">\n<section><span leaf=\"\">AI \u89c6\u89c9\u5206\u6790<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);background: rgb(248, 250, 252);\">\n<section><span leaf=\"\">\u5206\u6790\u622a\u56fe\uff0c\u8f93\u51fa\u5f02\u5e38\u63cf\u8ff0<\/span><\/section>\n<\/td>\n<\/tr>\n<tr style=\"box-sizing: border-box;margin: 0px;padding: 0px;\">\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);\">\n<section><span leaf=\"\">Python requests<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);\">\n<section><span leaf=\"\">\u8c03\u7528\u89c6\u89c9\u6a21\u578b API<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);\">\n<section><span leaf=\"\">\u4e0e Appium \u811a\u672c\u96c6\u6210\u5728\u540c\u4e00\u6587\u4ef6<\/span><\/section>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3 style=\"box-sizing: border-box;margin: 24px 0px 12px;padding: 0px;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 16px;color: #7a4fd6;\">1.3 \u6298\u53e0\u5c4f\u6d4b\u8bd5\u7684\u7279\u6b8a\u6027<\/span><\/span><\/h3>\n<p style=\"box-sizing: border-box;margin: 0px 0px 14px;padding: 0px;line-height: 1.9;color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: medium;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u6298\u53e0\u5c4f\u517c\u5bb9\u6027\u6d4b\u8bd5\u548c\u666e\u901a\u517c\u5bb9\u6027\u6d4b\u8bd5\u6709\u4e09\u4e2a\u672c\u8d28\u533a\u522b\uff1a<\/span><\/p>\n<ol style=\"box-sizing: border-box;margin: 8px 0px 14px 24px;padding: 0px;color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: medium;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" class=\"list-paddingleft-1\">\n<li style=\"box-sizing: border-box;margin: 0px 0px 6px;padding: 0px;line-height: 1.8;\"><strong style=\"box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(15, 23, 42);font-weight: 700;\"><span leaf=\"\">\u5206\u8fa8\u7387\u7a81\u53d8<\/span><\/strong><br \/>\n<section><span leaf=\"\">\uff1a\u6298\u53e0\u6001\u548c\u5c55\u5f00\u6001\u7684\u5206\u8fa8\u7387\u5b8c\u5168\u4e0d\u540c\uff08\u5e38\u89c1\u5982\u5c55\u5f00 2200\u00d71840 vs \u6298\u53e0 984\u00d72096\uff09\uff0c\u5e03\u5c40\u4f1a\u91cd\u65b0\u8ba1\u7b97<\/span><\/section>\n<\/li>\n<li style=\"box-sizing: border-box;margin: 0px 0px 6px;padding: 0px;line-height: 1.8;\"><strong style=\"box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(15, 23, 42);font-weight: 700;\"><span leaf=\"\">\u94f0\u94fe\u533a\u57df<\/span><\/strong><br \/>\n<section><span leaf=\"\">\uff1a\u5c4f\u5e55\u4e2d\u95f4\u6709\u7269\u7406\u94f0\u94fe\uff0c\u5185\u5bb9\u4e0d\u80fd\u8986\u76d6\u94f0\u94fe\u533a\u57df\uff0c\u5426\u5219\u663e\u793a\u5f02\u5e38\u6216\u89e6\u63a7\u5931\u7075<\/span><\/section>\n<\/li>\n<li style=\"box-sizing: border-box;margin: 0px 0px 6px;padding: 0px;line-height: 1.8;\"><strong style=\"box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(15, 23, 42);font-weight: 700;\"><span leaf=\"\">\u72b6\u6001\u5207\u6362\u5ef6\u8fdf<\/span><\/strong><br \/>\n<section><span leaf=\"\">\uff1a\u6298\u53e0 \/ \u5c55\u5f00\u64cd\u4f5c\u540e\uff0cApp \u6536\u5230\u72b6\u6001\u53d8\u66f4\u56de\u8c03\u9700\u8981\u65f6\u95f4\u5237\u65b0 UI\uff0c\u8fd9\u4e2a\u65f6\u95f4\u7a97\u53e3\u5185\u622a\u56fe\u53ef\u80fd\u51fa\u73b0&#8221;\u8fc7\u6e21\u6001&#8221;\uff08\u534a\u6e32\u67d3\u72b6\u6001\uff09\uff0c\u9700\u8981\u7b49\u5f85<\/span><\/section>\n<\/li>\n<\/ol>\n<p style=\"box-sizing: border-box;margin: 0px 0px 14px;padding: 0px;line-height: 1.9;color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: medium;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 12px;color: #888888;\">\u672c\u6587\u7684\u89e3\u51b3\u65b9\u6848\u6b63\u662f\u56f4\u7ed5\u8fd9\u4e09\u4e2a\u7279\u6b8a\u6027\u8bbe\u8ba1\u7684\uff1a\u6298\u53e0\u63a7\u5236\u901a\u8fc7 ADB \/ HDC \u5b9e\u73b0\u3001\u622a\u56fe\u540e\u7b49\u5f85 UI \u7a33\u5b9a\u3001AI \u5206\u6790\u4e24\u6b21\u72b6\u6001\u4e0b\u7684\u622a\u56fe\u5dee\u5f02\u3002<\/span><\/span><\/p>\n<hr style=\"border-style: solid;border-width: 1px 0 0;border-color: rgba(0,0,0,0.1);-webkit-transform-origin: 0 0;-webkit-transform: scale(1, 0.5);transform-origin: 0 0;transform: scale(1, 0.5);\"  \/>\n<p data-pm-slice=\"0 0 []\"><span style=\"box-sizing: border-box;margin: 0px;padding: 3px 10px;font-size: 0.75rem;background: rgba(255, 255, 255, 0.25);border-radius: 99px;letter-spacing: 1px;font-weight: 700;\"><span leaf=\"\"><br  \/><\/span><\/span><\/p>\n<p data-pm-slice=\"0 0 []\"><span><span leaf=\"\" style=\"box-sizing: border-box;margin: 0px;padding: 3px 10px;font-size: 0.75rem;background: rgba(255, 255, 255, 0.25);border-radius: 99px;letter-spacing: 1px;font-weight: 700;\"><span textstyle=\"\" style=\"font-size: 18px;color: #d6a841;font-weight: bold;\">\u7b2c\u4e8c\u7ae0&nbsp;<\/span><span textstyle=\"\" style=\"font-size: 17px;color: #021eaa;font-weight: bold;\">AI\u751f\u6210\u811a\u672c + Skill\u8bbe\u8ba1\uff08\u4f7f\u7528<\/span><span textstyle=\"\" style=\"font-size: 17px;color: #d6a841;font-weight: bold;text-decoration: underline;\">\u6296\u97f3APP<\/span><span textstyle=\"\" style=\"font-size: 17px;color: #021eaa;font-weight: bold;\">\u6a21\u62df\u6f14\u793a\uff09<\/span><\/span><\/span><\/p>\n<p style=\"box-sizing: border-box;margin: 0px 0px 14px;padding: 0px;line-height: 1.9;color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: medium;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;\">\u8bbe\u8ba1\u601d\u8def\u548c Skill \u6784\u5efa\u7684\u5b8c\u6574\u65b9\u6cd5\u8bba\u5df2\u5728\u516c\u4f17\u53f7\u4e0a\u4e00\u7bc7\u6587\u7ae0<\/span><a class=\"normal_text_link mp_article_text_link\" target=\"_blank\" style=\"\" href=\"https:\/\/mp.weixin.qq.com\/s?__biz=MzU1MDAyMzgzNw==&amp;mid=2247484192&amp;idx=1&amp;sn=9d36363e795f4d90ae1c110308c48c83&amp;scene=21#wechat_redirect\" textvalue=\"\u300a\u4f7f\u7528\u5927\u6a21\u578b\u5b9e\u73b0APP\u81ea\u52a8\u5316\u6d4b\u8bd5\uff1aAndroid\u3001iOS\u3001HarmonyOS\u4e00\u6b21\u641e\u5b9a\u300b\" data-itemshowtype=\"0\" linktype=\"text\" data-linktype=\"2\"><span textstyle=\"\" style=\"font-size: 15px;\">\u300a\u4f7f\u7528\u5927\u6a21\u578b\u5b9e\u73b0APP\u81ea\u52a8\u5316\u6d4b\u8bd5\uff1aAndroid\u3001iOS\u3001HarmonyOS\u4e00\u6b21\u641e\u5b9a\u300b<\/span><\/a><span textstyle=\"\" style=\"font-size: 15px;\">\u4e2d\u8be6\u7ec6\u8bb2\u89e3\u8fc7\uff0c\u672c\u6587\u4e0d\u518d\u91cd\u590d\u3002\u4e0b\u9762\u76f4\u63a5\u7ed9\u51fa<\/span><\/span><strong style=\"box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(15, 23, 42);font-weight: 700;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;\">\u672c\u7ae0\u914d\u5957\u7684\u6298\u53e0\u5c4f\u6d4b\u8bd5 Skill<\/span><\/span><\/strong><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;\">\uff0c\u628a\u8fd9\u4efd\u5185\u5bb9\u53d1\u7ed9 AI\uff0c\u5c31\u80fd\u751f\u6210\u53ef\u76f4\u63a5\u8fd0\u884c\u7684\u6298\u53e0\u5c4f\u6d4b\u8bd5\u811a\u672c\u3002<\/span><\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"576\">\n<p data-pm-slice=\"3 2 []\"><strong style=\"box-sizing: border-box;margin: 0px 0px 4px;padding: 0px;color: rgb(15, 23, 42);font-weight: 700;display: block;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: #407600;\">\u4f7f\u7528\u65b9\u5f0f<\/span>\uff1a<span textstyle=\"\" style=\"font-size: 15px;font-weight: normal;\">\u590d\u5236\u4e0b\u65b9 Skill \u5185\u5bb9\uff0c\u53d1\u7ed9\u901a\u4e49\u5343\u95ee\uff08\u6216\u5176\u4ed6\u652f\u6301\u4ee3\u7801\u751f\u6210\u7684\u5927\u6a21\u578b\uff09\uff0c\u7136\u540e\u53d1\u9001\u4f60\u7684\u6d4b\u8bd5\u9700\u6c42\u3002<\/span><\/span><\/strong><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3 style=\"box-sizing: border-box;margin: 24px 0px 12px;padding: 0px;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 16px;color: #7a4fd6;\">2.1 \u6298\u53e0\u5c4f\u6d4b\u8bd5 Skill\uff08<\/span><span textstyle=\"\" style=\"font-size: 16px;color: #ff2941;\">Android<\/span><span textstyle=\"\" style=\"font-size: 16px;color: #7a4fd6;\">\uff09<\/span><\/span><\/h3>\n<p><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;background-color: #00d5ff;color: #ffffff;font-weight: bold;\">SKILL.md\u2014\u6298\u53e0\u5c4f\u6d4b\u8bd5\uff08<\/span><span textstyle=\"\" style=\"font-size: 15px;background-color: #00d5ff;color: #ff2941;font-weight: bold;\">Android<\/span><span textstyle=\"\" style=\"font-size: 15px;background-color: #00d5ff;color: #ffffff;font-weight: bold;\">\uff09<\/span><\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"python\"><code><span leaf=\"\"><span class=\"code-snippet__comment\"># \u6296\u97f3-\u6298\u53e0\u5c4f\u81ea\u52a8\u5316\u6d4b\u8bd5 Skill<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\">## \u89d2\u8272\u5b9a\u4e49<\/span><\/span><\/code><code><span leaf=\"\">\u4f60\u662f\u4e00\u540d\u8d44\u6df1 Android \u81ea\u52a8\u5316\u6d4b\u8bd5\u5de5\u7a0b\u5e08\uff0c\u7cbe\u901a Appium + Python\uff0c\u719f\u6089\u6298\u53e0\u5c4f\u8bbe\u5907\u7279\u6027\u3002<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\">## \u6d4b\u8bd5\u76ee\u6807<\/span><\/span><\/code><code><span leaf=\"\">\u9a8c\u8bc1\u6296\u97f3 APP\uff08com.ss.android.ugc.aweme\uff09\u5728\u6298\u53e0\u5c4f\u5c55\u5f00\u6001\u548c\u6298\u53e0\u6001\u4e0b\u7684\u754c\u9762\u517c\u5bb9\u6027\u3002<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\">## APP \u4fe1\u606f<\/span><\/span><\/code><code><span leaf=\"\">- \u5305\u540d\uff1acom.ss.android.ugc.aweme<\/span><\/code><code><span leaf=\"\">- \u4e3b Activity\uff1acom.ss.android.ugc.aweme.main.MainActivity<\/span><\/code><code><span leaf=\"\">- \u5b89\u88c5\u6765\u6e90\uff1a\u5e94\u7528\u5e02\u573a<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\">## \u6d4b\u8bd5\u6b65\u9aa4\uff08\u6bcf\u6b21\u6298\u53e0\u72b6\u6001\u6267\u884c\uff09<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__number\">1.<\/span>&nbsp;\u542f\u52a8\u6296\u97f3 APP\uff0c\u7b49\u5f85 APP \u5b8c\u5168\u542f\u52a8\uff08\u9996\u9875\u89c6\u9891\u6d41\u51fa\u73b0\uff09<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__number\">2.<\/span>&nbsp;\u5728\u9996\u9875\u641c\u7d22\u6846\u8f93\u5165\u6587\u5b57\u300cAPP\u81ea\u52a8\u5316\u6d4b\u8bd5\u300d<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__number\">3.<\/span>&nbsp;\u70b9\u51fb\u641c\u7d22\u6309\u94ae\uff0c\u89e6\u53d1\u641c\u7d22<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__number\">4.<\/span>&nbsp;\u6309 Back \u952e\u9000\u51fa\u641c\u7d22\u9875\uff0c\u56de\u5230\u9996\u9875<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__number\">5.<\/span>&nbsp;\u9000\u51fa APP\uff08Home \u952e\u9000\u540e\u53f0\uff09<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\">## \u5173\u952e\u8981\u6c42<\/span><\/span><\/code><code><span leaf=\"\">- \u6bcf\u4e2a\u6b65\u9aa4\u540e\u6267\u884c\u5168\u5c4f\u622a\u56fe\uff0c\u622a\u56fe\u6587\u4ef6\u540d\u683c\u5f0f\uff1a{fold_state}_step{num}_{timestamp}.png<\/span><\/code><code><span leaf=\"\">&nbsp; - fold_state\uff1a\u5c55\u5f00\u6001\u7528 `unfold`\uff0c\u6298\u53e0\u6001\u7528 `fold`<\/span><\/code><code><span leaf=\"\">&nbsp; - num\uff1a\u6b65\u9aa4\u5e8f\u53f7&nbsp;<span class=\"code-snippet__number\">1<\/span>~<span class=\"code-snippet__number\">4<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; - timestamp\uff1aUnix \u65f6\u95f4\u6233\uff08\u79d2\uff09<\/span><\/code><code><span leaf=\"\">- \u622a\u56fe\u540e\u7b49\u5f85\u622a\u56fe\u7279\u6548\u6d88\u5931\uff08screencap \u8fdb\u7a0b\u7ed3\u675f\uff09\u518d\u6267\u884c\u4e0b\u4e00\u6b65<\/span><\/code><code><span leaf=\"\">- \u6700\u540e\u4e00\u6b65\uff08\u9000\u51fa APP\uff09\u622a\u56fe\u540e\u4e0d\u5224\u65ad\u622a\u56fe\u7279\u6548<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\">## \u622a\u56fe\u7b49\u5f85\u903b\u8f91<\/span><\/span><\/code><code><span leaf=\"\">```python<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;subprocess, time, os<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">wait_screenshot_ready<\/span>(<span class=\"code-snippet__params\">screenshot_path, timeout=<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__number\">5<\/span><\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"\u7b49\u5f85\u622a\u56fe\u6587\u4ef6\u5199\u5165\u5b8c\u6210\uff08screencap \u8fdb\u7a0b\u9000\u51fa\uff09\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; start = time.time()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">while<\/span>&nbsp;time.time() - start &lt; timeout:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; time.sleep(<span class=\"code-snippet__number\">0.3<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">try<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; size1 = os.path.getsize(screenshot_path)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; time.sleep(<span class=\"code-snippet__number\">0.3<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; size2 = os.path.getsize(screenshot_path)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;size1 &gt;&nbsp;<span class=\"code-snippet__number\">0<\/span>&nbsp;<span class=\"code-snippet__keyword\">and<\/span>&nbsp;size1 == size2:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;<span class=\"code-snippet__literal\">True<\/span>&nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u6587\u4ef6\u5927\u5c0f\u7a33\u5b9a\uff0c\u622a\u56fe\u5b8c\u6210<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">except<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">pass<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;<span class=\"code-snippet__literal\">False<\/span>&nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u8d85\u65f6\u4ecd\u4e0d\u7a33\u5b9a<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">take_screenshot<\/span>(<span class=\"code-snippet__params\">driver, filepath<\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; driver.save_screenshot(filepath)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;wait_screenshot_ready(filepath)<\/span><\/code><code><span leaf=\"\">```<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\">## \u8f93\u51fa\u8981\u6c42<\/span><\/span><\/code><code><span leaf=\"\">\u751f\u6210\u5b8c\u6574\u7684 Python \u811a\u672c\uff08Python&nbsp;<span class=\"code-snippet__number\">3.9<\/span>+\uff09\uff0c\u4f7f\u7528 Appium Python Client\uff0c\u5bfc\u51fa\u4e3a\u53ef\u72ec\u7acb\u8fd0\u884c\u7684 .py \u6587\u4ef6\uff0c\u5305\u542b\uff1a<\/span><\/code><code><span leaf=\"\">- desired_caps \u914d\u7f6e\uff08\u542b appPackage \/ appActivity\uff09<\/span><\/code><code><span leaf=\"\">- wait_screenshot_ready() \u51fd\u6570<\/span><\/code><code><span leaf=\"\">- take_screenshot() \u51fd\u6570<\/span><\/code><code><span leaf=\"\">- \u5404\u6b65\u9aa4\u64cd\u4f5c\u51fd\u6570\uff08start_app \/ search \/ click_search \/ exit_search \/ quit_app\uff09<\/span><\/code><code><span leaf=\"\">- \u4e3b\u6d41\u7a0b\uff1a\u6267\u884c\u5c55\u5f00\u6001&nbsp;<span class=\"code-snippet__number\">4<\/span>&nbsp;\u6b65 \u2192 \u6267\u884c\u6298\u53e0\u6001&nbsp;<span class=\"code-snippet__number\">4<\/span>&nbsp;\u6b65\uff08\u6298\u53e0\u6001\u524d\u8c03\u7528\u6298\u53e0\u811a\u672c\uff09<\/span><\/code><code><span leaf=\"\">- \u6298\u53e0\u63a7\u5236\u7531\u5916\u90e8\u63d0\u4f9b\uff0c\u8fd9\u91cc\u53ea\u8d1f\u8d23\u8c03\u7528\u6298\u53e0\u51fd\u6570<\/span><\/code><\/pre>\n<\/section>\n<h3 style=\"box-sizing: border-box;margin: 24px 0px 12px;padding: 0px;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 16px;color: #7a4fd6;\">2.2 \u6298\u53e0\u5c4f\u6d4b\u8bd5 Skill\uff08<\/span><span textstyle=\"\" style=\"font-size: 16px;color: #ff2941;\">HarmonyOS<\/span><span textstyle=\"\" style=\"font-size: 16px;color: #7a4fd6;\">\uff09<\/span><\/span><\/h3>\n<p><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;background-color: #00d5ff;color: #ffffff;font-weight: bold;\">SKILL.md \u2014 Douyin \u6298\u53e0\u5c4f\u6d4b\u8bd5\uff08<\/span><span textstyle=\"\" style=\"font-size: 15px;background-color: #00d5ff;color: #ff2941;font-weight: bold;\">HarmonyOS<\/span><span textstyle=\"\" style=\"font-size: 15px;background-color: #00d5ff;color: #ffffff;font-weight: bold;\">\uff09<\/span><\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"python\"><code><span leaf=\"\"><span class=\"code-snippet__comment\"># \u6296\u97f3-\u6298\u53e0\u5c4f\u81ea\u52a8\u5316\u6d4b\u8bd5 Skill\uff08HarmonyOS\uff09<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\">## \u89d2\u8272\u5b9a\u4e49<\/span><\/span><\/code><code><span leaf=\"\">\u4f60\u662f\u4e00\u540d\u8d44\u6df1 HarmonyOS \u81ea\u52a8\u5316\u6d4b\u8bd5\u5de5\u7a0b\u5e08\uff0c\u7cbe\u901a Appium + Python\uff0c\u719f\u6089\u9e3f\u8499\u8bbe\u5907\u7279\u6027\u548c HDC \u547d\u4ee4\u884c\u5de5\u5177\u3002<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\">## \u6d4b\u8bd5\u76ee\u6807<\/span><\/span><\/code><code><span leaf=\"\">\u9a8c\u8bc1\u6296\u97f3 APP \u5728 HarmonyOS \u6298\u53e0\u5c4f\u5c55\u5f00\u6001\u548c\u6298\u53e0\u6001\u4e0b\u7684\u754c\u9762\u517c\u5bb9\u6027\u3002<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\">## APP \u4fe1\u606f\uff08\u6ce8\u610f\uff1aHarmonyOS \u7248\u6296\u97f3\u5305\u540d\u53ef\u80fd\u4e0d\u540c\uff09<\/span><\/span><\/code><code><span leaf=\"\">- \u5305\u540d\uff1acom.ss.android.ugc.aweme\uff08\u4e0e Android \u76f8\u540c\uff0c\u90e8\u5206\u8bbe\u5907\u53ef\u80fd\u4e3a\u9e3f\u8499\u5b9a\u5236\u7248\uff0c\u5305\u540d\u4e0d\u540c\uff09<\/span><\/code><code><span leaf=\"\">- \u542f\u52a8\u65b9\u5f0f\uff1a\u901a\u8fc7 HDC \u6216 Appium \u542f\u52a8 ability<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\">## \u6298\u53e0\u63a7\u5236\u547d\u4ee4\uff08\u901a\u8fc7 HDC\uff09<\/span><\/span><\/code><code><span leaf=\"\">```bash<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># \u67e5\u8be2\u5f53\u524d\u6298\u53e0\u72b6\u6001<\/span><\/span><\/code><code><span leaf=\"\">hdc shell hidumper -s&nbsp;<span class=\"code-snippet__number\">62<\/span>&nbsp;-a&nbsp;<span class=\"code-snippet__string\">'-a'<\/span>&nbsp;| grep FoldStatus<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># \u5207\u6362\u5230\u6298\u53e0\u6001\uff08\u5177\u4f53 mode \u503c\u9700\u6839\u636e\u8bbe\u5907\u786e\u8ba4\uff09<\/span><\/span><\/code><code><span leaf=\"\">hdc shell bm setDisplayMode --mode&nbsp;<span class=\"code-snippet__number\">1<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># \u5207\u6362\u5230\u5c55\u5f00\u6001<\/span><\/span><\/code><code><span leaf=\"\">hdc shell bm setDisplayMode --mode&nbsp;<span class=\"code-snippet__number\">0<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># \u7b49\u5f85\u6298\u53e0\u72b6\u6001\u5207\u6362\u5b8c\u6210\uff08\u5355\u4f4d\uff1a\u79d2\uff09<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;time; time.sleep(<span class=\"code-snippet__number\">3<\/span>)<\/span><\/code><code><span leaf=\"\">```<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\">## \u6d4b\u8bd5\u6b65\u9aa4\uff08\u6bcf\u6b21\u6298\u53e0\u72b6\u6001\u6267\u884c\uff09<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__number\">1.<\/span>&nbsp;\u542f\u52a8\u6296\u97f3 APP\uff0c\u7b49\u5f85 APP \u5b8c\u5168\u542f\u52a8<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__number\">2.<\/span>&nbsp;\u5728\u9996\u9875\u641c\u7d22\u6846\u8f93\u5165\u6587\u5b57\u300cAPP\u81ea\u52a8\u5316\u6d4b\u8bd5\u300d<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__number\">3.<\/span>&nbsp;\u70b9\u51fb\u641c\u7d22\u6309\u94ae\uff0c\u89e6\u53d1\u641c\u7d22<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__number\">4.<\/span>&nbsp;\u6309 Back \u952e\u9000\u51fa\u641c\u7d22\u9875\uff0c\u56de\u5230\u9996\u9875<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__number\">5.<\/span>&nbsp;\u9000\u51fa APP<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\">## \u622a\u56fe\u8981\u6c42<\/span><\/span><\/code><code><span leaf=\"\">- \u6bcf\u4e2a\u6b65\u9aa4\u540e\u622a\u56fe\uff0c\u6587\u4ef6\u540d\u683c\u5f0f\uff1aharmony_{fold_state}_step{num}_{timestamp}.png<\/span><\/code><code><span leaf=\"\">- \u622a\u56fe\u540e\u7b49\u5f85\u622a\u56fe\u7279\u6548\u6d88\u5931\u518d\u6267\u884c\u4e0b\u4e00\u6b65<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\">## \u8f93\u51fa\u8981\u6c42<\/span><\/span><\/code><code><span leaf=\"\">\u751f\u6210\u5b8c\u6574\u7684 Python \u811a\u672c\uff08Python&nbsp;<span class=\"code-snippet__number\">3.9<\/span>+\uff09\uff0c\u4f7f\u7528 Appium Python Client\uff0c<\/span><\/code><code><span leaf=\"\">\u5305\u542b HDC \u6298\u53e0\u63a7\u5236\u903b\u8f91\uff0c\u6298\u53e0\u51fd\u6570\u7b7e\u540d\u5982\u4e0b\uff1a<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">set_fold_state<\/span>(<span class=\"code-snippet__params\">state:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">str<\/span><\/span>): &nbsp;<span class=\"code-snippet__comment\"># state = \"folded\" \u6216 \"unfolded\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"\u901a\u8fc7 HDC \u63a7\u5236 HarmonyOS \u8bbe\u5907\u6298\u53e0\u72b6\u6001\"\"\"<\/span><\/span><\/code><\/pre>\n<\/section>\n<section style=\"text-indent: 0px;\"><span style=\"color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: medium;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\" data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 12px;color: #888888;font-weight: normal;\">\u628a\u4e0a\u9762\u7684 Skill \u5185\u5bb9\u590d\u5236\u7ed9 AI\uff0cAI \u5c31\u80fd\u4e3a\u4f60\u751f\u6210\u7b26\u5408\u8981\u6c42\u7684\u811a\u672c\u3002\u751f\u6210\u540e\u9700\u8981\u6839\u636e\u81ea\u5df1\u7684\u8bbe\u5907\u53c2\u6570\uff08\u8bbe\u5907\u5730\u5740\u3001\u7aef\u53e3\u3001\u5305\u540d\u7b49\uff09\u4fee\u6539\u914d\u7f6e\u533a\u5373\u53ef\u8fd0\u884c\u3002<\/span><\/span><\/span><\/section>\n<hr style=\"border-style: solid;border-width: 1px 0 0;border-color: rgba(0,0,0,0.1);-webkit-transform-origin: 0 0;-webkit-transform: scale(1, 0.5);transform-origin: 0 0;transform: scale(1, 0.5);\"  \/>\n<section><span leaf=\"\"><br  \/><\/span><\/section>\n<p data-pm-slice=\"0 0 []\"><span><span leaf=\"\" style=\"box-sizing: border-box;margin: 0px;padding: 3px 10px;font-size: 0.75rem;background: rgba(255, 255, 255, 0.25);border-radius: 99px;letter-spacing: 1px;font-weight: 700;\"><span textstyle=\"\" style=\"font-size: 18px;color: #d6a841;font-weight: bold;\">\u7b2c\u4e09\u7ae0&nbsp;<\/span><span textstyle=\"\" style=\"font-size: 17px;color: #021eaa;font-weight: bold;\">\u6298\u53e0\u72b6\u6001\u63a7\u5236\uff1aAndroid\u4e0eHarmonyOS\u53cc\u65b9\u6848<\/span><\/span><\/span><\/p>\n<p style=\"box-sizing: border-box;margin: 0px 0px 14px;padding: 0px;line-height: 1.9;color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: medium;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\">\u6298\u53e0\u72b6\u6001\u63a7\u5236\u662f\u6574\u4e2a\u65b9\u6848\u7684\u6838\u5fc3\u6280\u672f\u73af\u8282\u3002Android \u548c HarmonyOS \u91c7\u7528\u4e86\u5b8c\u5168\u4e0d\u540c\u7684\u63a7\u5236\u65b9\u5f0f\uff0c\u4e0b\u9762\u5206\u522b\u8bb2\u89e3\u539f\u7406\u3001\u547d\u4ee4\u548c\u4ee3\u7801\u5b9e\u73b0\u3002<\/span><\/p>\n<h3 style=\"box-sizing: border-box;margin: 24px 0px 12px;padding: 0px;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 16px;color: #7a4fd6;\">3.1 Android\uff1aADB + wm size \u5206\u8fa8\u7387\u6a21\u62df\u65b9\u6848<\/span><\/span><\/h3>\n<h4 style=\"box-sizing: border-box;margin: 16px 0px 8px;padding: 0px;font-size: medium;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">3.1.1 \u539f\u7406\u8bf4\u660e<\/span><\/h4>\n<p style=\"box-sizing: border-box;margin: 0px 0px 14px;padding: 0px;line-height: 1.9;color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: medium;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">Android \u5b98\u65b9\u5e76\u672a\u63d0\u4f9b\u76f4\u63a5\u901a\u8fc7 ADB \u547d\u4ee4\u5207\u6362\u6298\u53e0\u72b6\u6001\u7684\u63a5\u53e3\u3002\u5404\u5927\u5382\u5546\uff08\u534e\u4e3a\u3001\u4e09\u661f\u3001OPPO\uff09\u5747\u6709\u81ea\u5df1\u7684\u6298\u53e0\u63a7\u5236\u65b9\u6848\uff0c\u4f46\u5747\u4e3a\u5382\u5546\u79c1\u6709 API\uff0c\u65e0\u6cd5\u901a\u8fc7\u901a\u7528 ADB \u8bbf\u95ee\u3002<\/span><\/p>\n<p style=\"box-sizing: border-box;margin: 0px 0px 14px;padding: 0px;line-height: 1.9;color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: medium;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u672c\u6587\u91c7\u7528\u7684\u65b9\u6848\u662f\uff1a\u901a\u8fc7&nbsp;<\/span><code style=\"box-sizing: border-box;margin: 0px;padding: 1px 6px;background: rgb(241, 245, 249);border: 1px solid rgb(226, 232, 240);border-radius: 4px;font-size: 0.88em;color: rgb(99, 102, 241);font-family: &quot;Cascadia Code&quot;, &quot;Fira Code&quot;, monospace;\"><span leaf=\"\">adb shell wm size<\/span><\/code><span leaf=\"\">&nbsp;\u547d\u4ee4\u52a8\u6001\u4fee\u6539\u663e\u793a\u5206\u8fa8\u7387\uff0c\u6a21\u62df\u6298\u53e0\u6001\u548c\u5c55\u5f00\u6001\u7684\u5c4f\u5e55\u5c3a\u5bf8\u5dee\u5f02\u3002\u5f53\u5206\u8fa8\u7387\u5207\u6362\u540e\uff0cAndroid \u7cfb\u7edf\u4f1a\u89e6\u53d1 configuration changed \u4e8b\u4ef6\uff0c\u5e94\u7528\u6536\u5230\u540e\u91cd\u65b0 layout\uff0c\u4ece\u800c\u6d4b\u8bd5\u5e94\u7528\u5728&#8221;\u6298\u53e0\u540e\u5206\u8fa8\u7387&#8221;\u4e0b\u7684\u754c\u9762\u8868\u73b0\u3002<\/span><\/p>\n<section style=\"text-align: center;\" nodeleaf=\"\">\n<figure class=\"wx-qr-wrap\"><img decoding=\"async\" class=\"rich_pages wxw-img\" data-aistatus=\"1\" data-imgfileid=\"100000575\" data-s=\"300,640\" data-type=\"png\" type=\"block\" src=\"https:\/\/mmbiz.qpic.cn\/mmbiz_png\/BWmfcibGhS1LoPOlAXgM7LsAAf83HaqcVKrEWibberPBlw7YvNQdNw6dLicJFQD2cITdPw1R4JYjaFia8khRd9sa1g6icG3NzhLsOmzZnTfRPKMA\/640?wx_fmt=png&#038;from=appmsg\" \/><figcaption class=\"wx-qr-tip\"><img decoding=\"async\" src=\"https:\/\/www.deartester.com\/wp-content\/uploads\/2026\/09\/wechat-qr.jpg\" alt=\"\u5fae\u4fe1\u516c\u4f17\u53f7\u4e8c\u7ef4\u7801\" loading=\"lazy\"><span>\u56fe\u7247\u5f15\u81ea\u5fae\u4fe1\u516c\u4f17\u53f7\uff0c\u626b\u7801\u5173\u6ce8\u9605\u8bfb\u539f\u6587<\/span><\/figcaption><\/figure>\n<\/section>\n<section style=\"text-align: center;\"><span style=\"color: rgb(100, 116, 139);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: 13.12px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\" data-pm-slice=\"0 0 []\"><span leaf=\"\">Android\u6298\u53e0\u6001\u6a21\u62df\uff1a\u901a\u8fc7adb shell wm size \u52a8\u6001\u4fee\u6539\u5206\u8fa8\u7387\uff0c\u89e6\u53d1\u5e94\u7528\u91cd\u65b0\u5e03\u5c40\u5b9e\u73b0\u6298\u53e0<\/span><\/span><\/section>\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"576\"><strong data-pm-slice=\"0 0 []\"><span leaf=\"\" style=\"color:rgba(0, 0, 0, 0.9);font-size:17px;font-family:&quot;mp-quote&quot;, &quot;PingFang SC&quot;, system-ui, -apple-system, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei UI&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;line-height:1.6;letter-spacing:0.034em;font-style:normal;font-weight:normal;\"><span textstyle=\"\" style=\"font-size: 15px;color: #ff2941;font-weight: bold;\">\u26a0 \u91cd\u8981\u8bf4\u660e\uff1a\u5206\u8fa8\u7387\u6a21\u62df vs \u771f\u5b9e\u6298\u53e0<\/span><\/span><\/strong><\/p>\n<p style=\"box-sizing: border-box;margin: 0px 0px 14px;padding: 0px;line-height: 1.9;color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: medium;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 12px;color: #0052ff;\">\u901a\u8fc7 wm size \u4fee\u6539\u5206\u8fa8\u7387\u53ef\u4ee5\u6d4b\u8bd5\u5e94\u7528\u5728&#8221;\u6298\u53e0\u540e\u5206\u8fa8\u7387&#8221;\u4e0b\u7684\u5e03\u5c40\u8868\u73b0\uff0c\u4f46\u65e0\u6cd5\u6a21\u62df\u771f\u5b9e\u7684\u94f0\u94fe\u533a\u57df\u906e\u6321\u548c\u4f20\u611f\u5668\u4e8b\u4ef6\u3002\u5982\u679c\u4f60\u9700\u8981\u6d4b\u8bd5\u94f0\u94fe\u533a\u57df\u906e\u6321\uff08\u5982\u8f93\u5165\u6846\u88ab\u94f0\u94fe\u906e\u6321\u7684\u573a\u666f\uff09\uff0c\u5efa\u8bae\u4f7f\u7528\u771f\u5b9e\u6298\u53e0\u8bbe\u5907\uff0c\u5728\u7269\u7406\u6298\u53e0\u72b6\u6001\u4e0b\u6267\u884c\u6d4b\u8bd5\u3002\u5206\u8fa8\u7387\u6a21\u62df\u65b9\u6848\u9002\u7528\u4e8e\u9a8c\u8bc1&#8221;\u5e03\u5c40\u662f\u5426\u9002\u914d\u6298\u53e0\u540e\u5c3a\u5bf8&#8221;\u7c7b\u95ee\u9898\u3002<\/span><\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4 style=\"box-sizing: border-box;margin: 24px 0px 12px;padding: 0px;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 16px;color: #7a4fd6;\">3.1.2 Python \u5b9e\u73b0<\/span><\/span><\/h4>\n<p><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;background-color: #00d5ff;color: #ffffff;font-weight: bold;\">f<\/span><\/span><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;background-color: #00d5ff;color: #ffffff;font-weight: bold;\">old<\/span><\/span><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;background-color: #00d5ff;color: #ffffff;font-weight: bold;\">_control_android.py \u2014 ADB \u6298\u53e0\u63a7\u5236<\/span><\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"python\"><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;subprocess<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;time<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;re<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># ============ \u914d\u7f6e\u533a\uff08\u6839\u636e\u4f60\u7684\u8bbe\u5907\u4fee\u6539\uff09============<\/span><\/span><\/code><code><span leaf=\"\">ANDROID_DEVICE_ADDR =&nbsp;<span class=\"code-snippet__string\">\"192.168.1.100:5555\"<\/span>&nbsp; &nbsp;<span class=\"code-snippet__comment\"># \u8bbe\u5907\u5730\u5740\uff0c\u771f\u673a\u7528 IP\uff0c\u6a21\u62df\u5668\u7528 emulator-xxxx<\/span><\/span><\/code><code><span leaf=\"\">ORIGINAL_RESOLUTION =&nbsp;<span class=\"code-snippet__string\">\"2208x1840\"<\/span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class=\"code-snippet__comment\"># \u5c55\u5f00\u6001\u5206\u8fa8\u7387\uff08\u67e5 adb shell wm size \u83b7\u53d6\uff09<\/span><\/span><\/code><code><span leaf=\"\">FOLDED_RESOLUTION =&nbsp;<span class=\"code-snippet__string\">\"984x2096\"<\/span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u6298\u53e0\u6001\u5206\u8fa8\u7387\uff08\u67e5 adb shell wm size \u83b7\u53d6\uff09<\/span><\/span><\/code><code><span leaf=\"\">FOLD_TRANSITION_WAIT =&nbsp;<span class=\"code-snippet__number\">3<\/span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u6298\u53e0\u72b6\u6001\u5207\u6362\u540e\u7b49\u5f85\u79d2\u6570\uff08\u8ba9\u7cfb\u7edf\u5b8c\u6210\u56de\u8c03\uff09<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># ==================================================<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">run_adb<\/span>(<span class=\"code-snippet__params\">command:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">str<\/span><\/span>) -&gt;&nbsp;<span class=\"code-snippet__built_in\">str<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"\u6267\u884c ADB \u547d\u4ee4\u5e76\u8fd4\u56de\u8f93\u51fa\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; full_cmd =&nbsp;<span class=\"code-snippet__string\">f\"adb -s&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{ANDROID_DEVICE_ADDR}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{command}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; result = subprocess.run(<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; full_cmd, shell=<span class=\"code-snippet__literal\">True<\/span>, capture_output=<span class=\"code-snippet__literal\">True<\/span>, text=<span class=\"code-snippet__literal\">True<\/span>, timeout=<span class=\"code-snippet__number\">30<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;result.stdout.strip()<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">get_current_resolution<\/span>() -&gt;&nbsp;<span class=\"code-snippet__built_in\">str<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"\u83b7\u53d6\u5f53\u524d\u5c4f\u5e55\u5206\u8fa8\u7387\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; output = run_adb(<span class=\"code-snippet__string\">\"shell wm size\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u8f93\u51fa\u683c\u5f0f\uff1aPhysical size: 2208x1840 \u6216 Override size: 984x2096<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">match<\/span>&nbsp;= re.search(<span class=\"code-snippet__string\">r'Override size:\\s*(\\d+x\\d+)'<\/span>, output)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;<span class=\"code-snippet__keyword\">match<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;<span class=\"code-snippet__keyword\">match<\/span>.group(<span class=\"code-snippet__number\">1<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">match<\/span>&nbsp;= re.search(<span class=\"code-snippet__string\">r'Physical size:\\s*(\\d+x\\d+)'<\/span>, output)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;<span class=\"code-snippet__keyword\">match<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;<span class=\"code-snippet__keyword\">match<\/span>.group(<span class=\"code-snippet__number\">1<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;<span class=\"code-snippet__string\">\"unknown\"<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">set_fold_state<\/span>(<span class=\"code-snippet__params\">state:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">str<\/span><\/span>) -&gt;&nbsp;<span class=\"code-snippet__built_in\">bool<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u901a\u8fc7 ADB wm size \u63a7\u5236 Android \u8bbe\u5907\u6298\u53e0\u72b6\u6001<\/span><\/code><code><span leaf=\"\"><br  \/><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u53c2\u6570:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; state: \"folded\"\uff08\u6298\u53e0\u6001\uff09\u6216 \"unfolded\"\uff08\u5c55\u5f00\u6001\uff09<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u8fd4\u56de:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; True=\u6210\u529f\uff0cFalse=\u5931\u8d25<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \"\"\"<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;state ==&nbsp;<span class=\"code-snippet__string\">\"folded\"<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; target_res = FOLDED_RESOLUTION<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; display_name =&nbsp;<span class=\"code-snippet__string\">\"\u6298\u53e0\u6001\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">elif<\/span>&nbsp;state ==&nbsp;<span class=\"code-snippet__string\">\"unfolded\"<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; target_res = ORIGINAL_RESOLUTION<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; display_name =&nbsp;<span class=\"code-snippet__string\">\"\u5c55\u5f00\u6001\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">else<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"[ERROR] \u672a\u77e5\u72b6\u6001:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{state}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;<span class=\"code-snippet__literal\">False<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"[INFO] \u6b63\u5728\u5207\u6362\u5230&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{display_name}<\/span><\/span><span class=\"code-snippet__string\">\uff08\u5206\u8fa8\u7387:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{target_res}<\/span><\/span><span class=\"code-snippet__string\">\uff09...\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; current = get_current_resolution()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"[INFO] \u5f53\u524d\u5206\u8fa8\u7387:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{current}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;current == target_res:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"[INFO] \u5df2\u662f&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{display_name}<\/span><\/span><span class=\"code-snippet__string\">\uff0c\u8df3\u8fc7\u5207\u6362\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;<span class=\"code-snippet__literal\">True<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u6267\u884c\u5206\u8fa8\u7387\u5207\u6362<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; result = run_adb(<span class=\"code-snippet__string\">f\"shell wm size&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{target_res}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;<span class=\"code-snippet__string\">\"error\"<\/span>&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;result.lower():<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"[ERROR] \u5207\u6362\u5206\u8fa8\u7387\u5931\u8d25:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{result}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;<span class=\"code-snippet__literal\">False<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u7b49\u5f85\u7cfb\u7edf\u5b8c\u6210\u6298\u53e0\u72b6\u6001\u56de\u8c03<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"[INFO] \u7b49\u5f85&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{FOLD_TRANSITION_WAIT}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;\u79d2\uff0c\u7cfb\u7edf\u5b8c\u6210\u72b6\u6001\u5207\u6362...\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; time.sleep(FOLD_TRANSITION_WAIT)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u9a8c\u8bc1\u5207\u6362\u7ed3\u679c<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; new_res = get_current_resolution()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;new_res == target_res:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"[OK]&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{display_name}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;\u5207\u6362\u6210\u529f\uff0c\u5f53\u524d\u5206\u8fa8\u7387:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{new_res}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;<span class=\"code-snippet__literal\">True<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">else<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"[WARN] \u5207\u6362\u5b8c\u6210\u4f46\u5206\u8fa8\u7387\u4e0d\u5339\u914d\uff0c\u671f\u671b:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{target_res}<\/span><\/span><span class=\"code-snippet__string\">\uff0c\u5b9e\u9645:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{new_res}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;<span class=\"code-snippet__literal\">True<\/span>&nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u4e0d\u7b97\u5931\u8d25\uff0c\u53ea\u662f\u8bb0\u5f55<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">reset_resolution<\/span>() -&gt;&nbsp;<span class=\"code-snippet__built_in\">bool<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"\u6062\u590d\u539f\u59cb\u5206\u8fa8\u7387\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"[INFO] \u6062\u590d\u539f\u59cb\u5206\u8fa8\u7387...\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; result = run_adb(<span class=\"code-snippet__string\">\"shell wm size reset\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; time.sleep(<span class=\"code-snippet__number\">2<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; current = get_current_resolution()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"[INFO] \u6062\u590d\u540e\u5206\u8fa8\u7387:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{current}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;<span class=\"code-snippet__literal\">True<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">if<\/span>&nbsp;__name__ ==&nbsp;<span class=\"code-snippet__string\">\"__main__\"<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u6d4b\u8bd5\u6298\u53e0\u72b6\u6001\u5207\u6362<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"=== Android \u6298\u53e0\u72b6\u6001\u63a7\u5236\u6d4b\u8bd5 ===\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"\u5f53\u524d\u5206\u8fa8\u7387:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{get_current_resolution()}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"\\n--- \u6d4b\u8bd5\u5207\u6362\u5230\u5c55\u5f00\u6001 ---\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; set_fold_state(<span class=\"code-snippet__string\">\"unfolded\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"\\n--- \u6d4b\u8bd5\u5207\u6362\u5230\u6298\u53e0\u6001 ---\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; set_fold_state(<span class=\"code-snippet__string\">\"folded\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"\\n--- \u6062\u590d\u539f\u59cb\u5206\u8fa8\u7387 ---\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; reset_resolution()<\/span><\/code><\/pre>\n<\/section>\n<h4 style=\"box-sizing: border-box;margin: 24px 0px 12px;padding: 0px;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\" style=\"box-sizing: border-box;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span textstyle=\"\" style=\"font-size: 16px;color: #7a4fd6;\">3<\/span><\/span><span leaf=\"\" style=\"box-sizing: border-box;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span textstyle=\"\" style=\"font-size: 16px;color: #7a4fd6;\">.1.<\/span><\/span><span leaf=\"\" style=\"box-sizing: border-box;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span textstyle=\"\" style=\"font-size: 16px;color: #7a4fd6;\">3 Appium \u4e2d\u7684\u5206\u8fa8\u7387\u540c\u6b65<\/span><\/span><\/h4>\n<p style=\"box-sizing: border-box;margin: 0px 0px 14px;padding: 0px;line-height: 1.9;color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: medium;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u5207\u6362\u5206\u8fa8\u7387\u540e\uff0c\u9700\u8981\u901a\u77e5 Appium driver \u5237\u65b0\u5f53\u524d\u4e0a\u4e0b\u6587\uff08context\uff09\uff0c\u5426\u5219 driver \u4ecd\u4f7f\u7528\u65e7\u7684\u7a97\u53e3\u5c3a\u5bf8\u3002\u5207\u6362\u5206\u8fa8\u7387\u540e\u8c03\u7528\uff1a<\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"makefile\"><code><span leaf=\"\"><span class=\"code-snippet__comment\"># \u5207\u6362\u5206\u8fa8\u7387\u540e\uff0c\u5728 Appium Python Client \u4e2d\u5237\u65b0 session<\/span><\/span><\/code><code><span leaf=\"\">driver.refresh_caps() &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class=\"code-snippet__comment\"># \u91cd\u65b0\u83b7\u53d6\u8bbe\u5907 capabilities<\/span><\/span><\/code><code><span leaf=\"\">driver.update_settings({}) &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u89e6\u53d1 driver \u91cd\u65b0\u8ba1\u7b97\u7a97\u53e3\u5c3a\u5bf8<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># \u6216\u8005\u66f4\u7b80\u5355\u7684\u65b9\u5f0f\uff1a\u91cd\u542f Appium session<\/span><\/span><\/code><code><span leaf=\"\">driver.quit()<\/span><\/code><code><span leaf=\"\">driver = webdriver.Remote(APPIUM_SERVER, desired_caps)<\/span><\/code><\/pre>\n<\/section>\n<h3 style=\"box-sizing: border-box;margin: 24px 0px 12px;padding: 0px;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\" style=\"box-sizing: border-box;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span textstyle=\"\" style=\"font-size: 16px;color: #7a4fd6;\">3.2 HarmonyOS\uff1aHDC + bm setDisplayM<\/span><\/span><span leaf=\"\" style=\"box-sizing: border-box;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span textstyle=\"\" style=\"font-size: 16px;color: #7a4fd6;\">od<\/span><\/span><span leaf=\"\" style=\"box-sizing: border-box;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span textstyle=\"\" style=\"font-size: 16px;color: #7a4fd6;\">e \u65b9\u6848<\/span><\/span><\/h3>\n<h4 style=\"box-sizing: border-box;margin: 16px 0px 8px;padding: 0px;font-size: medium;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">3.2.1 \u539f\u7406\u8bf4\u660e<\/span><\/h4>\n<p style=\"box-sizing: border-box;margin: 0px 0px 14px;padding: 0px;line-height: 1.9;color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: medium;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">HarmonyOS \u63d0\u4f9b\u4e86\u8f83\u4e3a\u5b8c\u5584\u7684\u6298\u53e0\u5c4f\u72b6\u6001\u7ba1\u7406 API\u3002\u5728\u6d4b\u8bd5\u573a\u666f\u4e2d\uff0c\u6211\u4eec\u901a\u8fc7 HDC\uff08HarmonyOS Device Connector\uff09\u547d\u4ee4\u884c\u5de5\u5177\u76f4\u63a5\u8c03\u7528\u7cfb\u7edf\u670d\u52a1\u6765\u63a7\u5236\u6298\u53e0\u72b6\u6001\u3002<\/span><\/p>\n<p style=\"box-sizing: border-box;margin: 0px 0px 14px;padding: 0px;line-height: 1.9;color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: medium;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">HDC \u662f HarmonyOS \u5b98\u65b9\u63d0\u4f9b\u7684\u8c03\u8bd5\u5de5\u5177\uff0c\u529f\u80fd\u4e0a\u5bf9\u6807 Android \u7684 ADB\u3002HDC \u9ed8\u8ba4\u968f DevEco Studio \u5b89\u88c5\uff0c\u8def\u5f84\u5728\uff1a<\/span><\/p>\n<ul style=\"box-sizing: border-box;margin: 8px 0px 14px 24px;padding: 0px;color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: medium;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" class=\"list-paddingleft-1\">\n<li style=\"box-sizing: border-box;margin: 0px 0px 6px;padding: 0px;line-height: 1.8;\">\n<section><span leaf=\"\">Windows:&nbsp;<\/span><code style=\"box-sizing: border-box;margin: 0px;padding: 1px 6px;background: rgb(241, 245, 249);border: 1px solid rgb(226, 232, 240);border-radius: 4px;font-size: 0.88em;color: rgb(99, 102, 241);font-family: &quot;Cascadia Code&quot;, &quot;Fira Code&quot;, monospace;\"><span leaf=\"\">DevEco Studio\/sdk\/default\/openharmony\/toolchains\/hdc.exe<\/span><\/code><\/section>\n<\/li>\n<li style=\"box-sizing: border-box;margin: 0px 0px 6px;padding: 0px;line-height: 1.8;\">\n<section><span leaf=\"\">macOS:&nbsp;<\/span><code style=\"box-sizing: border-box;margin: 0px;padding: 1px 6px;background: rgb(241, 245, 249);border: 1px solid rgb(226, 232, 240);border-radius: 4px;font-size: 0.88em;color: rgb(99, 102, 241);font-family: &quot;Cascadia Code&quot;, &quot;Fira Code&quot;, monospace;\"><span leaf=\"\">DevEco Studio.app\/Contents\/sdk\/default\/openharmony\/toolchains\/hdc<\/span><\/code><\/section>\n<\/li>\n<\/ul>\n<p style=\"box-sizing: border-box;margin: 0px 0px 14px;padding: 0px;line-height: 1.9;color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: medium;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u6298\u53e0\u5c4f\u72b6\u6001\u63a7\u5236\u4e3b\u8981\u901a\u8fc7&nbsp;<\/span><code style=\"box-sizing: border-box;margin: 0px;padding: 1px 6px;background: rgb(241, 245, 249);border: 1px solid rgb(226, 232, 240);border-radius: 4px;font-size: 0.88em;color: rgb(99, 102, 241);font-family: &quot;Cascadia Code&quot;, &quot;Fira Code&quot;, monospace;\"><span leaf=\"\">bm<\/span><\/code><span leaf=\"\">\uff08Bundle Manager\uff09\u5b50\u547d\u4ee4\u7684&nbsp;<\/span><code style=\"box-sizing: border-box;margin: 0px;padding: 1px 6px;background: rgb(241, 245, 249);border: 1px solid rgb(226, 232, 240);border-radius: 4px;font-size: 0.88em;color: rgb(99, 102, 241);font-family: &quot;Cascadia Code&quot;, &quot;Fira Code&quot;, monospace;\"><span leaf=\"\">setDisplayMode<\/span><\/code><span leaf=\"\">&nbsp;\u53c2\u6570\u5b9e\u73b0\uff1a<\/span><\/p>\n<section style=\"text-align: center;\" nodeleaf=\"\">\n<figure class=\"wx-qr-wrap\"><img decoding=\"async\" class=\"rich_pages wxw-img\" data-aistatus=\"1\" data-imgfileid=\"100000576\" data-s=\"300,640\" data-type=\"png\" type=\"block\" src=\"https:\/\/mmbiz.qpic.cn\/sz_mmbiz_png\/BWmfcibGhS1IpLVYmJibKJHPzDicnr0Jn71UYq6PiaXhO0YEiaFz5Jow0m8N4MkxyIXeZSFYG0mAZ6BRvbt6Cz2NcqDiayicYiaLAZicDTh1NmABO1z8\/640?wx_fmt=png&#038;from=appmsg\" \/><figcaption class=\"wx-qr-tip\"><img decoding=\"async\" src=\"https:\/\/www.deartester.com\/wp-content\/uploads\/2026\/09\/wechat-qr.jpg\" alt=\"\u5fae\u4fe1\u516c\u4f17\u53f7\u4e8c\u7ef4\u7801\" loading=\"lazy\"><span>\u56fe\u7247\u5f15\u81ea\u5fae\u4fe1\u516c\u4f17\u53f7\uff0c\u626b\u7801\u5173\u6ce8\u9605\u8bfb\u539f\u6587<\/span><\/figcaption><\/figure>\n<\/section>\n<section style=\"text-align: center;\"><span style=\"color: rgb(100, 116, 139);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: 13.12px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\" data-pm-slice=\"0 0 []\"><span leaf=\"\">HarmonyOS \u6298\u53e0\u72b6\u6001\u63a7\u5236\u65b9\u6848\uff1a\u901a\u8fc7 HDC \u547d\u4ee4\u8c03\u7528\u7cfb\u7edf Bundle Manager \u7684 setDisplayMode \u63a5\u53e3\uff0cmode=0 \u4e3a\u5c55\u5f00\u6001\uff0cmode=1 \u4e3a\u6298\u53e0\u6001<\/span><\/span><\/section>\n<h4 style=\"box-sizing: border-box;margin: 24px 0px 12px;padding: 0px;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\" style=\"box-sizing: border-box;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span textstyle=\"\" style=\"font-size: 16px;color: #7a4fd6;\">3.2.2 HarmonyOS \u6298\u53e0\u72b6\u6001\u679a\u4e3e\u8bf4\u660e<\/span><\/span><\/h4>\n<p style=\"box-sizing: border-box;margin: 0px 0px 14px;padding: 0px;line-height: 1.9;color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: medium;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">HarmonyOS \u6298\u53e0\u5c4f\u7684\u72b6\u6001\u503c\u5b9a\u4e49\u5728&nbsp;<\/span><code style=\"box-sizing: border-box;margin: 0px;padding: 1px 6px;background: rgb(241, 245, 249);border: 1px solid rgb(226, 232, 240);border-radius: 4px;font-size: 0.88em;color: rgb(99, 102, 241);font-family: &quot;Cascadia Code&quot;, &quot;Fira Code&quot;, monospace;\"><span leaf=\"\">ohos.display.FoldStatus<\/span><\/code><span leaf=\"\">&nbsp;\u679a\u4e3e\u4e2d\uff1a<\/span><\/p>\n<table style=\"box-sizing: border-box;margin: 16px 0px;padding: 0px;width: 864px;border-collapse: collapse;font-size: 0.9rem;color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\">\n<tbody>\n<tr style=\"box-sizing: border-box;margin: 0px;padding: 0px;\">\n<th style=\"box-sizing: border-box;margin: 0px;padding: 10px 14px;background: none 0% 0% \/ auto repeat scroll padding-box border-box rgb(15, 23, 42);color: rgb(255, 255, 255);text-align: left;font-weight: 700;\">\n<section style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;color: #d6a841;\">FoldStatus \u503c<\/span><\/span><\/section>\n<\/th>\n<th style=\"box-sizing: border-box;margin: 0px;padding: 10px 14px;background: none 0% 0% \/ auto repeat scroll padding-box border-box rgb(15, 23, 42);color: rgb(255, 255, 255);text-align: left;font-weight: 700;\">\n<section style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;color: #d6a841;\">\u542b\u4e49<\/span><\/span><\/section>\n<\/th>\n<th style=\"box-sizing: border-box;margin: 0px;padding: 10px 14px;background: none 0% 0% \/ auto repeat scroll padding-box border-box rgb(15, 23, 42);color: rgb(255, 255, 255);text-align: left;font-weight: 700;\">\n<section style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;color: #d6a841;\">\u5bf9\u5e94 HDC mode<\/span><\/span><\/section>\n<\/th>\n<\/tr>\n<tr style=\"box-sizing: border-box;margin: 0px;padding: 0px;\">\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);background: rgb(248, 250, 252);\">\n<section><span leaf=\"\">FOLD_STATUS_EXPANDED = 0<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);background: rgb(248, 250, 252);\">\n<section><span leaf=\"\">\u5b8c\u5168\u5c55\u5f00\u6001<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);background: rgb(248, 250, 252);\">\n<section><span leaf=\"\">&#8211;mode 0<\/span><\/section>\n<\/td>\n<\/tr>\n<tr style=\"box-sizing: border-box;margin: 0px;padding: 0px;\">\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);\">\n<section><span leaf=\"\">FOLD_STATUS_FOLDED = 1<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);\">\n<section><span leaf=\"\">\u5b8c\u5168\u6298\u53e0\u6001<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);\">\n<section><span leaf=\"\">&#8211;mode 1<\/span><\/section>\n<\/td>\n<\/tr>\n<tr style=\"box-sizing: border-box;margin: 0px;padding: 0px;\">\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);background: rgb(248, 250, 252);\">\n<section><span leaf=\"\">FOLD_STATUS_HALF_FOLDED = 2<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);background: rgb(248, 250, 252);\">\n<section><span leaf=\"\">\u534a\u6298\u53e0\uff08\u60ac\u505c\u6001\uff09<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);background: rgb(248, 250, 252);\">\n<section><span leaf=\"\">&#8211;mode 2<\/span><\/section>\n<\/td>\n<\/tr>\n<tr style=\"box-sizing: border-box;margin: 0px;padding: 0px;\">\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);\">\n<section><span leaf=\"\">FOLD_STATUS_INNER_FOLD_EXPANDED = 3<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);\">\n<section><span leaf=\"\">\u5185\u6298\u5c55\u5f00\u6001\uff08\u6298\u53e0\u5c4f\u5185\u6298\u673a\u578b\uff09<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);\">\n<section><span leaf=\"\">&#8211;mode 3<\/span><\/section>\n<\/td>\n<\/tr>\n<tr style=\"box-sizing: border-box;margin: 0px;padding: 0px;\">\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);background: rgb(248, 250, 252);\">\n<section><span leaf=\"\">FOLD_STATUS_INNER_FOLD_FOLDED = 4<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);background: rgb(248, 250, 252);\">\n<section><span leaf=\"\">\u5185\u6298\u6298\u53e0\u6001<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);background: rgb(248, 250, 252);\">\n<section><span leaf=\"\">&#8211;mode 4<\/span><\/section>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong style=\"box-sizing: border-box;margin: 0px 0px 4px;padding: 0px;color: rgb(15, 23, 42);font-weight: 700;display: block;\"><span leaf=\"\">\u5982\u4f55\u786e\u8ba4\u4f60\u8bbe\u5907\u5bf9\u5e94\u7684 mode \u503c<\/span><\/strong><\/p>\n<p style=\"box-sizing: border-box;margin: 0px 0px 14px;padding: 0px;line-height: 1.9;\"><span leaf=\"\">\u4e0d\u540c\u5382\u5546\u7684 HarmonyOS \u8bbe\u5907\uff0cmode \u503c\u6620\u5c04\u53ef\u80fd\u4e0d\u540c\u3002\u5efa\u8bae\u5148\u7528\u4ee5\u4e0b\u547d\u4ee4\u67e5\u8be2\u8bbe\u5907\u652f\u6301\u7684\u663e\u793a\u6a21\u5f0f\uff1a<\/span><br style=\"box-sizing: border-box;margin: 0px;padding: 0px;\"  \/><code style=\"box-sizing: border-box;margin: 0px;padding: 1px 6px;background: rgb(241, 245, 249);border: 1px solid rgb(226, 232, 240);border-radius: 4px;font-size: 0.88em;color: rgb(99, 102, 241);font-family: &quot;Cascadia Code&quot;, &quot;Fira Code&quot;, monospace;\"><span leaf=\"\">hdc shell bm setDisplayMode -h<\/span><\/code><span leaf=\"\">&nbsp;\u6216&nbsp;<\/span><code style=\"box-sizing: border-box;margin: 0px;padding: 1px 6px;background: rgb(241, 245, 249);border: 1px solid rgb(226, 232, 240);border-radius: 4px;font-size: 0.88em;color: rgb(99, 102, 241);font-family: &quot;Cascadia Code&quot;, &quot;Fira Code&quot;, monospace;\"><span leaf=\"\">hdc shell bm setDisplayMode --help<\/span><\/code><br style=\"box-sizing: border-box;margin: 0px;padding: 0px;\"  \/><span leaf=\"\">\u5982\u679c\u6709\u8f93\u51fa\u5e2e\u52a9\u4fe1\u606f\uff0c\u4f1a\u5217\u51fa\u652f\u6301\u7684 mode \u503c\u3002\u5982\u679c\u65e0\u5e2e\u52a9\uff0c\u5148\u7528\u67e5\u8be2\u547d\u4ee4\u786e\u8ba4\u5f53\u524d\u72b6\u6001\uff0c\u518d\u9010\u4e2a\u5c1d\u8bd5 mode=0\/1\/2 \u7b49\u3002<\/span><\/p>\n<h4 style=\"box-sizing: border-box;margin: 24px 0px 12px;padding: 0px;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\" style=\"box-sizing: border-box;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span textstyle=\"\" style=\"font-size: 16px;color: #7a4fd6;\">3.2.3 Python \u5b9e\u73b0<\/span><\/span><\/h4>\n<p><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;background-color: #00d5ff;color: #ffffff;font-weight: bold;\">fold_control_harmony.py \u2014 HDC \u6298\u53e0\u63a7\u5236<\/span><\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"python\"><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;subprocess<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;time<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;re<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;os<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># ============ \u914d\u7f6e\u533a\uff08\u6839\u636e\u4f60\u7684\u8bbe\u5907\u4fee\u6539\uff09============<\/span><\/span><\/code><code><span leaf=\"\">HDC_PATH =&nbsp;<span class=\"code-snippet__string\">r\"D:\\Huawei\\DevEco Studio\\sdk\\default\\openharmony\\toolchains\\hdc.exe\"<\/span><\/span><\/code><code><span leaf=\"\">HARMONY_DEVICE_ID =&nbsp;<span class=\"code-snippet__string\">\"\"<\/span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class=\"code-snippet__comment\"># \u7559\u7a7a=\u5355\u8bbe\u5907\u81ea\u52a8\u5339\u914d\uff1b\u591a\u8bbe\u5907\u586b\u5e8f\u5217\u53f7\uff08hdc list targets \u67e5\u770b\uff09<\/span><\/span><\/code><code><span leaf=\"\">FOLD_TRANSITION_WAIT =&nbsp;<span class=\"code-snippet__number\">3<\/span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class=\"code-snippet__comment\"># \u6298\u53e0\u72b6\u6001\u5207\u6362\u540e\u7b49\u5f85\u79d2\u6570<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># ==================================================<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">run_hdc<\/span>(<span class=\"code-snippet__params\">command:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">str<\/span><\/span>) -&gt;&nbsp;<span class=\"code-snippet__built_in\">str<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"\u6267\u884c HDC \u547d\u4ee4\u5e76\u8fd4\u56de\u8f93\u51fa\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; hdc_exe = HDC_PATH<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;HARMONY_DEVICE_ID:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; full_cmd =&nbsp;<span class=\"code-snippet__string\">f'\"<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{hdc_exe}<\/span><\/span><span class=\"code-snippet__string\">\" -t&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{HARMONY_DEVICE_ID}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{command}<\/span><\/span><span class=\"code-snippet__string\">'<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">else<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; full_cmd =&nbsp;<span class=\"code-snippet__string\">f'\"<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{hdc_exe}<\/span><\/span><span class=\"code-snippet__string\">\"&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{command}<\/span><\/span><span class=\"code-snippet__string\">'<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; result = subprocess.run(<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; full_cmd, shell=<span class=\"code-snippet__literal\">True<\/span>, capture_output=<span class=\"code-snippet__literal\">True<\/span>, text=<span class=\"code-snippet__literal\">True<\/span>, timeout=<span class=\"code-snippet__number\">30<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;result.stdout.strip()<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">get_fold_status<\/span>() -&gt;&nbsp;<span class=\"code-snippet__built_in\">str<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"\u67e5\u8be2\u5f53\u524d\u6298\u53e0\u72b6\u6001\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; output = run_hdc(<span class=\"code-snippet__string\">\"shell hidumper -s 62 -a '-a'\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u67e5\u627e FoldStatus \u76f8\u5173\u4fe1\u606f<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">for<\/span>&nbsp;line&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;output.splitlines():<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;<span class=\"code-snippet__string\">\"FoldStatus\"<\/span>&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;line&nbsp;<span class=\"code-snippet__keyword\">or<\/span>&nbsp;<span class=\"code-snippet__string\">\"foldStatus\"<\/span>&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;line&nbsp;<span class=\"code-snippet__keyword\">or<\/span>&nbsp;<span class=\"code-snippet__string\">\"fold_status\"<\/span>&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;line:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;line.strip()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;<span class=\"code-snippet__string\">f\"unknown (raw:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{output[:<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__number\">200<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">]}<\/span><\/span><span class=\"code-snippet__string\">)\"<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">set_fold_state<\/span>(<span class=\"code-snippet__params\">state:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">str<\/span><\/span>) -&gt;&nbsp;<span class=\"code-snippet__built_in\">bool<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u901a\u8fc7 HDC \u63a7\u5236 HarmonyOS \u8bbe\u5907\u6298\u53e0\u72b6\u6001<\/span><\/code><code><span leaf=\"\"><br  \/><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u53c2\u6570:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; state: \"folded\"\uff08\u6298\u53e0\u6001\uff09\u6216 \"unfolded\"\uff08\u5c55\u5f00\u6001\uff09\u6216 \"half_folded\"\uff08\u60ac\u505c\u6001\uff09<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u8fd4\u56de:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; True=\u6210\u529f\uff0cFalse=\u5931\u8d25<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \"\"\"<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; mode_map = {<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"folded\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"1\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"unfolded\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"0\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"half_folded\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"2\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; }<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; display_name_map = {<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"folded\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"\u6298\u53e0\u6001\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"unfolded\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"\u5c55\u5f00\u6001\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"half_folded\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"\u60ac\u505c\u6001\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; }<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;state&nbsp;<span class=\"code-snippet__keyword\">not<\/span>&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;mode_map:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"[ERROR] \u672a\u77e5\u72b6\u6001:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{state}<\/span><\/span><span class=\"code-snippet__string\">\uff0c\u53ef\u7528\u503c: folded \/ unfolded \/ half_folded\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;<span class=\"code-snippet__literal\">False<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; mode = mode_map[state]<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; display_name = display_name_map[state]<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"[INFO] \u6b63\u5728\u5207\u6362\u5230&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{display_name}<\/span><\/span><span class=\"code-snippet__string\">\uff08mode=<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{mode}<\/span><\/span><span class=\"code-snippet__string\">\uff09...\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; current_status = get_fold_status()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"[INFO] \u5f53\u524d\u72b6\u6001:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{current_status}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u6267\u884c\u6298\u53e0\u72b6\u6001\u5207\u6362<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; result = run_hdc(<span class=\"code-snippet__string\">f\"shell bm setDisplayMode --mode&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{mode}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"[DEBUG] HDC \u8f93\u51fa:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{result}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;<span class=\"code-snippet__string\">\"error\"<\/span>&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;result.lower()&nbsp;<span class=\"code-snippet__keyword\">or<\/span>&nbsp;<span class=\"code-snippet__string\">\"fail\"<\/span>&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;result.lower():<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"[WARN] HDC \u8fd4\u56de\u5f02\u5e38:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{result}<\/span><\/span><span class=\"code-snippet__string\">\uff0c\u7ee7\u7eed\u7b49\u5f85...\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u7b49\u5f85\u7cfb\u7edf\u5b8c\u6210\u6298\u53e0\u72b6\u6001\u56de\u8c03<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"[INFO] \u7b49\u5f85&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{FOLD_TRANSITION_WAIT}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;\u79d2\uff0c\u7cfb\u7edf\u5b8c\u6210\u72b6\u6001\u5207\u6362...\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; time.sleep(FOLD_TRANSITION_WAIT)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u9a8c\u8bc1\u5207\u6362\u7ed3\u679c<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; new_status = get_fold_status()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"[OK] \u5207\u6362\u540e\u72b6\u6001:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{new_status}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;<span class=\"code-snippet__literal\">True<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">reset_to_unfolded<\/span>() -&gt;&nbsp;<span class=\"code-snippet__built_in\">bool<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"\u6062\u590d\u5230\u5c55\u5f00\u6001\uff08\u6d4b\u8bd5\u7ed3\u675f\u65f6\u8c03\u7528\uff09\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"[INFO] \u6062\u590d\u8bbe\u5907\u5230\u5c55\u5f00\u6001...\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;set_fold_state(<span class=\"code-snippet__string\">\"unfolded\"<\/span>)<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">if<\/span>&nbsp;__name__ ==&nbsp;<span class=\"code-snippet__string\">\"__main__\"<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u6d4b\u8bd5 HDC \u8fde\u63a5<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"=== HarmonyOS \u6298\u53e0\u72b6\u6001\u63a7\u5236\u6d4b\u8bd5 ===\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; devices = run_hdc(<span class=\"code-snippet__string\">\"list targets\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"[INFO] \u5df2\u8fde\u63a5\u8bbe\u5907:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{devices}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"\\n--- \u67e5\u8be2\u5f53\u524d\u6298\u53e0\u72b6\u6001 ---\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(get_fold_status())<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"\\n--- \u6d4b\u8bd5\u5207\u6362\u5230\u5c55\u5f00\u6001 ---\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; set_fold_state(<span class=\"code-snippet__string\">\"unfolded\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"\\n--- \u6d4b\u8bd5\u5207\u6362\u5230\u6298\u53e0\u6001 ---\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; set_fold_state(<span class=\"code-snippet__string\">\"folded\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"\\n--- \u6062\u590d\u5c55\u5f00\u6001 ---\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; reset_to_unfolded()<\/span><\/code><\/pre>\n<\/section>\n<h3 style=\"box-sizing: border-box;margin: 24px 0px 12px;padding: 0px;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\" style=\"box-sizing: border-box;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span textstyle=\"\" style=\"font-size: 16px;color: #7a4fd6;\">3.3 \u622a\u56fe\u7279\u6548\u7b49\u5f85\u903b\u8f91<\/span><\/span><\/h3>\n<p style=\"box-sizing: border-box;margin: 0px 0px 14px;padding: 0px;line-height: 1.9;color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: medium;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u5728\u6298\u53e0\u72b6\u6001\u5207\u6362\u540e\uff0cAndroid \/ HarmonyOS \u7cfb\u7edf\u4f1a\u89e6\u53d1\u663e\u793a\u6a21\u5f0f\u53d8\u66f4\u56de\u8c03\uff0cApp \u6536\u5230\u56de\u8c03\u540e\u5f00\u59cb\u91cd\u65b0\u6e32\u67d3 UI\u3002\u8fd9\u4e2a\u6e32\u67d3\u8fc7\u7a0b\u901a\u5e38\u9700\u8981 1-3 \u79d2\uff0c\u671f\u95f4\u622a\u56fe\u53ef\u80fd\u663e\u793a&#8221;\u534a\u6e32\u67d3\u72b6\u6001&#8221;\uff08\u5982\u767d\u5c4f\u3001\u5e03\u5c40\u9519\u4e71\u7b49\uff09\u3002<\/span><\/p>\n<p style=\"box-sizing: border-box;margin: 0px 0px 14px;padding: 0px;line-height: 1.9;color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: medium;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u4e3a\u4e86\u907f\u514d\u622a\u56fe\u5230\u8fc7\u6e21\u6001\uff0c\u672c\u6587\u7684\u811a\u672c\u5728\u6bcf\u4e2a\u622a\u56fe\u64cd\u4f5c\u540e\u90fd\u7b49\u5f85\u622a\u56fe\u7279\u6548\u6d88\u5931\u3002\u6838\u5fc3\u903b\u8f91\uff1a<\/span><\/p>\n<p><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;background-color: #00d5ff;color: #ffffff;font-weight: bold;\">screenshot_helper.py \u2014 \u622a\u56fe\u7279\u6548\u7b49\u5f85\u903b\u8f91<\/span><\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"python\"><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;os<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;time<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;subprocess<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">wait_screenshot_ready<\/span>(<span class=\"code-snippet__params\">screenshot_path:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">str<\/span><\/span><span class=\"code-snippet__params\">, timeout:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">float<\/span><\/span><span class=\"code-snippet__params\">&nbsp;=&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__number\">5.0<\/span><\/span>) -&gt;&nbsp;<span class=\"code-snippet__built_in\">bool<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u7b49\u5f85\u622a\u56fe\u6587\u4ef6\u5199\u5165\u5b8c\u6210\uff08screencap \u8fdb\u7a0b\u9000\u51fa\u4e14\u6587\u4ef6\u5927\u5c0f\u7a33\u5b9a\uff09<\/span><\/code><code><span leaf=\"\"><br  \/><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u539f\u7406\uff1a<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; 1. screencap \u662f\u5f02\u6b65\u8fdb\u7a0b\uff0c\u8c03\u7528 save_screenshot() \u540e\u8fdb\u7a0b\u542f\u52a8<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; 2. \u8fdb\u7a0b\u9000\u51fa\u65f6\u6587\u4ef6\u5199\u5165\u5b8c\u6210<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; 3. \u901a\u8fc7\u8f6e\u8be2\u6587\u4ef6\u5927\u5c0f\u9a8c\u8bc1\u5199\u5165\u7a33\u5b9a\u6027\uff08\u8fde\u7eed\u4e24\u6b21\u5927\u5c0f\u4e00\u81f4=\u5199\u5165\u5b8c\u6210\uff09<\/span><\/code><code><span leaf=\"\"><br  \/><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u53c2\u6570:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; screenshot_path: \u622a\u56fe\u6587\u4ef6\u8def\u5f84<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; timeout: \u6700\u5927\u7b49\u5f85\u79d2\u6570<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u8fd4\u56de:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; True=\u622a\u56fe\u5c31\u7eea\uff0cFalse=\u8d85\u65f6<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \"\"\"<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;<span class=\"code-snippet__keyword\">not<\/span>&nbsp;os.path.exists(screenshot_path):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"[WARN] \u622a\u56fe\u6587\u4ef6\u4e0d\u5b58\u5728:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{screenshot_path}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;<span class=\"code-snippet__literal\">False<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; start = time.time()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; last_size = -<span class=\"code-snippet__number\">1<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; stable_count =&nbsp;<span class=\"code-snippet__number\">0<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">while<\/span>&nbsp;time.time() - start &lt; timeout:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; time.sleep(<span class=\"code-snippet__number\">0.3<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">try<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; current_size = os.path.getsize(screenshot_path)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;current_size == last_size&nbsp;<span class=\"code-snippet__keyword\">and<\/span>&nbsp;current_size &gt;&nbsp;<span class=\"code-snippet__number\">0<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stable_count +=&nbsp;<span class=\"code-snippet__number\">1<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;stable_count &gt;=&nbsp;<span class=\"code-snippet__number\">2<\/span>: &nbsp;<span class=\"code-snippet__comment\"># \u8fde\u7eed\u4e24\u6b21\u5927\u5c0f\u4e00\u81f4<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;<span class=\"code-snippet__literal\">True<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">else<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stable_count =&nbsp;<span class=\"code-snippet__number\">0<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; last_size = current_size<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">except<\/span>&nbsp;OSError:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">pass<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"[WARN] \u7b49\u5f85\u622a\u56fe\u5c31\u7eea\u8d85\u65f6\uff0c\u6587\u4ef6\u5927\u5c0f:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{os.path.getsize(screenshot_path)&nbsp;<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__keyword\">if<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">&nbsp;os.path.exists(screenshot_path)&nbsp;<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__keyword\">else<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">&nbsp;<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'N\/A'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;<span class=\"code-snippet__literal\">False<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">take_screenshot<\/span>(<span class=\"code-snippet__params\">driver, filepath:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">str<\/span><\/span><span class=\"code-snippet__params\">, wait_effect:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">bool<\/span><\/span><span class=\"code-snippet__params\">&nbsp;=&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__literal\">True<\/span><\/span>) -&gt;&nbsp;<span class=\"code-snippet__built_in\">bool<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u6267\u884c\u622a\u56fe\u5e76\u7b49\u5f85\u622a\u56fe\u7279\u6548\u6d88\u5931<\/span><\/code><code><span leaf=\"\"><br  \/><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u53c2\u6570:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; driver: Appium WebDriver \u5b9e\u4f8b<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; filepath: \u622a\u56fe\u4fdd\u5b58\u8def\u5f84<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; wait_effect: \u662f\u5426\u7b49\u5f85\u622a\u56fe\u7279\u6548\uff08\u6700\u540e\u4e00\u6b65\u9000\u51fa\u65f6\u4f20 False\uff09<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u8fd4\u56de:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; True=\u622a\u56fe\u6210\u529f\uff0cFalse=\u5931\u8d25<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \"\"\"<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">try<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; driver.save_screenshot(filepath)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"[DEBUG] \u622a\u56fe\u5df2\u4fdd\u5b58:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{filepath}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">except<\/span>&nbsp;Exception&nbsp;<span class=\"code-snippet__keyword\">as<\/span>&nbsp;e:\\n &nbsp; &nbsp; &nbsp; &nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"[ERROR] \u622a\u56fe\u5931\u8d25:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{e}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;<span class=\"code-snippet__literal\">False<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;wait_effect:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;wait_screenshot_ready(filepath)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;<span class=\"code-snippet__literal\">True<\/span><\/span><\/code><\/pre>\n<\/section>\n<section><span leaf=\"\"><br  \/><\/span><\/section>\n<hr style=\"border-style: solid;border-width: 1px 0 0;border-color: rgba(0,0,0,0.1);-webkit-transform-origin: 0 0;-webkit-transform: scale(1, 0.5);transform-origin: 0 0;transform: scale(1, 0.5);\"  \/>\n<section><span style=\"box-sizing: border-box;margin: 0px;padding: 3px 10px;font-size: 0.75rem;background: rgba(255, 255, 255, 0.25);border-radius: 99px;letter-spacing: 1px;font-weight: 700;color: rgb(255, 255, 255);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\"><br  \/><\/span><\/span><\/section>\n<section><span data-pm-slice=\"0 0 []\"><span leaf=\"\" style=\"box-sizing: border-box;margin: 0px;padding: 3px 10px;font-size: 0.75rem;background: rgba(255, 255, 255, 0.25);border-radius: 99px;letter-spacing: 1px;font-weight: 700;\"><span textstyle=\"\" style=\"font-size: 18px;color: #d6a841;font-weight: bold;\">\u7b2c\u56db\u7ae0&nbsp;<\/span><span textstyle=\"\" style=\"font-size: 17px;color: #0052ff;font-weight: bold;\">\u5b9e\u6218\u6f14\u793a\uff1a\u6296\u97f3\u81ea\u52a8\u5316+\u6298\u53e0\/\u5c55\u5f00\uff08Android \u811a\u672c\uff09<\/span><\/span><\/span><\/section>\n<section style=\"text-indent: 2em;\"><span style=\"color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: medium;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\" data-pm-slice=\"0 0 []\"><span leaf=\"\">\u672c\u7ae0\u7ed9\u51fa\u5b8c\u6574\u7684 Android \u7248\u6296\u97f3\u6298\u53e0\u5c4f\u6d4b\u8bd5\u811a\u672c\u3002\u4ee5\u6296\u97f3 APP \u4e3a\u4f8b\uff0c\u6f14\u793a\u5728\u6298\u53e0\u5c4f\u5c55\u5f00\u6001\u548c\u6298\u53e0\u6001\u4e0b\u6267\u884c&#8221;\u6253\u5f00 \u2192 \u641c\u7d22 \u2192 \u70b9\u51fb \u2192 \u9000\u51fa&#8221;\u56db\u6b65\u64cd\u4f5c\uff0c\u5e76\u5728\u6bcf\u6b65\u540e\u622a\u56fe\u3002\u811a\u672c\u6700\u540e\u96c6\u6210 AI \u89c6\u89c9\u5206\u6790\u8c03\u7528\u3002<\/span><\/span><\/section>\n<h3 style=\"box-sizing: border-box;margin: 24px 0px 12px;padding: 0px;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\" style=\"box-sizing: border-box;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span textstyle=\"\" style=\"font-size: 16px;color: #7a4fd6;\">4.1 \u73af\u5883\u51c6\u5907\u6e05\u5355<\/span><\/span><\/h3>\n<p style=\"box-sizing: border-box;margin: 0px 0px 14px;padding: 0px;line-height: 1.9;color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: medium;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u5f00\u59cb\u4e4b\u524d\uff0c\u786e\u8ba4\u4ee5\u4e0b\u73af\u5883\u5df2\u5c31\u7eea\uff1a<\/span><\/p>\n<table style=\"box-sizing: border-box;margin: 16px 0px;padding: 0px;width: 864px;border-collapse: collapse;font-size: 0.9rem;color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\">\n<tbody>\n<tr style=\"box-sizing: border-box;margin: 0px;padding: 0px;\">\n<th style=\"box-sizing: border-box;margin: 0px;padding: 10px 14px;background: none 0% 0% \/ auto repeat scroll padding-box border-box rgb(15, 23, 42);color: rgb(255, 255, 255);text-align: left;font-weight: 700;\">\n<section style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: #d6a841;\">\u4f9d\u8d56\u9879<\/span><\/span><\/section>\n<\/th>\n<th style=\"box-sizing: border-box;margin: 0px;padding: 10px 14px;background: none 0% 0% \/ auto repeat scroll padding-box border-box rgb(15, 23, 42);color: rgb(255, 255, 255);text-align: left;font-weight: 700;\">\n<section style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: #d6a841;\">\u7248\u672c\u8981\u6c42<\/span><\/span><\/section>\n<\/th>\n<th style=\"box-sizing: border-box;margin: 0px;padding: 10px 14px;background: none 0% 0% \/ auto repeat scroll padding-box border-box rgb(15, 23, 42);color: rgb(255, 255, 255);text-align: left;font-weight: 700;\">\n<section style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: #d6a841;\">\u5b89\u88c5\u65b9\u5f0f<\/span><\/span><\/section>\n<\/th>\n<th style=\"box-sizing: border-box;margin: 0px;padding: 10px 14px;background: none 0% 0% \/ auto repeat scroll padding-box border-box rgb(15, 23, 42);color: rgb(255, 255, 255);text-align: left;font-weight: 700;\">\n<section style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: #d6a841;\">\u9a8c\u8bc1\u547d\u4ee4<\/span><\/span><\/section>\n<\/th>\n<\/tr>\n<tr style=\"box-sizing: border-box;margin: 0px;padding: 0px;\">\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);background: rgb(248, 250, 252);\">\n<section><span leaf=\"\">Python<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);background: rgb(248, 250, 252);\">\n<section><span leaf=\"\">3.9+<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);background: rgb(248, 250, 252);\">\n<section><span leaf=\"\">python.org \u4e0b\u8f7d<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);background: rgb(248, 250, 252);\"><code style=\"box-sizing: border-box;margin: 0px;padding: 1px 6px;background: rgb(241, 245, 249);border: 1px solid rgb(226, 232, 240);border-radius: 4px;font-size: 0.88em;color: rgb(99, 102, 241);font-family: &quot;Cascadia Code&quot;, &quot;Fira Code&quot;, monospace;\"><span leaf=\"\">python --version<\/span><\/code><\/td>\n<\/tr>\n<tr style=\"box-sizing: border-box;margin: 0px;padding: 0px;\">\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);\">\n<section><span leaf=\"\">Appium Server<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);\">\n<section><span leaf=\"\">2.x<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);\"><code style=\"box-sizing: border-box;margin: 0px;padding: 1px 6px;background: rgb(241, 245, 249);border: 1px solid rgb(226, 232, 240);border-radius: 4px;font-size: 0.88em;color: rgb(99, 102, 241);font-family: &quot;Cascadia Code&quot;, &quot;Fira Code&quot;, monospace;\"><span leaf=\"\">npm i -g appium<\/span><\/code><\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);\"><code style=\"box-sizing: border-box;margin: 0px;padding: 1px 6px;background: rgb(241, 245, 249);border: 1px solid rgb(226, 232, 240);border-radius: 4px;font-size: 0.88em;color: rgb(99, 102, 241);font-family: &quot;Cascadia Code&quot;, &quot;Fira Code&quot;, monospace;\"><span leaf=\"\">appium --version<\/span><\/code><\/td>\n<\/tr>\n<tr style=\"box-sizing: border-box;margin: 0px;padding: 0px;\">\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);background: rgb(248, 250, 252);\">\n<section><span leaf=\"\">Appium Python Client<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);background: rgb(248, 250, 252);\">\n<section><span leaf=\"\">\u6700\u65b0<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);background: rgb(248, 250, 252);\"><code style=\"box-sizing: border-box;margin: 0px;padding: 1px 6px;background: rgb(241, 245, 249);border: 1px solid rgb(226, 232, 240);border-radius: 4px;font-size: 0.88em;color: rgb(99, 102, 241);font-family: &quot;Cascadia Code&quot;, &quot;Fira Code&quot;, monospace;\"><span leaf=\"\">pip install appium-python-client<\/span><\/code><\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);background: rgb(248, 250, 252);\"><code style=\"box-sizing: border-box;margin: 0px;padding: 1px 6px;background: rgb(241, 245, 249);border: 1px solid rgb(226, 232, 240);border-radius: 4px;font-size: 0.88em;color: rgb(99, 102, 241);font-family: &quot;Cascadia Code&quot;, &quot;Fira Code&quot;, monospace;\"><span leaf=\"\">pip show appium-python-client<\/span><\/code><\/td>\n<\/tr>\n<tr style=\"box-sizing: border-box;margin: 0px;padding: 0px;\">\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);\">\n<section><span leaf=\"\">Android SDK (adb)<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);\">\n<section><span leaf=\"\">\u542b platform-tools<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);\">\n<section><span leaf=\"\">Android Studio \u5185\u7f6e<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);\"><code style=\"box-sizing: border-box;margin: 0px;padding: 1px 6px;background: rgb(241, 245, 249);border: 1px solid rgb(226, 232, 240);border-radius: 4px;font-size: 0.88em;color: rgb(99, 102, 241);font-family: &quot;Cascadia Code&quot;, &quot;Fira Code&quot;, monospace;\"><span leaf=\"\">adb version<\/span><\/code><\/td>\n<\/tr>\n<tr style=\"box-sizing: border-box;margin: 0px;padding: 0px;\">\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);background: rgb(248, 250, 252);\">\n<section><span leaf=\"\">requests\uff08AI \u5206\u6790\u7528\uff09<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);background: rgb(248, 250, 252);\">\n<section><span leaf=\"\">\u6700\u65b0<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);background: rgb(248, 250, 252);\"><code style=\"box-sizing: border-box;margin: 0px;padding: 1px 6px;background: rgb(241, 245, 249);border: 1px solid rgb(226, 232, 240);border-radius: 4px;font-size: 0.88em;color: rgb(99, 102, 241);font-family: &quot;Cascadia Code&quot;, &quot;Fira Code&quot;, monospace;\"><span leaf=\"\">pip install requests<\/span><\/code><\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);background: rgb(248, 250, 252);\"><code style=\"box-sizing: border-box;margin: 0px;padding: 1px 6px;background: rgb(241, 245, 249);border: 1px solid rgb(226, 232, 240);border-radius: 4px;font-size: 0.88em;color: rgb(99, 102, 241);font-family: &quot;Cascadia Code&quot;, &quot;Fira Code&quot;, monospace;\"><span leaf=\"\">pip show requests<\/span><\/code><\/td>\n<\/tr>\n<tr style=\"box-sizing: border-box;margin: 0px;padding: 0px;\">\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);\">\n<section><span leaf=\"\">Android \u771f\u673a\/\u6298\u53e0\u5c4f<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);\">\n<section><span leaf=\"\">\u5f00\u542f USB \u8c03\u8bd5<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);\">\n<section><span leaf=\"\">\u8bbe\u5907\u8bbe\u7f6e \u2192 \u5f00\u53d1\u8005\u9009\u9879<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);\"><code style=\"box-sizing: border-box;margin: 0px;padding: 1px 6px;background: rgb(241, 245, 249);border: 1px solid rgb(226, 232, 240);border-radius: 4px;font-size: 0.88em;color: rgb(99, 102, 241);font-family: &quot;Cascadia Code&quot;, &quot;Fira Code&quot;, monospace;\"><span leaf=\"\">adb devices<\/span><\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"576\">\n<p data-pm-slice=\"3 3 []\" style=\"text-align: center;\"><strong style=\"box-sizing: border-box;margin: 0px 0px 4px;padding: 0px;color: rgb(15, 23, 42);font-weight: 700;display: block;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 16px;color: #ff2941;font-weight: bold;\">\u5982\u4f55\u5f00\u542f USB \u8c03\u8bd5<\/span><\/span><\/strong><\/p>\n<p><strong><span leaf=\"\" style=\"color:rgba(0, 0, 0, 0.9);font-size:17px;font-family:&quot;mp-quote&quot;, &quot;PingFang SC&quot;, system-ui, -apple-system, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei UI&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;line-height:1.6;letter-spacing:0.034em;font-style:normal;font-weight:normal;\"><span textstyle=\"\" style=\"font-size: 15px;color: #0052ff;\">\u6298\u53e0\u5c4f\u624b\u673a \u2192 \u8bbe\u7f6e \u2192 \u5173\u4e8e\u624b\u673a \u2192 \u8fde\u7eed\u70b9\u51fb&#8221;\u7248\u672c\u53f7&#8221;7\u6b21\u8fdb\u5165\u5f00\u53d1\u8005\u6a21\u5f0f \u2192 \u8fd4\u56de\u8bbe\u7f6e \u2192 \u5f00\u53d1\u8005\u9009\u9879 \u2192 \u5f00\u542f&#8221;USB \u8c03\u8bd5&#8221;\u548c&#8221;USB \u8c03\u8bd5\uff08\u5b89\u5168\u8bbe\u7f6e\uff09&#8221;\uff08\u5141\u8bb8\u901a\u8fc7 USB \u8c03\u8bd5\u4fee\u6539\u6743\u9650\uff09\u3002\u7528\u6570\u636e\u7ebf\u8fde\u63a5\u7535\u8111\uff0c\u5728\u624b\u673a\u4e0a\u786e\u8ba4&#8221;\u5141\u8bb8 USB \u8c03\u8bd5&#8221;\u7684\u5f39\u7a97<\/span><\/span><\/strong><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"box-sizing: border-box;margin: 24px 0px 12px;padding: 0px;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><strong><span leaf=\"\" style=\"box-sizing: border-box;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span textstyle=\"\" style=\"font-size: 16px;color: #7a4fd6;\">4.2 \u5b8c\u6574 Python \u811a\u672c\uff08Android \u7248\uff09<\/span><\/span><\/strong><\/p>\n<p style=\"box-sizing: border-box;margin: 0px 0px 14px;padding: 0px;line-height: 1.9;color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: medium;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u4e0b\u9762\u662f\u5b8c\u6574\u7684\u53ef\u8fd0\u884c\u811a\u672c\uff0c\u590d\u5236\u4fdd\u5b58\u4e3a&nbsp;<\/span><code style=\"box-sizing: border-box;margin: 0px;padding: 1px 6px;background: rgb(241, 245, 249);border: 1px solid rgb(226, 232, 240);border-radius: 4px;font-size: 0.88em;color: rgb(99, 102, 241);font-family: &quot;Cascadia Code&quot;, &quot;Fira Code&quot;, monospace;\"><span leaf=\"\">foldable_test_android.py<\/span><\/code><span leaf=\"\">\uff0c\u4fee\u6539\u914d\u7f6e\u533a\u7684\u53c2\u6570\u540e\u76f4\u63a5\u8fd0\u884c\uff1a<\/span><\/p>\n<p><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;background-color: #00d5ff;color: #ffffff;font-weight: bold;\">f<\/span><\/span><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;background-color: #00d5ff;color: #ffffff;font-weight: bold;\">oldable_test_andro<\/span><\/span><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;background-color: #00d5ff;color: #ffffff;font-weight: bold;\">id.py\u2014Android\u6296\u97f3\u6298\u53e0\u5c4f\u6d4b\u8bd5\u811a\u672c<\/span><\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"python\"><code><span leaf=\"\"><span class=\"code-snippet__comment\">#!\/usr\/bin\/env python3<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># -*- coding: utf-8 -*-<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__string\">\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">Android \u6298\u53e0\u5c4f\u517c\u5bb9\u6027\u6d4b\u8bd5\u811a\u672c<\/span><\/code><code><span leaf=\"\">\u6d4b\u8bd5 APP\uff1a\u6296\u97f3\uff08com.ss.android.ugc.aweme\uff09<\/span><\/code><code><span leaf=\"\">\u6d4b\u8bd5\u6d41\u7a0b\uff1a\u5c55\u5f00\u6001 4 \u6b65 \u2192 \u6298\u53e0\u6001 4 \u6b65 \u2192 AI \u89c6\u89c9\u5206\u6790<\/span><\/code><code><span leaf=\"\">\u4f9d\u8d56\u5b89\u88c5\uff1apip install appium-python-client requests<\/span><\/code><code><span leaf=\"\">\u8fd0\u884c\u65b9\u5f0f\uff1apython foldable_test_android.py<\/span><\/code><code><span leaf=\"\">\"\"\"<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;os<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;time<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;subprocess<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;re<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;requests<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">from<\/span>&nbsp;appium&nbsp;<span class=\"code-snippet__keyword\">import<\/span>&nbsp;webdriver<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">from<\/span>&nbsp;appium.options.android&nbsp;<span class=\"code-snippet__keyword\">import<\/span>&nbsp;UiAutomator2Options<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">from<\/span>&nbsp;appium.webdriver.common.appiumby&nbsp;<span class=\"code-snippet__keyword\">import<\/span>&nbsp;AppiumBy<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># ============ \u914d\u7f6e\u533a\uff08\u6839\u636e\u4f60\u7684\u73af\u5883\u4fee\u6539\uff09============<\/span><\/span><\/code><code><span leaf=\"\">APPIUM_SERVER =&nbsp;<span class=\"code-snippet__string\">\"http:\/\/127.0.0.1:4723\"<\/span><\/span><\/code><code><span leaf=\"\">ANDROID_DEVICE_ADDR =&nbsp;<span class=\"code-snippet__string\">\"192.168.1.100:5555\"<\/span>&nbsp; &nbsp;<span class=\"code-snippet__comment\"># adb devices \u67e5\u5230\u7684\u8bbe\u5907\u5730\u5740<\/span><\/span><\/code><code><span leaf=\"\">DOUYIN_PACKAGE =&nbsp;<span class=\"code-snippet__string\">\"com.ss.android.ugc.aweme\"<\/span><\/span><\/code><code><span leaf=\"\">DOUYIN_ACTIVITY =&nbsp;<span class=\"code-snippet__string\">\"com.ss.android.ugc.aweme.main.MainActivity\"<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># \u6298\u53e0\u5c4f\u5206\u8fa8\u7387\uff08\u67e5 adb shell wm size \u83b7\u53d6\u4f60\u7684\u8bbe\u5907\u5b9e\u9645\u503c\uff09<\/span><\/span><\/code><code><span leaf=\"\">ORIGINAL_RESOLUTION =&nbsp;<span class=\"code-snippet__string\">\"2208x1840\"<\/span>&nbsp; &nbsp;<span class=\"code-snippet__comment\"># \u5c55\u5f00\u6001\u5206\u8fa8\u7387<\/span><\/span><\/code><code><span leaf=\"\">FOLDED_RESOLUTION =&nbsp;<span class=\"code-snippet__string\">\"984x2096\"<\/span>&nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u6298\u53e0\u6001\u5206\u8fa8\u7387<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># \u622a\u56fe\u4fdd\u5b58\u76ee\u5f55<\/span><\/span><\/code><code><span leaf=\"\">SCREENSHOT_DIR =&nbsp;<span class=\"code-snippet__string\">r\"C:\\Users\\51362\\Desktop\\\u6587\u7ae0\\foldable_test_screenshots\"<\/span><\/span><\/code><code><span leaf=\"\">os.makedirs(SCREENSHOT_DIR, exist_ok=<span class=\"code-snippet__literal\">True<\/span>)<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># AI \u89c6\u89c9\u5206\u6790\u914d\u7f6e\uff08\u66ff\u6362\u4e3a\u4f60\u7684 API Key \u548c\u63a5\u53e3\u5730\u5740\uff09<\/span><\/span><\/code><code><span leaf=\"\">AI_VISION_API_URL =&nbsp;<span class=\"code-snippet__string\">\"https:\/\/dashscope.aliyuncs.com\/api\/v1\/services\/vision\/vision\/describe\"<\/span><\/span><\/code><code><span leaf=\"\">AI_API_KEY =&nbsp;<span class=\"code-snippet__string\">\"your-api-key-here\"<\/span>&nbsp; &nbsp;<span class=\"code-snippet__comment\"># \u66ff\u6362\u4e3a\u901a\u4e49\u5343\u95ee API Key<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># ==================================================<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># ============ \u6298\u53e0\u63a7\u5236\u533a\uff08ADB + wm size\uff09============<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">run_adb<\/span>(<span class=\"code-snippet__params\">command:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">str<\/span><\/span>) -&gt;&nbsp;<span class=\"code-snippet__built_in\">str<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; full_cmd =&nbsp;<span class=\"code-snippet__string\">f\"adb -s&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{ANDROID_DEVICE_ADDR}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{command}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; result = subprocess.run(full_cmd, shell=<span class=\"code-snippet__literal\">True<\/span>, capture_output=<span class=\"code-snippet__literal\">True<\/span>, text=<span class=\"code-snippet__literal\">True<\/span>, timeout=<span class=\"code-snippet__number\">30<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;result.stdout.strip()<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">get_current_resolution<\/span>() -&gt;&nbsp;<span class=\"code-snippet__built_in\">str<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; output = run_adb(<span class=\"code-snippet__string\">\"shell wm size\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">match<\/span>&nbsp;= re.search(<span class=\"code-snippet__string\">r'Override size:\\s*(\\d+x\\d+)'<\/span>, output)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;<span class=\"code-snippet__keyword\">match<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;<span class=\"code-snippet__keyword\">match<\/span>.group(<span class=\"code-snippet__number\">1<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">match<\/span>&nbsp;= re.search(<span class=\"code-snippet__string\">r'Physical size:\\s*(\\d+x\\d+)'<\/span>, output)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;<span class=\"code-snippet__keyword\">match<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;<span class=\"code-snippet__keyword\">match<\/span>.group(<span class=\"code-snippet__number\">1<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;<span class=\"code-snippet__string\">\"unknown\"<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">set_fold_state<\/span>(<span class=\"code-snippet__params\">state:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">str<\/span><\/span>) -&gt;&nbsp;<span class=\"code-snippet__built_in\">bool<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"\u901a\u8fc7 ADB wm size \u63a7\u5236\u6298\u53e0\u72b6\u6001\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;state ==&nbsp;<span class=\"code-snippet__string\">\"folded\"<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; target = FOLDED_RESOLUTION<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">elif<\/span>&nbsp;state ==&nbsp;<span class=\"code-snippet__string\">\"unfolded\"<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; target = ORIGINAL_RESOLUTION<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">else<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;<span class=\"code-snippet__literal\">False<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"[INFO] \u5207\u6362\u5230&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{state}<\/span><\/span><span class=\"code-snippet__string\">\uff0c\u5206\u8fa8\u7387:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{target}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; run_adb(<span class=\"code-snippet__string\">f\"shell wm size&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{target}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; time.sleep(<span class=\"code-snippet__number\">3<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"[INFO] \u5f53\u524d\u5206\u8fa8\u7387:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{get_current_resolution()}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;<span class=\"code-snippet__literal\">True<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># ============ \u622a\u56fe\u7279\u6548\u7b49\u5f85\u533a =============<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">wait_screenshot_ready<\/span>(<span class=\"code-snippet__params\">path:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">str<\/span><\/span><span class=\"code-snippet__params\">, timeout:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">float<\/span><\/span><span class=\"code-snippet__params\">&nbsp;=&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__number\">5.0<\/span><\/span>) -&gt;&nbsp;<span class=\"code-snippet__built_in\">bool<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;<span class=\"code-snippet__keyword\">not<\/span>&nbsp;os.path.exists(path):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;<span class=\"code-snippet__literal\">False<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; start = time.time()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; last_size = -<span class=\"code-snippet__number\">1<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; stable =&nbsp;<span class=\"code-snippet__number\">0<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">while<\/span>&nbsp;time.time() - start &lt; timeout:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; time.sleep(<span class=\"code-snippet__number\">0.3<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">try<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; s = os.path.getsize(path)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;s == last_size&nbsp;<span class=\"code-snippet__keyword\">and<\/span>&nbsp;s &gt;&nbsp;<span class=\"code-snippet__number\">0<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stable +=&nbsp;<span class=\"code-snippet__number\">1<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;stable &gt;=&nbsp;<span class=\"code-snippet__number\">2<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;<span class=\"code-snippet__literal\">True<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">else<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stable =&nbsp;<span class=\"code-snippet__number\">0<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; last_size = s<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">except<\/span>&nbsp;OSError:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">pass<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;<span class=\"code-snippet__literal\">False<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">take_screenshot<\/span>(<span class=\"code-snippet__params\">driver, filepath:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">str<\/span><\/span><span class=\"code-snippet__params\">, wait:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">bool<\/span><\/span><span class=\"code-snippet__params\">&nbsp;=&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__literal\">True<\/span><\/span>) -&gt;&nbsp;<span class=\"code-snippet__built_in\">bool<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">try<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; driver.save_screenshot(filepath)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">except<\/span>&nbsp;Exception&nbsp;<span class=\"code-snippet__keyword\">as<\/span>&nbsp;e:\\n &nbsp; &nbsp; &nbsp; &nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"[ERROR] \u622a\u56fe\u5931\u8d25:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{e}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;<span class=\"code-snippet__literal\">False<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;wait:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;wait_screenshot_ready(filepath)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;<span class=\"code-snippet__literal\">True<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># ============ AI \u89c6\u89c9\u5206\u6790\u533a =============<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">analyze_image_via_ai<\/span>(<span class=\"code-snippet__params\">image_path:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">str<\/span><\/span><span class=\"code-snippet__params\">, state:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">str<\/span><\/span><span class=\"code-snippet__params\">, step:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">int<\/span><\/span>) -&gt;&nbsp;<span class=\"code-snippet__built_in\">dict<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u8c03\u7528\u901a\u4e49\u5343\u95ee\u89c6\u89c9 API \u5206\u6790\u622a\u56fe<\/span><\/code><code><span leaf=\"\"><br  \/><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u8fd4\u56de:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; {\"normal\": bool, \"description\": str, \"confidence\": float}<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \"\"\"<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;<span class=\"code-snippet__keyword\">not<\/span>&nbsp;os.path.exists(image_path):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;{<span class=\"code-snippet__string\">\"normal\"<\/span>:&nbsp;<span class=\"code-snippet__literal\">False<\/span>,&nbsp;<span class=\"code-snippet__string\">\"description\"<\/span>:&nbsp;<span class=\"code-snippet__string\">f\"\u622a\u56fe\u6587\u4ef6\u4e0d\u5b58\u5728:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{image_path}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>,&nbsp;<span class=\"code-snippet__string\">\"confidence\"<\/span>:&nbsp;<span class=\"code-snippet__number\">0.0<\/span>}<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">with<\/span>&nbsp;<span class=\"code-snippet__built_in\">open<\/span>(image_path,&nbsp;<span class=\"code-snippet__string\">\"rb\"<\/span>)&nbsp;<span class=\"code-snippet__keyword\">as<\/span>&nbsp;f:\\n &nbsp; &nbsp; &nbsp; &nbsp;image_data = f.read()\\n\\n &nbsp; &nbsp;<span class=\"code-snippet__keyword\">import<\/span>&nbsp;base64\\n &nbsp; &nbsp;image_base64 = base64.b64encode(image_data).decode(<span class=\"code-snippet__string\">\"utf-8\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; prompt = (<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\u4f60\u662f\u4e00\u4f4d\u4e13\u4e1a\u7684 APP \u517c\u5bb9\u6027\u6d4b\u8bd5\u5de5\u7a0b\u5e08\u3002\u8bf7\u4ed4\u7ec6\u5206\u6790\u8fd9\u5f20\u622a\u56fe\uff0c\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\u5224\u65ad\u6296\u97f3 APP \u5f53\u524d\u754c\u9762\u662f\u5426\u6b63\u5e38\u3002\u6ce8\u610f\u68c0\u67e5\u4ee5\u4e0b\u51e0\u70b9\uff1a\\n\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"1. \u5e03\u5c40\u662f\u5426\u6b63\u5e38\uff08\u5143\u7d20\u6709\u65e0\u91cd\u53e0\u3001\u622a\u65ad\u3001\u9519\u4f4d\uff09\\n\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"2. \u6587\u5b57\u662f\u5426\u6e05\u6670\u53ef\u8bfb\uff08\u65e0\u4e71\u7801\u3001\u65e0\u906e\u6321\uff09\\n\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"3. \u56fe\u7247\u662f\u5426\u6b63\u5e38\u663e\u793a\uff08\u65e0\u7f3a\u5931\u3001\u65e0\u82b1\u5c4f\uff09\\n\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"4. \u6574\u4f53\u89c6\u89c9\u662f\u5426\u534f\u8c03\uff08\u65e0\u5f02\u5e38\u7559\u767d\u3001\u65e0\u5143\u7d20\u5f02\u5e38\u653e\u5927\u6216\u7f29\u5c0f\uff09\\n\\n\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\u8bf7\u7528 JSON \u683c\u5f0f\u8fd4\u56de\u5206\u6790\u7ed3\u679c\uff1a\\n\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">'{\"normal\": true\/false, \"description\": \"\u754c\u9762\u63cf\u8ff0\", '<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">'\"issues\": [\"\u95ee\u98981\", \"\u95ee\u98982\"], \"confidence\": 0.0~1.0}'<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; headers = {<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"Authorization\"<\/span>:&nbsp;<span class=\"code-snippet__string\">f\"Bearer&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{AI_API_KEY}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"Content-Type\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"application\/json\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; }<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; payload = {<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"model\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"qwen-vl-plus\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"input\"<\/span>: {<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"messages\"<\/span>: [<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"role\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"user\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"content\"<\/span>: [<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<span class=\"code-snippet__string\">\"image\"<\/span>:&nbsp;<span class=\"code-snippet__string\">f\"data:image\/png;base64,<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{image_base64}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>},<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<span class=\"code-snippet__string\">\"text\"<\/span>: prompt}<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; }<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; }<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">try<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; resp = requests.post(AI_VISION_API_URL, headers=headers, json=payload, timeout=<span class=\"code-snippet__number\">30<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;resp.status_code ==&nbsp;<span class=\"code-snippet__number\">200<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; result = resp.json()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u89e3\u6790\u8fd4\u56de\u5185\u5bb9\uff08\u901a\u4e49\u5343\u95ee\u683c\u5f0f\uff09<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; content = result.get(<span class=\"code-snippet__string\">\"output\"<\/span>, {}).get(<span class=\"code-snippet__string\">\"choices\"<\/span>, [{}])[<span class=\"code-snippet__number\">0<\/span>].get(<span class=\"code-snippet__string\">\"message\"<\/span>, {}).get(<span class=\"code-snippet__string\">\"content\"<\/span>,&nbsp;<span class=\"code-snippet__string\">\"\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u5c1d\u8bd5\u89e3\u6790 JSON<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">import<\/span>&nbsp;json<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">for<\/span>&nbsp;line&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;content.splitlines():<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">try<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; parsed = json.loads(line)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;parsed<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">except<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">pass<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;{<span class=\"code-snippet__string\">\"normal\"<\/span>:&nbsp;<span class=\"code-snippet__literal\">True<\/span>,&nbsp;<span class=\"code-snippet__string\">\"description\"<\/span>: content[:<span class=\"code-snippet__number\">200<\/span>],&nbsp;<span class=\"code-snippet__string\">\"confidence\"<\/span>:&nbsp;<span class=\"code-snippet__number\">0.8<\/span>}<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">else<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;{<span class=\"code-snippet__string\">\"normal\"<\/span>:&nbsp;<span class=\"code-snippet__literal\">False<\/span>,&nbsp;<span class=\"code-snippet__string\">\"description\"<\/span>:&nbsp;<span class=\"code-snippet__string\">f\"API \u8c03\u7528\u5931\u8d25:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{resp.status_code}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>,&nbsp;<span class=\"code-snippet__string\">\"confidence\"<\/span>:&nbsp;<span class=\"code-snippet__number\">0.0<\/span>}<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">except<\/span>&nbsp;Exception&nbsp;<span class=\"code-snippet__keyword\">as<\/span>&nbsp;e:\\n &nbsp; &nbsp; &nbsp; &nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;{<span class=\"code-snippet__string\">\"normal\"<\/span>:&nbsp;<span class=\"code-snippet__literal\">False<\/span>,&nbsp;<span class=\"code-snippet__string\">\"description\"<\/span>:&nbsp;<span class=\"code-snippet__string\">f\"AI \u5206\u6790\u5f02\u5e38:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__built_in\">str<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">(e)}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>,&nbsp;<span class=\"code-snippet__string\">\"confidence\"<\/span>:&nbsp;<span class=\"code-snippet__number\">0.0<\/span>}<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">analyze_all_screenshots<\/span>():<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"\u5206\u6790\u6240\u6709\u622a\u56fe\uff0c\u751f\u6210\u62a5\u544a\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"\\n\"<\/span>&nbsp;+&nbsp;<span class=\"code-snippet__string\">\"=\"<\/span>*<span class=\"code-snippet__number\">60<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"\u5f00\u59cb AI \u89c6\u89c9\u5206\u6790...\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"=\"<\/span>*<span class=\"code-snippet__number\">60<\/span>)<\/span><\/code><code><span leaf=\"\"><br  \/><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; all_results = []<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">for<\/span>&nbsp;filename&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;<span class=\"code-snippet__built_in\">sorted<\/span>(os.listdir(SCREENSHOT_DIR)):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;filename.endswith(<span class=\"code-snippet__string\">\".png\"<\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; filepath = os.path.join(SCREENSHOT_DIR, filename)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u4ece\u6587\u4ef6\u540d\u89e3\u6790\u72b6\u6001\u548c\u6b65\u9aa4<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; parts = filename.replace(<span class=\"code-snippet__string\">\".png\"<\/span>,&nbsp;<span class=\"code-snippet__string\">\"\"<\/span>).split(<span class=\"code-snippet__string\">\"_\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; state = parts[<span class=\"code-snippet__number\">0<\/span>]&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;parts&nbsp;<span class=\"code-snippet__keyword\">else<\/span>&nbsp;<span class=\"code-snippet__string\">\"unknown\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; step = parts[<span class=\"code-snippet__number\">1<\/span>]&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;<span class=\"code-snippet__built_in\">len<\/span>(parts) &gt;&nbsp;<span class=\"code-snippet__number\">1<\/span>&nbsp;<span class=\"code-snippet__keyword\">else<\/span>&nbsp;<span class=\"code-snippet__string\">\"?\"<\/span><\/span><\/code><code><span leaf=\"\"><br  \/><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"\\n[\u5206\u6790]&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{filename}<\/span><\/span><span class=\"code-snippet__string\">\uff08<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{state}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;\u6001 \u7b2c&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{step}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;\u6b65\uff09...\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; result = analyze_image_via_ai(filepath, state, step)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; all_results.append({<span class=\"code-snippet__string\">\"filename\"<\/span>: filename,&nbsp;<span class=\"code-snippet__string\">\"state\"<\/span>: state,&nbsp;<span class=\"code-snippet__string\">\"step\"<\/span>: step, **result})<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; status =&nbsp;<span class=\"code-snippet__string\">\"\u2705 \u6b63\u5e38\"<\/span>&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;result.get(<span class=\"code-snippet__string\">\"normal\"<\/span>)&nbsp;<span class=\"code-snippet__keyword\">else<\/span>&nbsp;<span class=\"code-snippet__string\">\"\u26a0\ufe0f \u5f02\u5e38\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"[\u7ed3\u679c]&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{status}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;| \u7f6e\u4fe1\u5ea6:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{result.get(<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'confidence'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">,&nbsp;<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__number\">0<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">):<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__number\">.2<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">f}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"[\u63cf\u8ff0]&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{result.get(<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'description'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">,&nbsp;<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">''<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">)[:<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__number\">100<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">]}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u8f93\u51fa\u6c47\u603b\u62a5\u544a<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"\\n\"<\/span>&nbsp;+&nbsp;<span class=\"code-snippet__string\">\"=\"<\/span>*<span class=\"code-snippet__number\">60<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"\ud83d\udcca \u6298\u53e0\u5c4f\u517c\u5bb9\u6027\u6d4b\u8bd5\u62a5\u544a\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"=\"<\/span>*<span class=\"code-snippet__number\">60<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; total =&nbsp;<span class=\"code-snippet__built_in\">len<\/span>(all_results)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; abnormal =&nbsp;<span class=\"code-snippet__built_in\">sum<\/span>(<span class=\"code-snippet__number\">1<\/span>&nbsp;<span class=\"code-snippet__keyword\">for<\/span>&nbsp;r&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;all_results&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;<span class=\"code-snippet__keyword\">not<\/span>&nbsp;r.get(<span class=\"code-snippet__string\">\"normal\"<\/span>))<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"\u603b\u622a\u56fe\u6570:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{total}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"\u6b63\u5e38:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{total - abnormal}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;| \u5f02\u5e38:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{abnormal}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"\\n<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'='<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">*<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__number\">60<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">for<\/span>&nbsp;r&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;all_results:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; icon =&nbsp;<span class=\"code-snippet__string\">\"\u2705\"<\/span>&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;r.get(<span class=\"code-snippet__string\">\"normal\"<\/span>)&nbsp;<span class=\"code-snippet__keyword\">else<\/span>&nbsp;<span class=\"code-snippet__string\">\"\u26a0\ufe0f\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{icon}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;[<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{r[<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'state'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">]}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;\u6001 \u6b65\u9aa4<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{r[<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'step'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">]}<\/span><\/span><span class=\"code-snippet__string\">]&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{r[<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'filename'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">]}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;r.get(<span class=\"code-snippet__string\">\"issues\"<\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">for<\/span>&nbsp;issue&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;r[<span class=\"code-snippet__string\">\"issues\"<\/span>]:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\" &nbsp; \u95ee\u9898:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{issue}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\" &nbsp; \u63cf\u8ff0:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{r.get(<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'description'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">,&nbsp;<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">''<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">)[:<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__number\">80<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">]}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'='<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">*<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__number\">60<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u4fdd\u5b58\u62a5\u544a\u5230\u6587\u4ef6<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; report_path = os.path.join(SCREENSHOT_DIR,&nbsp;<span class=\"code-snippet__string\">\"test_report.txt\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">with<\/span>&nbsp;<span class=\"code-snippet__built_in\">open<\/span>(report_path,&nbsp;<span class=\"code-snippet__string\">\"w\"<\/span>, encoding=<span class=\"code-snippet__string\">\"utf-8\"<\/span>)&nbsp;<span class=\"code-snippet__keyword\">as<\/span>&nbsp;f:\\n &nbsp; &nbsp; &nbsp; &nbsp;f.write(<span class=\"code-snippet__string\">\"\u6298\u53e0\u5c4f\u517c\u5bb9\u6027\u6d4b\u8bd5\u62a5\u544a\\n\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; f.write(<span class=\"code-snippet__string\">f\"\u6d4b\u8bd5\u65f6\u95f4:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{time.strftime(<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'%Y-%m-%d %H:%M:%S'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">)}<\/span><\/span><span class=\"code-snippet__string\">\\n\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; f.write(<span class=\"code-snippet__string\">f\"\u6d4b\u8bd5\u5e94\u7528: \u6296\u97f3&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{DOUYIN_PACKAGE}<\/span><\/span><span class=\"code-snippet__string\">\\n\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; f.write(<span class=\"code-snippet__string\">f\"\u603b\u622a\u56fe\u6570:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{total}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;| \u6b63\u5e38:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{total-abnormal}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;| \u5f02\u5e38:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{abnormal}<\/span><\/span><span class=\"code-snippet__string\">\\n\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; f.write(<span class=\"code-snippet__string\">\"=\"<\/span>*<span class=\"code-snippet__number\">60<\/span>&nbsp;+&nbsp;<span class=\"code-snippet__string\">\"\\n\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">for<\/span>&nbsp;r&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;all_results:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; f.write(<span class=\"code-snippet__string\">f\"[<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'\u2705'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">&nbsp;<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__keyword\">if<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">&nbsp;r.get(<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'normal'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">)&nbsp;<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__keyword\">else<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">&nbsp;<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'\u26a0\ufe0f'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">}<\/span><\/span><span class=\"code-snippet__string\">]&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{r[<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'filename'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">]}<\/span><\/span><span class=\"code-snippet__string\">\\n\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; f.write(<span class=\"code-snippet__string\">f\" &nbsp;\u72b6\u6001:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{r[<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'state'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">]}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;\u6001 \u6b65\u9aa4<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{r[<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'step'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">]}<\/span><\/span><span class=\"code-snippet__string\">\\n\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; f.write(<span class=\"code-snippet__string\">f\" &nbsp;\u63cf\u8ff0:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{r.get(<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'description'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">,&nbsp;<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">''<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">)}<\/span><\/span><span class=\"code-snippet__string\">\\n\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;r.get(<span class=\"code-snippet__string\">\"issues\"<\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">for<\/span>&nbsp;issue&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;r[<span class=\"code-snippet__string\">\"issues\"<\/span>]:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; f.write(<span class=\"code-snippet__string\">f\" &nbsp;\u95ee\u9898:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{issue}<\/span><\/span><span class=\"code-snippet__string\">\\n\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; f.write(<span class=\"code-snippet__string\">\"\\n\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"\\n\u62a5\u544a\u5df2\u4fdd\u5b58:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{report_path}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;all_results<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># ============ Appium \u64cd\u4f5c\u533a\uff08\u6296\u97f3\u56db\u6b65\u64cd\u4f5c\uff09============<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">init_driver<\/span>(<span class=\"code-snippet__params\">state:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">str<\/span><\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"\u521d\u59cb\u5316 Appium Driver\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; options = UiAutomator2Options()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; options.platform_name =&nbsp;<span class=\"code-snippet__string\">\"Android\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; options.device_name = ANDROID_DEVICE_ADDR<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; options.app_package = DOUYIN_PACKAGE<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; options.app_activity = DOUYIN_ACTIVITY<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; options.no_reset =&nbsp;<span class=\"code-snippet__literal\">True<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u5f3a\u5236\u5237\u65b0\u5f53\u524d\u7a97\u53e3\u5c3a\u5bf8\uff08\u5206\u8fa8\u7387\u5207\u6362\u540e\u9700\u8981\uff09<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; options.new_command_timeout =&nbsp;<span class=\"code-snippet__number\">120<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;webdriver.Remote(APPIUM_SERVER, options=options)<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">wait_for_element<\/span>(<span class=\"code-snippet__params\">driver, by, value, timeout=<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__number\">15<\/span><\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"\u7b49\u5f85\u5143\u7d20\u51fa\u73b0\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">from<\/span>&nbsp;selenium.webdriver.support.ui&nbsp;<span class=\"code-snippet__keyword\">import<\/span>&nbsp;WebDriverWait<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">from<\/span>&nbsp;selenium.webdriver.support&nbsp;<span class=\"code-snippet__keyword\">import<\/span>&nbsp;expected_conditions&nbsp;<span class=\"code-snippet__keyword\">as<\/span>&nbsp;EC<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">try<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; el = WebDriverWait(driver, timeout).until(<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; EC.presence_of_element_located((by, value))<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;el<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">except<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;<span class=\"code-snippet__literal\">None<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">execute_douyin_steps<\/span>(<span class=\"code-snippet__params\">driver, fold_state:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">str<\/span><\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u6267\u884c\u6296\u97f3\u56db\u6b65\u64cd\u4f5c\uff1a\u6253\u5f00 \u2192 \u641c\u7d22 \u2192 \u70b9\u51fb\u641c\u7d22 \u2192 \u9000\u51fa<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u6bcf\u6b65\u622a\u56fe\uff0c\u6298\u53e0\u6001\u524d\u6267\u884c\u6298\u53e0\u63a7\u5236<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \"\"\"<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; ts =&nbsp;<span class=\"code-snippet__built_in\">int<\/span>(time.time())<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; results = []<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u6b65\u9aa4 1\uff1a\u542f\u52a8\u6296\u97f3\uff0c\u7b49\u5f85\u9996\u9875\u51fa\u73b0<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"\\n[\u6b65\u9aa4 1\/4] \u542f\u52a8\u6296\u97f3\uff08<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{fold_state}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;\u6001\uff09...\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; driver.launch_app()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; time.sleep(<span class=\"code-snippet__number\">3<\/span>) &nbsp;<span class=\"code-snippet__comment\"># \u7b49\u5f85 APP \u5b8c\u5168\u542f\u52a8<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; filepath = os.path.join(SCREENSHOT_DIR,&nbsp;<span class=\"code-snippet__string\">f\"<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{fold_state}<\/span><\/span><span class=\"code-snippet__string\">_step1_<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{ts}<\/span><\/span><span class=\"code-snippet__string\">.png\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; ok = take_screenshot(driver, filepath)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; results.append((<span class=\"code-snippet__string\">\"step1_launch\"<\/span>, filepath, ok))<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"[\u622a\u56fe]&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'\u2705'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">&nbsp;<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__keyword\">if<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">&nbsp;ok&nbsp;<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__keyword\">else<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">&nbsp;<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'\u274c'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{filepath}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u6b65\u9aa4 2\uff1a\u70b9\u51fb\u641c\u7d22\u6846\u5e76\u8f93\u5165\u6587\u5b57<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"[\u6b65\u9aa4 2\/4] \u70b9\u51fb\u641c\u7d22\u6846\u5e76\u8f93\u5165\u300cAPP\u81ea\u52a8\u5316\u6d4b\u8bd5\u300d...\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u6296\u97f3\u9996\u9875\u641c\u7d22\u6846\u901a\u5e38\u5728\u9876\u90e8\uff0c\u53ef\u4ee5\u7528 Accessibility ID \u6216 XPath \u5b9a\u4f4d<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u4ee5\u4e0b\u4e3a\u5e38\u89c1\u5b9a\u4f4d\u65b9\u5f0f\uff0c\u6839\u636e\u5b9e\u9645\u7248\u672c\u53ef\u80fd\u9700\u8981\u8c03\u6574<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; search_selectors = [<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; (AppiumBy.ID,&nbsp;<span class=\"code-snippet__string\">\"com.ss.android.ugc.aweme:id\/search_view\"<\/span>),<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; (AppiumBy.ID,&nbsp;<span class=\"code-snippet__string\">\"com.ss.android.ugc.aweme:id\/aweme_search_bar\"<\/span>),<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; (AppiumBy.XPATH,&nbsp;<span class=\"code-snippet__string\">\"\/\/*[@content-desc='\u641c\u7d22']\"<\/span>),<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; (AppiumBy.XPATH,&nbsp;<span class=\"code-snippet__string\">\"\/\/android.widget.TextView[contains(@text,'\u641c\u7d22')]\"<\/span>),<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; ]<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; search_box =&nbsp;<span class=\"code-snippet__literal\">None<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">for<\/span>&nbsp;by, val&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;search_selectors:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">try<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; search_box = wait_for_element(driver, by, val, timeout=<span class=\"code-snippet__number\">5<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;search_box:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; search_box.click()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"[INFO] \u4f7f\u7528\u5b9a\u4f4d\u5668&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{by}<\/span><\/span><span class=\"code-snippet__string\">:<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{val}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;\u627e\u5230\u641c\u7d22\u6846\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">break<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">except<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">pass<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;search_box&nbsp;<span class=\"code-snippet__keyword\">is<\/span>&nbsp;<span class=\"code-snippet__literal\">None<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"[WARN] \u672a\u627e\u5230\u641c\u7d22\u6846\uff0c\u8df3\u8fc7\u6b65\u9aa4 2\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">else<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; time.sleep(<span class=\"code-snippet__number\">1<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u8f93\u5165\u641c\u7d22\u6587\u5b57<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; search_input_selectors = [<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (AppiumBy.ID,&nbsp;<span class=\"code-snippet__string\">\"com.ss.android.ugc.aweme:id\/aweme_search_input_edit_text\"<\/span>),<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (AppiumBy.CLASS_NAME,&nbsp;<span class=\"code-snippet__string\">\"android.widget.EditText\"<\/span>),<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (AppiumBy.XPATH,&nbsp;<span class=\"code-snippet__string\">\"\/\/android.widget.EditText[@focusable='true']\"<\/span>),<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; ]<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">for<\/span>&nbsp;by, val&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;search_input_selectors:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">try<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inp = wait_for_element(driver, by, val, timeout=<span class=\"code-snippet__number\">3<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;inp:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inp.send_keys(<span class=\"code-snippet__string\">\"APP\u81ea\u52a8\u5316\u6d4b\u8bd5\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"[INFO] \u8f93\u5165\u6587\u5b57\u6210\u529f\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">break<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">except<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">pass<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; time.sleep(<span class=\"code-snippet__number\">1<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; filepath = os.path.join(SCREENSHOT_DIR,&nbsp;<span class=\"code-snippet__string\">f\"<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{fold_state}<\/span><\/span><span class=\"code-snippet__string\">_step2_input_<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{ts}<\/span><\/span><span class=\"code-snippet__string\">.png\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; ok = take_screenshot(driver, filepath)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; results.append((<span class=\"code-snippet__string\">\"step2_input\"<\/span>, filepath, ok))<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"[\u622a\u56fe]&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'\u2705'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">&nbsp;<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__keyword\">if<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">&nbsp;ok&nbsp;<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__keyword\">else<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">&nbsp;<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'\u274c'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{filepath}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u6b65\u9aa4 3\uff1a\u70b9\u51fb\u641c\u7d22\u6309\u94ae<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"[\u6b65\u9aa4 3\/4] \u70b9\u51fb\u641c\u7d22\u6309\u94ae...\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; search_btn_selectors = [<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; (AppiumBy.ID,&nbsp;<span class=\"code-snippet__string\">\"com.ss.android.ugc.aweme:id\/aweme_search_confirm_btn\"<\/span>),<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; (AppiumBy.XPATH,&nbsp;<span class=\"code-snippet__string\">\"\/\/*[@text='\u641c\u7d22' and @clickable='true']\"<\/span>),<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; (AppiumBy.XPATH,&nbsp;<span class=\"code-snippet__string\">\"\/\/android.widget.Button[contains(@text,'\u641c\u7d22')]\"<\/span>),<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; ]<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; search_btn =&nbsp;<span class=\"code-snippet__literal\">None<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">for<\/span>&nbsp;by, val&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;search_btn_selectors:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">try<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; search_btn = wait_for_element(driver, by, val, timeout=<span class=\"code-snippet__number\">3<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;search_btn:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; search_btn.click()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"[INFO] \u4f7f\u7528&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{by}<\/span><\/span><span class=\"code-snippet__string\">:<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{val}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;\u70b9\u51fb\u641c\u7d22\u6309\u94ae\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">break<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">except<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">pass<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; time.sleep(<span class=\"code-snippet__number\">2<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; filepath = os.path.join(SCREENSHOT_DIR,&nbsp;<span class=\"code-snippet__string\">f\"<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{fold_state}<\/span><\/span><span class=\"code-snippet__string\">_step3_search_<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{ts}<\/span><\/span><span class=\"code-snippet__string\">.png\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; ok = take_screenshot(driver, filepath)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; results.append((<span class=\"code-snippet__string\">\"step3_search\"<\/span>, filepath, ok))<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"[\u622a\u56fe]&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'\u2705'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">&nbsp;<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__keyword\">if<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">&nbsp;ok&nbsp;<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__keyword\">else<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">&nbsp;<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'\u274c'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{filepath}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u6b65\u9aa4 4\uff1a\u6309 Back \u952e\u9000\u51fa\u641c\u7d22\uff0c\u56de\u5230\u9996\u9875<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"[\u6b65\u9aa4 4\/4] \u6309 Back \u952e\u9000\u51fa\u641c\u7d22...\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; driver.back()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; time.sleep(<span class=\"code-snippet__number\">2<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u6700\u540e\u4e00\u6b65\u9000\u51fa APP \u540e\u622a\u56fe\uff0c\u4e0d\u7b49\u5f85\u622a\u56fe\u7279\u6548<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; filepath = os.path.join(SCREENSHOT_DIR,&nbsp;<span class=\"code-snippet__string\">f\"<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{fold_state}<\/span><\/span><span class=\"code-snippet__string\">_step4_home_<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{ts}<\/span><\/span><span class=\"code-snippet__string\">.png\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; ok = take_screenshot(driver, filepath, wait=<span class=\"code-snippet__literal\">False<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; results.append((<span class=\"code-snippet__string\">\"step4_home\"<\/span>, filepath, ok))<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"[\u622a\u56fe]&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'\u2705'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">&nbsp;<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__keyword\">if<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">&nbsp;ok&nbsp;<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__keyword\">else<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">&nbsp;<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'\u274c'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{filepath}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u9000\u51fa APP<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; driver.terminate_app(DOUYIN_PACKAGE)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"[INFO] APP \u5df2\u9000\u51fa\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;results<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># ============ \u4e3b\u6d41\u7a0b =============<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">main<\/span>():<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"=\"<\/span>*<span class=\"code-snippet__number\">60<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"Android \u6298\u53e0\u5c4f\u517c\u5bb9\u6027\u6d4b\u8bd5\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"\u6d4b\u8bd5\u5e94\u7528: \u6296\u97f3&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{DOUYIN_PACKAGE}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"\u622a\u56fe\u76ee\u5f55:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{SCREENSHOT_DIR}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"=\"<\/span>*<span class=\"code-snippet__number\">60<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u7b2c\u4e00\u8f6e\uff1a\u5c55\u5f00\u6001<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"\\n========== \u7b2c\u4e00\u8f6e\uff1a\u5c55\u5f00\u6001\u6d4b\u8bd5 ==========\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; set_fold_state(<span class=\"code-snippet__string\">\"unfolded\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; time.sleep(<span class=\"code-snippet__number\">2<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; driver = init_driver(<span class=\"code-snippet__string\">\"unfolded\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">try<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; execute_douyin_steps(driver,&nbsp;<span class=\"code-snippet__string\">\"unfold\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">finally<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; driver.quit()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u7b2c\u4e8c\u8f6e\uff1a\u6298\u53e0\u6001<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"\\n========== \u7b2c\u4e8c\u8f6e\uff1a\u6298\u53e0\u6001\u6d4b\u8bd5 ==========\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; set_fold_state(<span class=\"code-snippet__string\">\"folded\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; time.sleep(<span class=\"code-snippet__number\">3<\/span>) &nbsp;<span class=\"code-snippet__comment\"># \u7b49\u5f85\u6298\u53e0\u5b8c\u6210 + \u7cfb\u7edf\u56de\u8c03<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; driver = init_driver(<span class=\"code-snippet__string\">\"folded\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">try<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; execute_douyin_steps(driver,&nbsp;<span class=\"code-snippet__string\">\"fold\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">finally<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; driver.quit()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u6062\u590d\u5c55\u5f00\u6001<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"\\n========== \u6062\u590d\u8bbe\u5907\u5230\u5c55\u5f00\u6001 ==========\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; set_fold_state(<span class=\"code-snippet__string\">\"unfolded\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># AI \u89c6\u89c9\u5206\u6790<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; analyze_all_screenshots()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"\\n[\u5b8c\u6210] \u5168\u90e8\u6d4b\u8bd5\u5df2\u5b8c\u6210\uff0c\u62a5\u544a\u89c1\u4e0a\u65b9\u8f93\u51fa\u3002\"<\/span>)<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">if<\/span>&nbsp;__name__ ==&nbsp;<span class=\"code-snippet__string\">\"__main__\"<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; main()<\/span><\/code><\/pre>\n<\/section>\n<section style=\"text-align: center;\" nodeleaf=\"\">\n<figure class=\"wx-qr-wrap\"><img decoding=\"async\" class=\"rich_pages wxw-img\" data-aistatus=\"1\" data-imgfileid=\"100000577\" data-s=\"300,640\" data-type=\"png\" type=\"block\" src=\"https:\/\/mmbiz.qpic.cn\/sz_mmbiz_png\/BWmfcibGhS1KRibOMZLaWJmPCXTdWHZPjboIURo5muK7h7av8I3yPDh4zo0EUSLGgJbTzUbPicqicHupY5n4cvJjITvHD8QKY0nYWV3OlrmLpqA\/640?wx_fmt=png&#038;from=appmsg\" \/><figcaption class=\"wx-qr-tip\"><img decoding=\"async\" src=\"https:\/\/www.deartester.com\/wp-content\/uploads\/2026\/09\/wechat-qr.jpg\" alt=\"\u5fae\u4fe1\u516c\u4f17\u53f7\u4e8c\u7ef4\u7801\" loading=\"lazy\"><span>\u56fe\u7247\u5f15\u81ea\u5fae\u4fe1\u516c\u4f17\u53f7\uff0c\u626b\u7801\u5173\u6ce8\u9605\u8bfb\u539f\u6587<\/span><\/figcaption><\/figure>\n<\/section>\n<h2 style=\"text-align: center;\" data-pm-slice=\"0 0 []\"><span leaf=\"\" style=\"color: rgb(100, 116, 139);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: 13.12px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\">Appium \u6296\u97f3\u64cd\u4f5c + \u622a\u56fe\u6d41\u7a0b<\/span><\/h2>\n<h3 style=\"box-sizing: border-box;margin: 24px 0px 12px;padding: 0px;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\" style=\"box-sizing: border-box;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span textstyle=\"\" style=\"font-size: 16px;color: #7a4fd6;\">4.3 \u8fd0\u884c\u6b65\u9aa4\u8bf4\u660e<\/span><\/span><\/h3>\n<p style=\"box-sizing: border-box;margin: 0px 0px 14px;padding: 0px;line-height: 1.9;color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: medium;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u4fdd\u5b58\u811a\u672c\u540e\uff0c\u6309\u4ee5\u4e0b\u6b65\u9aa4\u8fd0\u884c\uff1a<\/span><\/p>\n<ol style=\"box-sizing: border-box;margin: 16px 0px;padding: 0px;counter-reset: step 0;list-style: none;color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: medium;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" class=\"list-paddingleft-1\">\n<li style=\" box-sizing: border-box;margin: 0px 0px 10px;padding: 12px 14px 12px 52px;line-height: 1.8;counter-increment: step 1; border: 1px solid rgb(229, 231, 235);border-radius: 8px;background: rgb(250, 250, 250); \"><strong style=\"box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(15, 23, 42);font-weight: 700;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: #0052ff;\">\u542f\u52a8 Appium Server<\/span><\/span><\/strong><br \/>\n<section><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;\">\uff1a\u547d\u4ee4\u884c\u6267\u884c&nbsp;<\/span><\/span><code style=\"box-sizing: border-box;margin: 0px;padding: 1px 6px;background: rgb(241, 245, 249);border: 1px solid rgb(226, 232, 240);border-radius: 4px;font-size: 0.88em;color: rgb(99, 102, 241);font-family: &quot;Cascadia Code&quot;, &quot;Fira Code&quot;, monospace;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;\">appium<\/span><\/span><\/code><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;\">\uff08\u6216 Appium Desktop \u542f\u52a8\u670d\u52a1\uff09<\/span><\/span><\/section>\n<\/li>\n<li style=\" box-sizing: border-box;margin: 0px 0px 10px;padding: 12px 14px 12px 52px;line-height: 1.8;counter-increment: step 1; border: 1px solid rgb(229, 231, 235);border-radius: 8px;background: rgb(250, 250, 250); \"><strong style=\"box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(15, 23, 42);font-weight: 700;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: #0052ff;\">\u8fde\u63a5\u8bbe\u5907<\/span><\/span><\/strong><br \/>\n<section><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;\">\uff1a\u786e\u4fdd\u6298\u53e0\u5c4f\u624b\u673a\u5df2\u901a\u8fc7 USB \u8fde\u63a5\u7535\u8111\uff0cUSB \u8c03\u8bd5\u5df2\u5f00\u542f\uff0c\u6267\u884c&nbsp;<\/span><\/span><code style=\"box-sizing: border-box;margin: 0px;padding: 1px 6px;background: rgb(241, 245, 249);border: 1px solid rgb(226, 232, 240);border-radius: 4px;font-size: 0.88em;color: rgb(99, 102, 241);font-family: &quot;Cascadia Code&quot;, &quot;Fira Code&quot;, monospace;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;\">adb devices<\/span><\/span><\/code><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;\">&nbsp;\u786e\u8ba4\u8bbe\u5907\u5728\u7ebf<\/span><\/span><\/section>\n<\/li>\n<li style=\" box-sizing: border-box;margin: 0px 0px 10px;padding: 12px 14px 12px 52px;line-height: 1.8;counter-increment: step 1; border: 1px solid rgb(229, 231, 235);border-radius: 8px;background: rgb(250, 250, 250); \"><strong style=\"box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(15, 23, 42);font-weight: 700;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: #0052ff;\">\u4fee\u6539\u914d\u7f6e\u533a<\/span><\/span><\/strong><br \/>\n<section><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;\">\uff1a\u5c06&nbsp;<\/span><\/span><code style=\"box-sizing: border-box;margin: 0px;padding: 1px 6px;background: rgb(241, 245, 249);border: 1px solid rgb(226, 232, 240);border-radius: 4px;font-size: 0.88em;color: rgb(99, 102, 241);font-family: &quot;Cascadia Code&quot;, &quot;Fira Code&quot;, monospace;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;\">ANDROID_DEVICE_ADDR<\/span><\/span><\/code><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;\">&nbsp;\u6539\u4e3a\u4f60\u7684\u8bbe\u5907\u5730\u5740\uff0c<\/span><\/span><code style=\"box-sizing: border-box;margin: 0px;padding: 1px 6px;background: rgb(241, 245, 249);border: 1px solid rgb(226, 232, 240);border-radius: 4px;font-size: 0.88em;color: rgb(99, 102, 241);font-family: &quot;Cascadia Code&quot;, &quot;Fira Code&quot;, monospace;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;\">ORIGINAL_RESOLUTION<\/span><\/span><\/code><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;\">&nbsp;\u548c&nbsp;<\/span><\/span><code style=\"box-sizing: border-box;margin: 0px;padding: 1px 6px;background: rgb(241, 245, 249);border: 1px solid rgb(226, 232, 240);border-radius: 4px;font-size: 0.88em;color: rgb(99, 102, 241);font-family: &quot;Cascadia Code&quot;, &quot;Fira Code&quot;, monospace;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;\">FOLDED_RESOLUTION<\/span><\/span><\/code><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;\">&nbsp;\u6539\u4e3a\u4f60\u7684\u8bbe\u5907\u5b9e\u9645\u5206\u8fa8\u7387\uff08\u6267\u884c&nbsp;<\/span><\/span><code style=\"box-sizing: border-box;margin: 0px;padding: 1px 6px;background: rgb(241, 245, 249);border: 1px solid rgb(226, 232, 240);border-radius: 4px;font-size: 0.88em;color: rgb(99, 102, 241);font-family: &quot;Cascadia Code&quot;, &quot;Fira Code&quot;, monospace;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;\">adb shell wm size<\/span><\/span><\/code><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;\">&nbsp;\u67e5\u5230\uff09<\/span><\/span><\/section>\n<\/li>\n<li style=\" box-sizing: border-box;margin: 0px 0px 10px;padding: 12px 14px 12px 52px;line-height: 1.8;counter-increment: step 1; border: 1px solid rgb(229, 231, 235);border-radius: 8px;background: rgb(250, 250, 250); \"><strong style=\"box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(15, 23, 42);font-weight: 700;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: #0052ff;\">\u8fd0\u884c\u811a\u672c<\/span><\/span><\/strong><br \/>\n<section><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;\">\uff1a<\/span><\/span><code style=\"box-sizing: border-box;margin: 0px;padding: 1px 6px;background: rgb(241, 245, 249);border: 1px solid rgb(226, 232, 240);border-radius: 4px;font-size: 0.88em;color: rgb(99, 102, 241);font-family: &quot;Cascadia Code&quot;, &quot;Fira Code&quot;, monospace;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;\">python foldable_test_android.py<\/span><\/span><\/code><\/section>\n<\/li>\n<li style=\" box-sizing: border-box;margin: 0px 0px 10px;padding: 12px 14px 12px 52px;line-height: 1.8;counter-increment: step 1; border: 1px solid rgb(229, 231, 235);border-radius: 8px;background: rgb(250, 250, 250); \"><strong style=\"box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(15, 23, 42);font-weight: 700;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: #0052ff;\">\u67e5\u770b\u7ed3\u679c<\/span><\/span><\/strong><br \/>\n<section><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;\">\uff1a\u811a\u672c\u6267\u884c\u5b8c\u6bd5\u540e\uff0c\u81ea\u52a8\u5f39\u51fa AI \u5206\u6790\u62a5\u544a\uff1b\u622a\u56fe\u4fdd\u5b58\u5728\u914d\u7f6e\u533a\u6307\u5b9a\u7684\u76ee\u5f55\u4e2d<\/span><\/span><\/section>\n<\/li>\n<\/ol>\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"576\">\n<p data-pm-slice=\"3 2 []\" style=\"text-align: center;\"><strong style=\"box-sizing: border-box;margin: 0px 0px 4px;padding: 0px;color: rgb(15, 23, 42);font-weight: 700;display: block;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: #ff2941;\">\u5b9a\u4f4d\u5668\u5931\u6548\u600e\u4e48\u529e<\/span><\/span><\/strong><\/p>\n<p style=\"text-indent: 2em;\"><strong><span leaf=\"\" style=\"color: rgba(0, 0, 0, 0.9);font-size: 17px;font-family: mp-quote, &quot;PingFang SC&quot;, system-ui, -apple-system, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei UI&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;line-height: 1.6;letter-spacing: 0.034em;font-style: normal;font-weight: normal;\"><span textstyle=\"\" style=\"font-size: 15px;\">\u6296\u97f3\u7248\u672c\u66f4\u65b0\u540e\uff0c\u5143\u7d20\u5b9a\u4f4d\u5668\uff08ID\u3001XPath\uff09\u53ef\u80fd\u53d8\u5316\u3002\u9047\u5230&#8221;\u672a\u627e\u5230\u5143\u7d20&#8221;\u65f6\uff0c\u7528 Appium Inspector \u91cd\u65b0\u6293\u53d6\u5f53\u524d\u7248\u672c\u7684\u5143\u7d20\u4fe1\u606f\uff1a\u542f\u52a8 Appium Desktop \u2192 \u70b9\u51fb Start Inspector Session \u2192 \u586b\u5199 desired_caps \u2192 \u586b\u5165\u6296\u97f3\u7684\u5305\u540d\u548c Activity \u2192 \u70b9\u51fb Start Session\u3002\u6293\u53d6\u540e\u7528\u65b0\u7684 ID \u66ff\u6362\u811a\u672c\u4e2d\u7684&nbsp;<\/span><\/span><\/strong><code><span leaf=\"\" style=\"color: rgba(0, 0, 0, 0.9);font-size: 17px;font-family: mp-quote, &quot;PingFang SC&quot;, system-ui, -apple-system, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei UI&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;line-height: 1.6;letter-spacing: 0.034em;font-style: normal;font-weight: normal;\"><span textstyle=\"\" style=\"font-size: 15px;background-color: #d7aba9;color: #0052ff;\">search_selectors<\/span><\/span><\/code><span leaf=\"\" style=\"color: rgba(0, 0, 0, 0.9);font-size: 17px;font-family: mp-quote, &quot;PingFang SC&quot;, system-ui, -apple-system, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei UI&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;line-height: 1.6;letter-spacing: 0.034em;font-style: normal;font-weight: normal;\"><span textstyle=\"\" style=\"font-size: 15px;\">&nbsp;\u5217\u8868\u5373\u53ef\u3002<\/span><\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong style=\"box-sizing: border-box;margin: 0px 0px 4px;padding: 0px;color: rgb(15, 23, 42);font-weight: 700;display: block;\"><span leaf=\"\"><br  \/><\/span><\/strong><\/p>\n<hr style=\"border-style: solid;border-width: 1px 0 0;border-color: rgba(0,0,0,0.1);-webkit-transform-origin: 0 0;-webkit-transform: scale(1, 0.5);transform-origin: 0 0;transform: scale(1, 0.5);\"  \/>\n<section><span data-pm-slice=\"0 0 []\"><span leaf=\"\" style=\"box-sizing: border-box;margin: 0px;padding: 3px 10px;font-size: 0.75rem;background: rgba(255, 255, 255, 0.25);border-radius: 99px;letter-spacing: 1px;font-weight: 700;\"><br  \/><\/span><\/span><\/section>\n<section><span data-pm-slice=\"0 0 []\"><span leaf=\"\" style=\"box-sizing: border-box;margin: 0px;padding: 3px 10px;font-size: 0.75rem;background: rgba(255, 255, 255, 0.25);border-radius: 99px;letter-spacing: 1px;font-weight: 700;\"><span textstyle=\"\" style=\"font-size: 18px;color: #d6a841;font-weight: bold;\">\u7b2c\u4e94\u7ae0&nbsp;<\/span><span textstyle=\"\" style=\"font-size: 17px;color: #0052ff;font-weight: bold;\">HarmonyOS\u7248\u672c\uff1aHDC + Appium\u9002\u914d\u8981\u70b9<\/span><\/span><\/span><\/section>\n<p style=\"box-sizing: border-box;margin: 0px 0px 14px;padding: 0px;line-height: 1.9;color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: medium;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\">HarmonyOS \u7248\u811a\u672c\u7684\u6574\u4f53\u7ed3\u6784\u4e0e Android \u7248\u4e00\u81f4\uff0c\u4e3b\u8981\u5dee\u5f02\u5728\u4e8e\u4e09\u4e2a\u65b9\u9762\uff1a<\/span><strong style=\"box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(15, 23, 42);font-weight: 700;\"><span leaf=\"\">\u6298\u53e0\u63a7\u5236\u547d\u4ee4<\/span><\/strong><span leaf=\"\">\uff08HDC vs ADB\uff09\u3001<\/span><strong style=\"box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(15, 23, 42);font-weight: 700;\"><span leaf=\"\">\u8bbe\u5907\u8fde\u63a5\u65b9\u5f0f<\/span><\/strong><span leaf=\"\">\uff08HDC \u7aef\u53e3 vs ADB \u5730\u5740\uff09\u3001<\/span><strong style=\"box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(15, 23, 42);font-weight: 700;\"><span leaf=\"\">APP \u542f\u52a8\u65b9\u5f0f<\/span><\/strong><span leaf=\"\">\uff08bundle name vs package name\uff09\u3002\u672c\u8282\u91cd\u70b9\u8bb2\u89e3\u8fd9\u4e9b\u5dee\u5f02\u70b9\uff0c\u5e76\u7ed9\u51fa\u5b8c\u6574\u811a\u672c\u3002<\/span><\/p>\n<h3 style=\"box-sizing: border-box;margin: 24px 0px 12px;padding: 0px;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\" style=\"box-sizing: border-box;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span textstyle=\"\" style=\"font-size: 16px;color: #7a4fd6;\">5<\/span><\/span><span leaf=\"\" style=\"box-sizing: border-box;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span textstyle=\"\" style=\"font-size: 16px;color: #7a4fd6;\">.1 \u4e09\u5927\u5dee<\/span><\/span><span leaf=\"\" style=\"box-sizing: border-box;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span textstyle=\"\" style=\"font-size: 16px;color: #7a4fd6;\">\u5f02\u70b9\u8be6\u89e3<\/span><\/span><\/h3>\n<section style=\"text-align: center;\" nodeleaf=\"\">\n<figure class=\"wx-qr-wrap\"><img decoding=\"async\" class=\"rich_pages wxw-img\" data-aistatus=\"1\" data-imgfileid=\"100000578\" data-s=\"300,640\" data-type=\"png\" type=\"block\" src=\"https:\/\/mmbiz.qpic.cn\/sz_mmbiz_png\/BWmfcibGhS1KQ1ho5Zj8Tl9dMibsDxARr5xxUDTASyBvr2HRtlOiakP2ibsiaJ3wW6cv8dGQY7wK2uZuAAFd9MYEbbAuxAOLuyDUs5v9mg8CkfFo\/640?wx_fmt=png&#038;from=appmsg\" \/><figcaption class=\"wx-qr-tip\"><img decoding=\"async\" src=\"https:\/\/www.deartester.com\/wp-content\/uploads\/2026\/09\/wechat-qr.jpg\" alt=\"\u5fae\u4fe1\u516c\u4f17\u53f7\u4e8c\u7ef4\u7801\" loading=\"lazy\"><span>\u56fe\u7247\u5f15\u81ea\u5fae\u4fe1\u516c\u4f17\u53f7\uff0c\u626b\u7801\u5173\u6ce8\u9605\u8bfb\u539f\u6587<\/span><\/figcaption><\/figure>\n<\/section>\n<p style=\"text-align: center;\"><strong style=\"box-sizing: border-box;margin: 0px 0px 4px;padding: 0px;color: rgb(15, 23, 42);font-weight: 700;display: block;\"><span style=\"color: rgb(100, 116, 139);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: 13.12px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\" data-pm-slice=\"0 0 []\"><span leaf=\"\">Android \u4e0e HarmonyOS \u6298\u53e0\u5c4f\u6d4b\u8bd5\u7684\u4e09\u5927\u5dee\u5f02\u70b9\u3002\u6838\u5fc3\u5dee\u5f02\u5728\u6298\u53e0\u63a7\u5236\u547d\u4ee4\u548c\u8bbe\u5907\u8fde\u63a5\u65b9\u5f0f<\/span><\/span><\/strong><\/p>\n<h3 style=\"box-sizing: border-box;margin: 24px 0px 12px;padding: 0px;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\" style=\"box-sizing: border-box;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span textstyle=\"\" style=\"font-size: 16px;color: #7a4fd6;\">5.2 \u5b8c\u6574 Python \u811a\u672c\uff08HarmonyOS \u7248\uff09<\/span><\/span><\/h3>\n<p><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;background-color: #00d5ff;color: #ffffff;font-weight: bold;\">foldable_test_harmony.py \u2014 HarmonyOS \u6296\u97f3\u6298\u53e0\u5c4f\u6d4b\u8bd5\u811a\u672c<\/span><\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"python\"><code><span leaf=\"\"><span class=\"code-snippet__comment\">#!\/usr\/bin\/env python3<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># -*- coding: utf-8 -*-<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__string\">\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">HarmonyOS \u6298\u53e0\u5c4f\u517c\u5bb9\u6027\u6d4b\u8bd5\u811a\u672c<\/span><\/code><code><span leaf=\"\">\u6d4b\u8bd5 APP\uff1a\u6296\u97f3<\/span><\/code><code><span leaf=\"\">\u6d4b\u8bd5\u6d41\u7a0b\uff1a\u5c55\u5f00\u6001 4 \u6b65 \u2192 \u6298\u53e0\u6001 4 \u6b65 \u2192 AI \u89c6\u89c9\u5206\u6790<\/span><\/code><code><span leaf=\"\">\u4f9d\u8d56\u5b89\u88c5\uff1apip install appium-python-client requests<\/span><\/code><code><span leaf=\"\">\u8fd0\u884c\u65b9\u5f0f\uff1apython foldable_test_harmony.py<\/span><\/code><code><span leaf=\"\">\u6ce8\u610f\uff1aHarmonyOS \u7248\u9700\u8981\u63d0\u524d\u914d\u7f6e HDC \u73af\u5883\u53d8\u91cf\uff0c<\/span><\/code><code><span leaf=\"\">\u6216\u4fee\u6539 HDC_PATH \u6307\u5411 hdc.exe \u7684\u5b9e\u9645\u8def\u5f84<\/span><\/code><code><span leaf=\"\">\"\"\"<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;os<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;time<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;subprocess<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;re<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;requests<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">from<\/span>&nbsp;appium&nbsp;<span class=\"code-snippet__keyword\">import<\/span>&nbsp;webdriver<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">from<\/span>&nbsp;appium.options.android&nbsp;<span class=\"code-snippet__keyword\">import<\/span>&nbsp;UiAutomator2Options<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">from<\/span>&nbsp;appium.webdriver.common.appiumby&nbsp;<span class=\"code-snippet__keyword\">import<\/span>&nbsp;AppiumBy<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># ============ \u914d\u7f6e\u533a\uff08\u6839\u636e\u4f60\u7684\u73af\u5883\u4fee\u6539\uff09============<\/span><\/span><\/code><code><span leaf=\"\">APPIUM_SERVER =&nbsp;<span class=\"code-snippet__string\">\"http:\/\/127.0.0.1:4723\"<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># HDC \u914d\u7f6e<\/span><\/span><\/code><code><span leaf=\"\">HDC_PATH =&nbsp;<span class=\"code-snippet__string\">r\"D:\\Huawei\\DevEco Studio\\sdk\\default\\openharmony\\toolchains\\hdc.exe\"<\/span><\/span><\/code><code><span leaf=\"\">HARMONY_DEVICE_ID =&nbsp;<span class=\"code-snippet__string\">\"\"<\/span>&nbsp; &nbsp;<span class=\"code-snippet__comment\"># \u7559\u7a7a=\u5355\u8bbe\u5907\u81ea\u52a8\u5339\u914d\uff1b\u591a\u8bbe\u5907\u586b hdc list targets \u8fd4\u56de\u7684 ID<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># \u6296\u97f3 APP \u4fe1\u606f\uff08HarmonyOS \u7248\u5305\u540d\u53ef\u80fd\u4e0e Android \u4e0d\u540c\uff09<\/span><\/span><\/code><code><span leaf=\"\">DOUYIN_BUNDLE_NAME =&nbsp;<span class=\"code-snippet__string\">\"com.ss.android.ugc.aweme\"<\/span><\/span><\/code><code><span leaf=\"\">DOUYIN_ABILITY_NAME =&nbsp;<span class=\"code-snippet__string\">\"EntryAbility\"<\/span>&nbsp; &nbsp;<span class=\"code-snippet__comment\"># \u9e3f\u8499 Ability \u5165\u53e3\u540d\u79f0<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># \u622a\u56fe\u4fdd\u5b58\u76ee\u5f55<\/span><\/span><\/code><code><span leaf=\"\">SCREENSHOT_DIR =&nbsp;<span class=\"code-snippet__string\">r\"C:\\Users\\51362\\Desktop\\\u6587\u7ae0\\foldable_test_screenshots\"<\/span><\/span><\/code><code><span leaf=\"\">os.makedirs(SCREENSHOT_DIR, exist_ok=<span class=\"code-snippet__literal\">True<\/span>)<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># AI \u89c6\u89c9\u5206\u6790\u914d\u7f6e<\/span><\/span><\/code><code><span leaf=\"\">AI_VISION_API_URL =&nbsp;<span class=\"code-snippet__string\">\"https:\/\/dashscope.aliyuncs.com\/api\/v1\/services\/vision\/vision\/describe\"<\/span><\/span><\/code><code><span leaf=\"\">AI_API_KEY =&nbsp;<span class=\"code-snippet__string\">\"your-api-key-here\"<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># ==================================================<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># ============ HDC \u6298\u53e0\u63a7\u5236\u533a =============<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">run_hdc<\/span>(<span class=\"code-snippet__params\">command:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">str<\/span><\/span>) -&gt;&nbsp;<span class=\"code-snippet__built_in\">str<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; hdc = HDC_PATH<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;HARMONY_DEVICE_ID:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; full =&nbsp;<span class=\"code-snippet__string\">f'\"<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{hdc}<\/span><\/span><span class=\"code-snippet__string\">\" -t&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{HARMONY_DEVICE_ID}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{command}<\/span><\/span><span class=\"code-snippet__string\">'<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">else<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; full =&nbsp;<span class=\"code-snippet__string\">f'\"<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{hdc}<\/span><\/span><span class=\"code-snippet__string\">\"&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{command}<\/span><\/span><span class=\"code-snippet__string\">'<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; result = subprocess.run(full, shell=<span class=\"code-snippet__literal\">True<\/span>, capture_output=<span class=\"code-snippet__literal\">True<\/span>, text=<span class=\"code-snippet__literal\">True<\/span>, timeout=<span class=\"code-snippet__number\">30<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;result.stdout.strip()<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">get_fold_status<\/span>() -&gt;&nbsp;<span class=\"code-snippet__built_in\">str<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; output = run_hdc(<span class=\"code-snippet__string\">\"shell hidumper -s 62 -a '-a'\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">for<\/span>&nbsp;line&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;output.splitlines():<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;<span class=\"code-snippet__string\">\"FoldStatus\"<\/span>&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;line&nbsp;<span class=\"code-snippet__keyword\">or<\/span>&nbsp;<span class=\"code-snippet__string\">\"foldStatus\"<\/span>&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;line:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;line.strip()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;<span class=\"code-snippet__string\">f\"unknown (raw:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{output[:<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__number\">200<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">]}<\/span><\/span><span class=\"code-snippet__string\">)\"<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">set_fold_state<\/span>(<span class=\"code-snippet__params\">state:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">str<\/span><\/span>) -&gt;&nbsp;<span class=\"code-snippet__built_in\">bool<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"\u901a\u8fc7 HDC \u63a7\u5236 HarmonyOS \u6298\u53e0\u72b6\u6001\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; mode_map = {<span class=\"code-snippet__string\">\"folded\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"1\"<\/span>,&nbsp;<span class=\"code-snippet__string\">\"unfolded\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"0\"<\/span>,&nbsp;<span class=\"code-snippet__string\">\"half_folded\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"2\"<\/span>}<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; name_map = {<span class=\"code-snippet__string\">\"folded\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"\u6298\u53e0\u6001\"<\/span>,&nbsp;<span class=\"code-snippet__string\">\"unfolded\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"\u5c55\u5f00\u6001\"<\/span>,&nbsp;<span class=\"code-snippet__string\">\"half_folded\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"\u60ac\u505c\u6001\"<\/span>}<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;state&nbsp;<span class=\"code-snippet__keyword\">not<\/span>&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;mode_map:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;<span class=\"code-snippet__literal\">False<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"[INFO] \u5207\u6362\u5230&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{name_map[state]}<\/span><\/span><span class=\"code-snippet__string\">\uff08mode=<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{mode_map[state]}<\/span><\/span><span class=\"code-snippet__string\">\uff09...\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"[INFO] \u5f53\u524d\u72b6\u6001:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{get_fold_status()}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; result = run_hdc(<span class=\"code-snippet__string\">f\"shell bm setDisplayMode --mode&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{mode_map[state]}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"[DEBUG] HDC:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{result}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; time.sleep(<span class=\"code-snippet__number\">3<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"[INFO] \u5207\u6362\u540e\u72b6\u6001:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{get_fold_status()}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;<span class=\"code-snippet__literal\">True<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># ============ \u622a\u56fe\u7b49\u5f85 + AI \u5206\u6790\u533a\uff08\u4e0e Android \u7248\u76f8\u540c\uff09============<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">wait_screenshot_ready<\/span>(<span class=\"code-snippet__params\">path:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">str<\/span><\/span><span class=\"code-snippet__params\">, timeout:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">float<\/span><\/span><span class=\"code-snippet__params\">&nbsp;=&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__number\">5.0<\/span><\/span>) -&gt;&nbsp;<span class=\"code-snippet__built_in\">bool<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;<span class=\"code-snippet__keyword\">not<\/span>&nbsp;os.path.exists(path):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;<span class=\"code-snippet__literal\">False<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; start = time.time()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; last = -<span class=\"code-snippet__number\">1<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; stable =&nbsp;<span class=\"code-snippet__number\">0<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">while<\/span>&nbsp;time.time() - start &lt; timeout:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; time.sleep(<span class=\"code-snippet__number\">0.3<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">try<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; s = os.path.getsize(path)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;s == last&nbsp;<span class=\"code-snippet__keyword\">and<\/span>&nbsp;s &gt;&nbsp;<span class=\"code-snippet__number\">0<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stable +=&nbsp;<span class=\"code-snippet__number\">1<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;stable &gt;=&nbsp;<span class=\"code-snippet__number\">2<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;<span class=\"code-snippet__literal\">True<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">else<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stable =&nbsp;<span class=\"code-snippet__number\">0<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; last = s<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">except<\/span>&nbsp;OSError:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">pass<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;<span class=\"code-snippet__literal\">False<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">take_screenshot<\/span>(<span class=\"code-snippet__params\">driver, filepath:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">str<\/span><\/span><span class=\"code-snippet__params\">, wait:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">bool<\/span><\/span><span class=\"code-snippet__params\">&nbsp;=&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__literal\">True<\/span><\/span>) -&gt;&nbsp;<span class=\"code-snippet__built_in\">bool<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">try<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; driver.save_screenshot(filepath)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">except<\/span>&nbsp;Exception&nbsp;<span class=\"code-snippet__keyword\">as<\/span>&nbsp;e:\\n &nbsp; &nbsp; &nbsp; &nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"[ERROR] \u622a\u56fe\u5931\u8d25:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{e}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;<span class=\"code-snippet__literal\">False<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;wait:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;wait_screenshot_ready(filepath)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;<span class=\"code-snippet__literal\">True<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">analyze_image_via_ai<\/span>(<span class=\"code-snippet__params\">image_path:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">str<\/span><\/span><span class=\"code-snippet__params\">, state:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">str<\/span><\/span><span class=\"code-snippet__params\">, step:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">str<\/span><\/span>) -&gt;&nbsp;<span class=\"code-snippet__built_in\">dict<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"\u8c03\u7528 AI \u89c6\u89c9\u5206\u6790\uff08\u4e0e Android \u7248\u76f8\u540c\uff0c\u8be6\u89c1\u7b2c\u516d\u7ae0\uff09\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u6b64\u5904\u7701\u7565\u5b9e\u73b0\uff0c\u4e0e foldable_test_android.py \u4e2d\u7684 analyze_image_via_ai \u5b8c\u5168\u76f8\u540c<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u5b8c\u6574\u5b9e\u73b0\u8bf7\u53c2\u8003\u7b2c\u516d\u7ae0 AI \u89c6\u89c9\u5206\u6790\u4ee3\u7801<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;{<span class=\"code-snippet__string\">\"normal\"<\/span>:&nbsp;<span class=\"code-snippet__literal\">True<\/span>,&nbsp;<span class=\"code-snippet__string\">\"description\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"AI \u5206\u6790\u4e2d...\"<\/span>,&nbsp;<span class=\"code-snippet__string\">\"confidence\"<\/span>:&nbsp;<span class=\"code-snippet__number\">0.5<\/span>,&nbsp;<span class=\"code-snippet__string\">\"issues\"<\/span>: []}<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">analyze_all_screenshots<\/span>():<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"\\n\"<\/span>&nbsp;+&nbsp;<span class=\"code-snippet__string\">\"=\"<\/span>*<span class=\"code-snippet__number\">60<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"\u5f00\u59cb AI \u89c6\u89c9\u5206\u6790...\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"=\"<\/span>*<span class=\"code-snippet__number\">60<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; all_results = []<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">for<\/span>&nbsp;filename&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;<span class=\"code-snippet__built_in\">sorted<\/span>(os.listdir(SCREENSHOT_DIR)):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;filename.endswith(<span class=\"code-snippet__string\">\".png\"<\/span>)&nbsp;<span class=\"code-snippet__keyword\">and<\/span>&nbsp;filename.startswith(<span class=\"code-snippet__string\">\"harmony\"<\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; filepath = os.path.join(SCREENSHOT_DIR, filename)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; parts = filename.replace(<span class=\"code-snippet__string\">\".png\"<\/span>,&nbsp;<span class=\"code-snippet__string\">\"\"<\/span>).split(<span class=\"code-snippet__string\">\"_\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; state = parts[<span class=\"code-snippet__number\">1<\/span>]&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;<span class=\"code-snippet__built_in\">len<\/span>(parts) &gt;&nbsp;<span class=\"code-snippet__number\">1<\/span>&nbsp;<span class=\"code-snippet__keyword\">else<\/span>&nbsp;<span class=\"code-snippet__string\">\"?\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; step = parts[<span class=\"code-snippet__number\">2<\/span>]&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;<span class=\"code-snippet__built_in\">len<\/span>(parts) &gt;&nbsp;<span class=\"code-snippet__number\">2<\/span>&nbsp;<span class=\"code-snippet__keyword\">else<\/span>&nbsp;<span class=\"code-snippet__string\">\"?\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"\\n[\u5206\u6790]&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{filename}<\/span><\/span><span class=\"code-snippet__string\">...\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; result = analyze_image_via_ai(filepath, state, step)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; all_results.append({<span class=\"code-snippet__string\">\"filename\"<\/span>: filename,&nbsp;<span class=\"code-snippet__string\">\"state\"<\/span>: state,&nbsp;<span class=\"code-snippet__string\">\"step\"<\/span>: step, **result})<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"[\u7ed3\u679c]&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'\u2705 \u6b63\u5e38'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">&nbsp;<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__keyword\">if<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">&nbsp;result.get(<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'normal'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">)&nbsp;<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__keyword\">else<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">&nbsp;<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'\u26a0\ufe0f \u5f02\u5e38'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;|&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{result.get(<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'description'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">,<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">''<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">)[:<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__number\">80<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">]}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"\\n\"<\/span>&nbsp;+&nbsp;<span class=\"code-snippet__string\">\"=\"<\/span>*<span class=\"code-snippet__number\">60<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"\ud83d\udcca \u6d4b\u8bd5\u62a5\u544a\u6c47\u603b\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"=\"<\/span>*<span class=\"code-snippet__number\">60<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; total =&nbsp;<span class=\"code-snippet__built_in\">len<\/span>(all_results)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; abnormal =&nbsp;<span class=\"code-snippet__built_in\">sum<\/span>(<span class=\"code-snippet__number\">1<\/span>&nbsp;<span class=\"code-snippet__keyword\">for<\/span>&nbsp;r&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;all_results&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;<span class=\"code-snippet__keyword\">not<\/span>&nbsp;r.get(<span class=\"code-snippet__string\">\"normal\"<\/span>))<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"\u603b\u622a\u56fe\u6570:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{total}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;| \u6b63\u5e38:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{total-abnormal}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;| \u5f02\u5e38:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{abnormal}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">for<\/span>&nbsp;r&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;all_results:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'\u2705'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">&nbsp;<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__keyword\">if<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">&nbsp;r.get(<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'normal'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">)&nbsp;<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__keyword\">else<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">&nbsp;<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'\u26a0\ufe0f'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;[<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{r[<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'state'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">]}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{r[<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'step'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">]}<\/span><\/span><span class=\"code-snippet__string\">]&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{r[<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'filename'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">]}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># ============ Appium \u64cd\u4f5c\u533a\uff08\u6296\u97f3\u56db\u6b65\u64cd\u4f5c\uff09============<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">init_driver<\/span>():<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; options = UiAutomator2Options()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; options.platform_name =&nbsp;<span class=\"code-snippet__string\">\"Android\"<\/span>&nbsp;&nbsp;<span class=\"code-snippet__comment\"># HarmonyOS \u517c\u5bb9 Android \u9a71\u52a8<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; options.app_package = DOUYIN_BUNDLE_NAME<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># HarmonyOS \u542f\u52a8 Ability<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; options.app_activity =&nbsp;<span class=\"code-snippet__string\">f\".<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{DOUYIN_ABILITY_NAME}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; options.no_reset =&nbsp;<span class=\"code-snippet__literal\">True<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; options.new_command_timeout =&nbsp;<span class=\"code-snippet__number\">120<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;webdriver.Remote(APPIUM_SERVER, options=options)<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">execute_douyin_steps<\/span>(<span class=\"code-snippet__params\">driver, fold_state:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">str<\/span><\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"\u6267\u884c\u6296\u97f3\u56db\u6b65\u64cd\u4f5c\uff08HarmonyOS \u7248\u672c\uff09\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; ts =&nbsp;<span class=\"code-snippet__built_in\">int<\/span>(time.time())<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; prefix =&nbsp;<span class=\"code-snippet__string\">\"harmony\"<\/span>&nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u622a\u56fe\u6587\u4ef6\u540d\u52a0 harmony_ \u524d\u7f00\u533a\u5206\u5e73\u53f0<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u6b65\u9aa4 1\uff1a\u542f\u52a8 APP<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"\\n[\u6b65\u9aa4 1\/4] \u542f\u52a8\u6296\u97f3\uff08<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{fold_state}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;\u6001\uff09...\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; driver.launch_app()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; time.sleep(<span class=\"code-snippet__number\">4<\/span>) &nbsp;<span class=\"code-snippet__comment\"># HarmonyOS \u542f\u52a8\u901a\u5e38\u6bd4 Android \u7a0d\u6162<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; filepath = os.path.join(SCREENSHOT_DIR,&nbsp;<span class=\"code-snippet__string\">f\"<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{prefix}<\/span><\/span><span class=\"code-snippet__string\">_<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{fold_state}<\/span><\/span><span class=\"code-snippet__string\">_step1_<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{ts}<\/span><\/span><span class=\"code-snippet__string\">.png\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; ok = take_screenshot(driver, filepath)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"[\u622a\u56fe]&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'\u2705'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">&nbsp;<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__keyword\">if<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">&nbsp;ok&nbsp;<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__keyword\">else<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">&nbsp;<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'\u274c'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{filepath}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u6b65\u9aa4 2\uff1a\u8f93\u5165\u641c\u7d22\u6587\u5b57<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"[\u6b65\u9aa4 2\/4] \u8f93\u5165\u300cAPP\u81ea\u52a8\u5316\u6d4b\u8bd5\u300d...\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; time.sleep(<span class=\"code-snippet__number\">2<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># HarmonyOS \u6296\u97f3\u7684\u641c\u7d22\u6846\u5b9a\u4f4d\uff08\u53ef\u80fd\u4e0e Android \u4e0d\u540c\uff0c\u6839\u636e\u5b9e\u9645\u7248\u672c\u8c03\u6574\uff09<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; search_selectors = [<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; (AppiumBy.XPATH,&nbsp;<span class=\"code-snippet__string\">\"\/\/*[contains(@text,'\u641c\u7d22')]\"<\/span>),<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; (AppiumBy.ID,&nbsp;<span class=\"code-snippet__string\">f\"<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{DOUYIN_BUNDLE_NAME}<\/span><\/span><span class=\"code-snippet__string\">:id\/search_view\"<\/span>),<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; (AppiumBy.ACCESSIBILITY_ID,&nbsp;<span class=\"code-snippet__string\">\"\u641c\u7d22\"<\/span>),<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; ]<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; search_box =&nbsp;<span class=\"code-snippet__literal\">None<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">for<\/span>&nbsp;by, val&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;search_selectors:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">try<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; el = driver.find_element(by, val, timeout=<span class=\"code-snippet__number\">3<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;el:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; el.click()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; search_box = el<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"[INFO] \u641c\u7d22\u6846\u5b9a\u4f4d\u6210\u529f:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{by}<\/span><\/span><span class=\"code-snippet__string\">:<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{val}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">break<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">except<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">pass<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;search_box:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; time.sleep(<span class=\"code-snippet__number\">1<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u8f93\u5165\u6587\u5b57<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; input_selectors = [<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (AppiumBy.CLASS_NAME,&nbsp;<span class=\"code-snippet__string\">\"android.widget.EditText\"<\/span>),<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (AppiumBy.XPATH,&nbsp;<span class=\"code-snippet__string\">\"\/\/android.widget.EditText\"<\/span>),<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; ]<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">for<\/span>&nbsp;by, val&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;input_selectors:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">try<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inp = driver.find_element(by, val, timeout=<span class=\"code-snippet__number\">2<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;inp:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inp.send_keys(<span class=\"code-snippet__string\">\"APP\u81ea\u52a8\u5316\u6d4b\u8bd5\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"[INFO] \u8f93\u5165\u6587\u5b57\u6210\u529f\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">break<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">except<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">pass<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; time.sleep(<span class=\"code-snippet__number\">1<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; filepath = os.path.join(SCREENSHOT_DIR,&nbsp;<span class=\"code-snippet__string\">f\"<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{prefix}<\/span><\/span><span class=\"code-snippet__string\">_<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{fold_state}<\/span><\/span><span class=\"code-snippet__string\">_step2_<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{ts}<\/span><\/span><span class=\"code-snippet__string\">.png\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; ok = take_screenshot(driver, filepath)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"[\u622a\u56fe]&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'\u2705'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">&nbsp;<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__keyword\">if<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">&nbsp;ok&nbsp;<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__keyword\">else<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">&nbsp;<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'\u274c'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{filepath}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u6b65\u9aa4 3\uff1a\u70b9\u51fb\u641c\u7d22<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"[\u6b65\u9aa4 3\/4] \u70b9\u51fb\u641c\u7d22\u6309\u94ae...\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; btn_selectors = [<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; (AppiumBy.XPATH,&nbsp;<span class=\"code-snippet__string\">\"\/\/*[contains(@text,'\u641c\u7d22') and @clickable='true']\"<\/span>),<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; (AppiumBy.ID,&nbsp;<span class=\"code-snippet__string\">f\"<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{DOUYIN_BUNDLE_NAME}<\/span><\/span><span class=\"code-snippet__string\">:id\/search_confirm_btn\"<\/span>),<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; ]<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">for<\/span>&nbsp;by, val&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;btn_selectors:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">try<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; btn = driver.find_element(by, val, timeout=<span class=\"code-snippet__number\">3<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;btn:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; btn.click()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"[INFO] \u70b9\u51fb\u641c\u7d22:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{by}<\/span><\/span><span class=\"code-snippet__string\">:<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{val}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">break<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">except<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">pass<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; time.sleep(<span class=\"code-snippet__number\">2<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; filepath = os.path.join(SCREENSHOT_DIR,&nbsp;<span class=\"code-snippet__string\">f\"<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{prefix}<\/span><\/span><span class=\"code-snippet__string\">_<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{fold_state}<\/span><\/span><span class=\"code-snippet__string\">_step3_<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{ts}<\/span><\/span><span class=\"code-snippet__string\">.png\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; ok = take_screenshot(driver, filepath)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"[\u622a\u56fe]&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'\u2705'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">&nbsp;<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__keyword\">if<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">&nbsp;ok&nbsp;<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__keyword\">else<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">&nbsp;<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'\u274c'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{filepath}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u6b65\u9aa4 4\uff1a\u8fd4\u56de<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"[\u6b65\u9aa4 4\/4] \u6309 Back \u8fd4\u56de...\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; driver.back()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; time.sleep(<span class=\"code-snippet__number\">2<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; filepath = os.path.join(SCREENSHOT_DIR,&nbsp;<span class=\"code-snippet__string\">f\"<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{prefix}<\/span><\/span><span class=\"code-snippet__string\">_<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{fold_state}<\/span><\/span><span class=\"code-snippet__string\">_step4_<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{ts}<\/span><\/span><span class=\"code-snippet__string\">.png\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; ok = take_screenshot(driver, filepath, wait=<span class=\"code-snippet__literal\">False<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"[\u622a\u56fe]&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'\u2705'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">&nbsp;<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__keyword\">if<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">&nbsp;ok&nbsp;<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__keyword\">else<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">&nbsp;<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'\u274c'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{filepath}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; driver.terminate_app(DOUYIN_BUNDLE_NAME)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"[INFO] APP \u5df2\u9000\u51fa\"<\/span>)<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># ============ \u4e3b\u6d41\u7a0b =============<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">main<\/span>():<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"=\"<\/span>*<span class=\"code-snippet__number\">60<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"HarmonyOS \u6298\u53e0\u5c4f\u517c\u5bb9\u6027\u6d4b\u8bd5\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"\u6d4b\u8bd5\u5e94\u7528: \u6296\u97f3&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{DOUYIN_BUNDLE_NAME}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"=\"<\/span>*<span class=\"code-snippet__number\">60<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u7b2c\u4e00\u8f6e\uff1a\u5c55\u5f00\u6001<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"\\n========== \u7b2c\u4e00\u8f6e\uff1a\u5c55\u5f00\u6001\u6d4b\u8bd5 ==========\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; set_fold_state(<span class=\"code-snippet__string\">\"unfolded\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; time.sleep(<span class=\"code-snippet__number\">2<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; driver = init_driver()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">try<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; execute_douyin_steps(driver,&nbsp;<span class=\"code-snippet__string\">\"unfold\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">finally<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; driver.quit()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u7b2c\u4e8c\u8f6e\uff1a\u6298\u53e0\u6001<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"\\n========== \u7b2c\u4e8c\u8f6e\uff1a\u6298\u53e0\u6001\u6d4b\u8bd5 ==========\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; set_fold_state(<span class=\"code-snippet__string\">\"folded\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; time.sleep(<span class=\"code-snippet__number\">4<\/span>) &nbsp;<span class=\"code-snippet__comment\"># HarmonyOS \u6298\u53e0\u56de\u8c03\u6bd4 Android \u7a0d\u6162<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; driver = init_driver()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">try<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; execute_douyin_steps(driver,&nbsp;<span class=\"code-snippet__string\">\"fold\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">finally<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; driver.quit()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u6062\u590d\u5c55\u5f00\u6001<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"\\n========== \u6062\u590d\u8bbe\u5907\u5230\u5c55\u5f00\u6001 ==========\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; set_fold_state(<span class=\"code-snippet__string\">\"unfolded\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># AI \u89c6\u89c9\u5206\u6790<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; analyze_all_screenshots()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"\\n[\u5b8c\u6210] \u5168\u90e8\u6d4b\u8bd5\u5df2\u5b8c\u6210\u3002\"<\/span>)<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">if<\/span>&nbsp;__name__ ==&nbsp;<span class=\"code-snippet__string\">\"__main__\"<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; main()<\/span><\/code><\/pre>\n<\/section>\n<h3 style=\"box-sizing: border-box;margin: 24px 0px 12px;padding: 0px;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\" style=\"box-sizing: border-box;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span textstyle=\"\" style=\"font-size: 16px;color: #7a4fd6;\">5.3 HDC \u8fde\u63a5\u95ee\u9898\u6392\u67e5<\/span><\/span><\/h3>\n<table style=\"box-sizing: border-box;margin: 16px 0px;padding: 0px;width: 864px;border-collapse: collapse;font-size: 0.9rem;color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\">\n<tbody>\n<tr style=\"box-sizing: border-box;margin: 0px;padding: 0px;\">\n<th style=\"box-sizing: border-box;margin: 0px;padding: 10px 14px;background: none 0% 0% \/ auto repeat scroll padding-box border-box rgb(15, 23, 42);color: rgb(255, 255, 255);text-align: left;font-weight: 700;\">\n<section style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;color: #d6a841;\">\u9519\u8bef\u4fe1\u606f<\/span><\/span><\/section>\n<\/th>\n<th style=\"box-sizing: border-box;margin: 0px;padding: 10px 14px;background: none 0% 0% \/ auto repeat scroll padding-box border-box rgb(15, 23, 42);color: rgb(255, 255, 255);text-align: left;font-weight: 700;\">\n<section style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;color: #d6a841;\">\u539f\u56e0<\/span><\/span><\/section>\n<\/th>\n<th style=\"box-sizing: border-box;margin: 0px;padding: 10px 14px;background: none 0% 0% \/ auto repeat scroll padding-box border-box rgb(15, 23, 42);color: rgb(255, 255, 255);text-align: left;font-weight: 700;\">\n<section style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;color: #d6a841;\">\u89e3\u51b3\u65b9\u6cd5<\/span><\/span><\/section>\n<\/th>\n<\/tr>\n<tr style=\"box-sizing: border-box;margin: 0px;padding: 0px;\">\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);background: rgb(248, 250, 252);font-family: monospace;color: rgb(220, 38, 38);font-size: 0.85rem;\">\n<section><span leaf=\"\">hdc: cannot connect to device<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);background: rgb(248, 250, 252);\">\n<section><span leaf=\"\">\u8bbe\u5907\u672a\u5f00\u542f\u5f00\u53d1\u8005\u6a21\u5f0f\u6216 USB \u8c03\u8bd5<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);background: rgb(248, 250, 252);\">\n<section><span leaf=\"\">\u8bbe\u5907\u8bbe\u7f6e \u2192 \u5f00\u53d1\u8005\u9009\u9879 \u2192 \u5f00\u542f USB \u8c03\u8bd5 + HDCD\uff08\u9e3f\u8499\u8c03\u8bd5\uff09<\/span><\/section>\n<\/td>\n<\/tr>\n<tr style=\"box-sizing: border-box;margin: 0px;padding: 0px;\">\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);font-family: monospace;color: rgb(220, 38, 38);font-size: 0.85rem;\">\n<section><span leaf=\"\">hdc list targets \u4e3a\u7a7a<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);\">\n<section><span leaf=\"\">HDC \u670d\u52a1\u672a\u542f\u52a8<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);\">\n<section><span leaf=\"\">\u6267\u884c&nbsp;<\/span><code style=\"box-sizing: border-box;margin: 0px;padding: 1px 6px;background: rgb(241, 245, 249);border: 1px solid rgb(226, 232, 240);border-radius: 4px;font-size: 0.88em;color: rgb(99, 102, 241);font-family: &quot;Cascadia Code&quot;, &quot;Fira Code&quot;, monospace;\"><span leaf=\"\">hdc kill-server &amp;&amp; hdc start-server<\/span><\/code><span leaf=\"\">&nbsp;\u91cd\u542f\u670d\u52a1<\/span><\/section>\n<\/td>\n<\/tr>\n<tr style=\"box-sizing: border-box;margin: 0px;padding: 0px;\">\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);background: rgb(248, 250, 252);font-family: monospace;color: rgb(220, 38, 38);font-size: 0.85rem;\">\n<section><span leaf=\"\">bm setDisplayMode \u62a5\u9519<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);background: rgb(248, 250, 252);\">\n<section><span leaf=\"\">\u8bbe\u5907\u4e0d\u652f\u6301\u8be5\u547d\u4ee4\u6216\u6743\u9650\u4e0d\u8db3<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);background: rgb(248, 250, 252);\">\n<section><span leaf=\"\">\u786e\u8ba4\u8bbe\u5907\u4e3a\u6298\u53e0\u5c4f\uff1b\u90e8\u5206\u8bbe\u5907\u9700\u8981 root \u6743\u9650<\/span><\/section>\n<\/td>\n<\/tr>\n<tr style=\"box-sizing: border-box;margin: 0px;padding: 0px;\">\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);font-family: monospace;color: rgb(220, 38, 38);font-size: 0.85rem;\">\n<section><span leaf=\"\">Appium \u8fde\u63a5\u8d85\u65f6<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);\">\n<section><span leaf=\"\">\u8bbe\u5907\u672a\u901a\u8fc7 USB \u8fde\u63a5\u6216\u7aef\u53e3\u88ab\u5360\u7528<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);\">\n<section><span leaf=\"\">\u786e\u8ba4 USB \u8fde\u63a5\u6b63\u5e38\uff1b\u68c0\u67e5 4723 \u7aef\u53e3\u662f\u5426\u88ab\u5360\u7528\uff08netstat -ano | findstr 4723\uff09<\/span><\/section>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<section><span leaf=\"\"><br  \/><\/span><\/section>\n<hr style=\"border-style: solid;border-width: 1px 0 0;border-color: rgba(0,0,0,0.1);-webkit-transform-origin: 0 0;-webkit-transform: scale(1, 0.5);transform-origin: 0 0;transform: scale(1, 0.5);\"  \/>\n<section><span style=\"box-sizing: border-box;margin: 0px;padding: 3px 10px;font-size: 0.75rem;background: rgba(255, 255, 255, 0.25);border-radius: 99px;letter-spacing: 1px;font-weight: 700;color: rgb(255, 255, 255);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\"><br  \/><\/span><\/span><\/section>\n<section><span data-pm-slice=\"0 0 []\"><span leaf=\"\" style=\"box-sizing: border-box;margin: 0px;padding: 3px 10px;font-size: 0.75rem;background: rgba(255, 255, 255, 0.25);border-radius: 99px;letter-spacing: 1px;font-weight: 700;\"><span textstyle=\"\" style=\"font-size: 18px;color: #d6a841;font-weight: bold;\">\u7b2c\u516d\u7ae0&nbsp;<\/span><span textstyle=\"\" style=\"font-size: 17px;color: #0052ff;font-weight: bold;\">AI \u89c6\u89c9\u5206\u6790\uff1a\u811a\u672c\u6267\u884c\u5b8c\u6bd5\u540e\u81ea\u52a8\u63a5\u7eed\u5206\u6790\u622a\u56fe<\/span><\/span><\/span><\/section>\n<p style=\"box-sizing: border-box;margin: 0px 0px 14px;padding: 0px;line-height: 1.9;color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: medium;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\">AI \u89c6\u89c9\u5206\u6790\u662f\u6574\u4e2a\u65b9\u6848\u7684\u6700\u540e\u4e00\u73af\uff0c\u4e5f\u662f\u4ef7\u503c\u6700\u9ad8\u7684\u4e00\u73af\u2014\u2014\u628a&#8221;\u4eba\u773c\u5bf9\u6bd4\u622a\u56fe&#8221;\u8fd9\u4ef6\u4e8b\u81ea\u52a8\u5316\u3002\u811a\u672c\u6267\u884c\u5b8c\u4e24\u8f6e\u6d4b\u8bd5\u540e\uff0c8 \u5f20\u622a\u56fe\uff084 \u6b65 \u00d7 2 \u72b6\u6001\uff09\u5df2\u4fdd\u5b58\u5728\u672c\u5730\u76ee\u5f55\uff0cAI \u5206\u6790\u4ee3\u7801\u81ea\u52a8\u63a5\u7eed\u6267\u884c\uff0c\u9010\u5f20\u5206\u6790\u5e76\u8f93\u51fa\u5f02\u5e38\u62a5\u544a\u3002<\/span><\/p>\n<h3 style=\"box-sizing: border-box;margin: 24px 0px 12px;padding: 0px;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\" style=\"box-sizing: border-box;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span textstyle=\"\" style=\"font-size: 16px;color: #7a4fd6;\">6.1 AI \u5206<\/span><\/span><span leaf=\"\" style=\"box-sizing: border-box;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span textstyle=\"\" style=\"font-size: 16px;color: #7a4fd6;\">\u6790 Prompt \u8bbe<\/span><\/span><span leaf=\"\" style=\"box-sizing: border-box;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span textstyle=\"\" style=\"font-size: 16px;color: #7a4fd6;\">\u8ba1<\/span><\/span><\/h3>\n<p style=\"box-sizing: border-box;margin: 0px 0px 14px;padding: 0px;line-height: 1.9;color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: medium;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">Prompt \u7684\u8bbe\u8ba1\u51b3\u5b9a\u4e86 AI \u80fd\u5426\u51c6\u786e\u8bc6\u522b\u754c\u9762\u5f02\u5e38\u3002\u4ee5\u4e0b\u662f\u4f18\u5316\u540e\u7684\u5206\u6790 Prompt\uff1a<\/span><\/p>\n<p><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;background-color: #00d5ff;color: #ffffff;font-weight: bold;\">AI \u5206<\/span><\/span><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;background-color: #00d5ff;color: #ffffff;font-weight: bold;\">\u6790 Prompt\uff08<\/span><\/span><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;background-color: #00d5ff;color: #ffffff;font-weight: bold;\">\u901a\u4e49\u5343\u95ee\u89c6\u89c9 API\uff09<\/span><\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"makefile\"><code><span leaf=\"\">ANALYZE_PROMPT =&nbsp;<span class=\"code-snippet__string\">\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">\u4f60\u662f\u4e00\u4f4d\u4e13\u4e1a\u7684 APP \u517c\u5bb9\u6027\u6d4b\u8bd5\u5de5\u7a0b\u5e08\u3002\u8bf7\u4ed4\u7ec6\u5206\u6790\u8fd9\u5f20\u622a\u56fe\uff0c\u5224\u65ad\u6296\u97f3 APP \u5f53\u524d\u754c\u9762\u662f\u5426\u6b63\u5e38\u3002<\/span><\/code><code><span leaf=\"\">\u8bf7\u68c0\u67e5\u4ee5\u4e0b\u7ef4\u5ea6\uff1a<\/span><\/code><code><span leaf=\"\">1. \u5e03\u5c40\u5f02\u5e38\uff1a\u5143\u7d20\u6709\u65e0\u91cd\u53e0\u3001\u622a\u65ad\u3001\u9519\u4f4d\u3001\u7f3a\u5931<\/span><\/code><code><span leaf=\"\">2. \u6587\u5b57\u5f02\u5e38\uff1a\u6709\u65e0\u4e71\u7801\u3001\u6587\u5b57\u88ab\u906e\u6321\u3001\u6587\u5b57\u5f02\u5e38\u653e\u5927\u6216\u7f29\u5c0f<\/span><\/code><code><span leaf=\"\">3. \u56fe\u7247\u5f02\u5e38\uff1a\u56fe\u7247\u662f\u5426\u6b63\u5e38\u663e\u793a\uff08\u65e0\u7f3a\u5931\u3001\u65e0\u82b1\u5c4f\u3001\u65e0\u62c9\u4f38\u53d8\u5f62\uff09<\/span><\/code><code><span leaf=\"\">4. \u94f0\u94fe\u533a\u57df\uff1a\u6298\u75d5\u5904\u662f\u5426\u6709\u5185\u5bb9\u5f02\u5e38\uff08\u88ab\u906e\u6321\u3001\u88ab\u62c9\u4f38\uff09<\/span><\/code><code><span leaf=\"\">5. \u6574\u4f53\u534f\u8c03\uff1a\u6574\u4f53\u89c6\u89c9\u662f\u5426\u534f\u8c03\uff08\u65e0\u5f02\u5e38\u7559\u767d\u3001\u65e0\u5143\u7d20\u5f02\u5e38\u91cd\u53e0\uff09<\/span><\/code><code><span leaf=\"\">\u6298\u53e0\u5c4f\u7279\u522b\u5173\u6ce8\uff1a<\/span><\/code><code><span leaf=\"\">- \u5206\u8fa8\u7387\u53d8\u5316\u540e\uff0c\u5e03\u5c40\u662f\u5426\u91cd\u65b0\u8ba1\u7b97\u5e76\u6b63\u786e\u663e\u793a<\/span><\/code><code><span leaf=\"\">- \u5e95\u90e8\u5bfc\u822a\u680f\u662f\u5426\u88ab\u94f0\u94fe\u533a\u57df\u906e\u6321<\/span><\/code><code><span leaf=\"\">- \u56fe\u7247\u548c\u89c6\u9891\u6d41\u5728\u6298\u53e0\u6001\u4e0b\u662f\u5426\u81ea\u9002\u5e94\u7f29\u653e<\/span><\/code><code><span leaf=\"\">\u8bf7\u7528\u4ee5\u4e0b JSON \u683c\u5f0f\u8fd4\u56de\u5206\u6790\u7ed3\u679c\uff08\u53ea\u8fd4\u56de JSON\uff0c\u4e0d\u8981\u6709\u5176\u4ed6\u5185\u5bb9\uff09\uff1a<\/span><\/code><code><span leaf=\"\">{<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \"normal<span class=\"code-snippet__string\">\": true\u6216false,<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \"description<span class=\"code-snippet__string\">\": \"<\/span>\u4e00\u53e5\u8bdd\u63cf\u8ff0\u5f53\u524d\u754c\u9762\u72b6\u6001<span class=\"code-snippet__string\">\",<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \"issues<span class=\"code-snippet__string\">\": [\"<\/span>\u5177\u4f53\u95ee\u98981<span class=\"code-snippet__string\">\", \"<\/span>\u5177\u4f53\u95ee\u98982<span class=\"code-snippet__string\">\"],<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \"confidence<span class=\"code-snippet__string\">\": 0.0\u52301.0\u4e4b\u95f4\u7684\u5c0f\u6570,<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \"fold_state<span class=\"code-snippet__string\">\": \"<\/span>\u5c55\u5f00\u6001<span class=\"code-snippet__string\">\"\u6216\"<\/span>\u6298\u53e0\u6001<span class=\"code-snippet__string\">\",<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \"step<span class=\"code-snippet__string\">\": \"<\/span>\u6b65\u9aa4\u7f16\u53f7<span class=\"code-snippet__string\">\"<\/span><\/span><\/code><code><span leaf=\"\">}<\/span><\/code><code><span leaf=\"\">\"<span class=\"code-snippet__string\">\"\"<\/span><\/span><\/code><\/pre>\n<\/section>\n<h3 style=\"box-sizing: border-box;margin: 24px 0px 12px;padding: 0px;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\" style=\"box-sizing: border-box;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span textstyle=\"\" style=\"font-size: 16px;color: #7a4fd6;\">6.2 \u5b8c\u6574 AI \u5206<\/span><\/span><span leaf=\"\" style=\"box-sizing: border-box;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span textstyle=\"\" style=\"font-size: 16px;color: #7a4fd6;\">\u6790\u4ee3<\/span><\/span><span leaf=\"\" style=\"box-sizing: border-box;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span textstyle=\"\" style=\"font-size: 16px;color: #7a4fd6;\">\u7801<\/span><\/span><\/h3>\n<section style=\"text-align: center;\" nodeleaf=\"\">\n<figure class=\"wx-qr-wrap\"><img decoding=\"async\" class=\"rich_pages wxw-img\" data-aistatus=\"1\" data-imgfileid=\"100000579\" data-s=\"300,640\" data-type=\"png\" type=\"block\" src=\"https:\/\/mmbiz.qpic.cn\/mmbiz_png\/BWmfcibGhS1IaklPFep6qP31gzpfgqrMzciaicT3hIIA6Gr5J8hISOhldvoPNUEUx7MWw2T44g0iciaRGKDJo0LLfXGsNbIP1zgiaMgHlcEMUfoLQ\/640?wx_fmt=png&#038;from=appmsg\" \/><figcaption class=\"wx-qr-tip\"><img decoding=\"async\" src=\"https:\/\/www.deartester.com\/wp-content\/uploads\/2026\/09\/wechat-qr.jpg\" alt=\"\u5fae\u4fe1\u516c\u4f17\u53f7\u4e8c\u7ef4\u7801\" loading=\"lazy\"><span>\u56fe\u7247\u5f15\u81ea\u5fae\u4fe1\u516c\u4f17\u53f7\uff0c\u626b\u7801\u5173\u6ce8\u9605\u8bfb\u539f\u6587<\/span><\/figcaption><\/figure>\n<\/section>\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"576\">\n<section><span style=\"color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: 11px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: center;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;\" data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 12px;color: #888888;font-weight: bold;\">\u6b65\u9aa41: \u904d\u5386 screenshots \u76ee\u5f55\uff0c\u627e\u5230\u6240\u6709 png \u6587\u4ef6<\/span><\/span><\/span><\/section>\n<section><span style=\"color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: 11px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: center;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;\" data-pm-slice=\"0 0 []\"><span style=\"color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: 11px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: center;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;\" data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 12px;color: #888888;font-weight: bold;\">\u6b65\u9aa42: \u9010\u5f20\u8bfb\u53d6\u56fe\u7247\uff0c\u8f6c base64<\/span><\/span><\/span><\/span><\/section>\n<section><span style=\"color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: 11px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: center;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;\" data-pm-slice=\"0 0 []\"><span style=\"color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: 11px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: center;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;\" data-pm-slice=\"0 0 []\"><span style=\"color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: 11px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: center;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;\" data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 12px;color: #888888;font-weight: bold;\">\u6b65\u9aa43: \u8c03\u7528\u89c6\u89c9 API\uff0c\u4f20\u5165\u56fe\u7247 + Prompt<\/span><\/span><\/span><\/span><\/span><\/section>\n<section><span style=\"color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: 11px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: center;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;\" data-pm-slice=\"0 0 []\"><span style=\"color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: 11px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: center;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;\" data-pm-slice=\"0 0 []\"><span style=\"color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: 11px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: center;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;\" data-pm-slice=\"0 0 []\"><span style=\"color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: 11px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: center;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;\" data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 12px;color: #888888;font-weight: bold;\">\u6b65\u9aa44: \u89e3\u6790 JSON \u7ed3\u679c\uff0c\u8f93\u51fa\u5230\u63a7\u5236\u53f0 + \u4fdd\u5b58\u62a5\u544a\u6587\u4ef6<\/span><\/span><\/span><\/span><\/span><\/span><\/section>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<section style=\"text-align: center;\"><span style=\"color: rgb(100, 116, 139);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: 13.12px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\" data-pm-slice=\"0 0 []\"><span leaf=\"\">AI \u89c6\u89c9\u5206\u6790\u6d41\u7a0b\uff1a\u4ece 8 \u5f20\u622a\u56fe\u5230\u5f02\u5e38\u62a5\u544a\uff0c\u5168\u81ea\u52a8\u6267\u884c\uff0c\u65e0\u9700\u4eba\u5de5\u4ecb\u5165<\/span><\/span><\/section>\n<section><span data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;background-color: #00d5ff;color: #ffffff;font-weight: bold;\">ai_vision_analyzer.py \u2014 \u72ec\u7acb AI \u89c6\u89c9\u5206\u6790\u6a21\u5757\uff08\u53ef\u5355\u72ec\u8fd0\u884c\uff09<\/span><\/span><\/span><\/section>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"python\"><code><span leaf=\"\"><span class=\"code-snippet__comment\">#!\/usr\/bin\/env python3<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># -*- coding: utf-8 -*-<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__string\">\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">AI \u89c6\u89c9\u5206\u6790\u6a21\u5757<\/span><\/code><code><span leaf=\"\">\u529f\u80fd\uff1a\u5206\u6790\u6298\u53e0\u5c4f\u6d4b\u8bd5\u751f\u6210\u7684\u622a\u56fe\uff0c\u8f93\u51fa\u5f02\u5e38\u62a5\u544a<\/span><\/code><code><span leaf=\"\">\u652f\u6301\u6a21\u578b\uff1a\u901a\u4e49\u5343\u95ee\uff08qwen-vl-plus\uff09\u3001OpenAI GPT-4V \u7b49<\/span><\/code><code><span leaf=\"\">\u7528\u6cd5\uff1a<\/span><\/code><code><span leaf=\"\">1. \u76f4\u63a5\u8fd0\u884c\uff1apython ai_vision_analyzer.py<\/span><\/code><code><span leaf=\"\">2. \u88ab\u5bfc\u5165\uff1afrom ai_vision_analyzer import analyze_all_screenshots<\/span><\/code><code><span leaf=\"\">\"\"\"<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;os<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;json<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;time<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;base64<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;requests<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># ============ \u914d\u7f6e\u533a =============<\/span><\/span><\/code><code><span leaf=\"\">AI_VISION_API_URL =&nbsp;<span class=\"code-snippet__string\">\"https:\/\/dashscope.aliyuncs.com\/api\/v1\/services\/vision\/vision\/describe\"<\/span><\/span><\/code><code><span leaf=\"\">AI_API_KEY =&nbsp;<span class=\"code-snippet__string\">\"your-api-key-here\"<\/span>&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u901a\u4e49\u5343\u95ee API Key<\/span><\/span><\/code><code><span leaf=\"\">AI_MODEL =&nbsp;<span class=\"code-snippet__string\">\"qwen-vl-plus\"<\/span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class=\"code-snippet__comment\"># \u6a21\u578b\u540d\u79f0\uff08\u901a\u4e49\u5343\u95ee \/ gpt-4-vision-preview\uff09<\/span><\/span><\/code><code><span leaf=\"\">SCREENSHOT_DIR =&nbsp;<span class=\"code-snippet__string\">r\"C:\\Users\\51362\\Desktop\\\u6587\u7ae0\\foldable_test_screenshots\"<\/span><\/span><\/code><code><span leaf=\"\">REPORT_PATH = os.path.join(SCREENSHOT_DIR,&nbsp;<span class=\"code-snippet__string\">\"test_report.txt\"<\/span>)<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># =================================<\/span><\/span><\/code><code><span leaf=\"\">ANALYZE_PROMPT =&nbsp;<span class=\"code-snippet__string\">\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">\u4f60\u662f\u4e00\u4f4d\u4e13\u4e1a\u7684 APP \u517c\u5bb9\u6027\u6d4b\u8bd5\u5de5\u7a0b\u5e08\u3002\u8bf7\u4ed4\u7ec6\u5206\u6790\u8fd9\u5f20\u622a\u56fe\uff0c\u5224\u65ad\u6296\u97f3 APP \u5f53\u524d\u754c\u9762\u662f\u5426\u6b63\u5e38\u3002<\/span><\/code><code><span leaf=\"\">\u8bf7\u68c0\u67e5\u4ee5\u4e0b\u7ef4\u5ea6\uff1a<\/span><\/code><code><span leaf=\"\">1. \u5e03\u5c40\u5f02\u5e38\uff1a\u5143\u7d20\u6709\u65e0\u91cd\u53e0\u3001\u622a\u65ad\u3001\u9519\u4f4d\u3001\u7f3a\u5931<\/span><\/code><code><span leaf=\"\">2. \u6587\u5b57\u5f02\u5e38\uff1a\u6709\u65e0\u4e71\u7801\u3001\u6587\u5b57\u88ab\u906e\u6321\u3001\u6587\u5b57\u5f02\u5e38\u653e\u5927\u6216\u7f29\u5c0f<\/span><\/code><code><span leaf=\"\">3. \u56fe\u7247\u5f02\u5e38\uff1a\u56fe\u7247\u662f\u5426\u6b63\u5e38\u663e\u793a\uff08\u65e0\u7f3a\u5931\u3001\u65e0\u82b1\u5c4f\u3001\u65e0\u62c9\u4f38\u53d8\u5f62\uff09<\/span><\/code><code><span leaf=\"\">4. \u94f0\u94fe\u533a\u57df\uff1a\u6298\u75d5\u5904\u662f\u5426\u6709\u5185\u5bb9\u5f02\u5e38\uff08\u88ab\u906e\u6321\u3001\u88ab\u62c9\u4f38\uff09<\/span><\/code><code><span leaf=\"\">5. \u6574\u4f53\u534f\u8c03\uff1a\u6574\u4f53\u89c6\u89c9\u662f\u5426\u534f\u8c03\uff08\u65e0\u5f02\u5e38\u7559\u767d\u3001\u65e0\u5143\u7d20\u5f02\u5e38\u91cd\u53e0\uff09<\/span><\/code><code><span leaf=\"\">\u6298\u53e0\u5c4f\u7279\u522b\u5173\u6ce8\uff1a<\/span><\/code><code><span leaf=\"\">- \u5206\u8fa8\u7387\u53d8\u5316\u540e\uff0c\u5e03\u5c40\u662f\u5426\u91cd\u65b0\u8ba1\u7b97\u5e76\u6b63\u786e\u663e\u793a<\/span><\/code><code><span leaf=\"\">- \u5e95\u90e8\u5bfc\u822a\u680f\u662f\u5426\u88ab\u94f0\u94fe\u533a\u57df\u906e\u6321<\/span><\/code><code><span leaf=\"\">- \u56fe\u7247\u548c\u89c6\u9891\u6d41\u5728\u6298\u53e0\u6001\u4e0b\u662f\u5426\u81ea\u9002\u5e94\u7f29\u653e<\/span><\/code><code><span leaf=\"\">\u8bf7\u7528\u4ee5\u4e0b JSON \u683c\u5f0f\u8fd4\u56de\u5206\u6790\u7ed3\u679c\uff08\u53ea\u8fd4\u56de JSON\uff0c\u4e0d\u8981\u6709\u5176\u4ed6\u5185\u5bb9\uff09\uff1a<\/span><\/code><code><span leaf=\"\">{<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \"normal\": true\u6216false,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \"description\": \"\u4e00\u53e5\u8bdd\u63cf\u8ff0\u5f53\u524d\u754c\u9762\u72b6\u6001\",<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \"issues\": [\"\u5177\u4f53\u95ee\u98981\", \"\u5177\u4f53\u95ee\u98982\"],<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \"confidence\": 0.0\u52301.0\u4e4b\u95f4\u7684\u5c0f\u6570,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \"fold_state\": \"\u5c55\u5f00\u6001\"\u6216\"\u6298\u53e0\u6001\",<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \"step\": \"\u6b65\u9aa4\u7f16\u53f7\"<\/span><\/code><code><span leaf=\"\">}<\/span><\/code><code><span leaf=\"\">\"\"\"<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">analyze_single_image<\/span>(<span class=\"code-snippet__params\">image_path:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">str<\/span><\/span><span class=\"code-snippet__params\">, api_url:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">str<\/span><\/span><span class=\"code-snippet__params\">, api_key:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">str<\/span><\/span><span class=\"code-snippet__params\">, model:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">str<\/span><\/span>) -&gt;&nbsp;<span class=\"code-snippet__built_in\">dict<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u8c03\u7528\u89c6\u89c9\u5927\u6a21\u578b\u5206\u6790\u5355\u5f20\u622a\u56fe<\/span><\/code><code><span leaf=\"\"><br  \/><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u53c2\u6570:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; image_path: \u622a\u56fe\u6587\u4ef6\u8def\u5f84<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; api_url: API \u63a5\u53e3\u5730\u5740<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; api_key: API Key<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; model: \u6a21\u578b\u540d\u79f0<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u8fd4\u56de:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; dict: \u5305\u542b normal\/description\/issues\/confidence\/fold_state\/step<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \"\"\"<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;<span class=\"code-snippet__keyword\">not<\/span>&nbsp;os.path.exists(image_path):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;{<span class=\"code-snippet__string\">\"normal\"<\/span>:&nbsp;<span class=\"code-snippet__literal\">False<\/span>,&nbsp;<span class=\"code-snippet__string\">\"description\"<\/span>:&nbsp;<span class=\"code-snippet__string\">f\"\u6587\u4ef6\u4e0d\u5b58\u5728:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{image_path}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>,&nbsp;<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"confidence\"<\/span>:&nbsp;<span class=\"code-snippet__number\">0.0<\/span>,&nbsp;<span class=\"code-snippet__string\">\"issues\"<\/span>: [<span class=\"code-snippet__string\">\"\u6587\u4ef6\u7f3a\u5931\"<\/span>],&nbsp;<span class=\"code-snippet__string\">\"fold_state\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"?\"<\/span>,&nbsp;<span class=\"code-snippet__string\">\"step\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"?\"<\/span>}<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">with<\/span>&nbsp;<span class=\"code-snippet__built_in\">open<\/span>(image_path,&nbsp;<span class=\"code-snippet__string\">\"rb\"<\/span>)&nbsp;<span class=\"code-snippet__keyword\">as<\/span>&nbsp;f:\\n &nbsp; &nbsp; &nbsp; &nbsp;image_data = f.read()\\n &nbsp; &nbsp;image_base64 = base64.b64encode(image_data).decode(<span class=\"code-snippet__string\">\"utf-8\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; headers = {<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"Authorization\"<\/span>:&nbsp;<span class=\"code-snippet__string\">f\"Bearer&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{api_key}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"Content-Type\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"application\/json\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; }<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u901a\u4e49\u5343\u95ee\u89c6\u89c9 API \u683c\u5f0f<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; payload = {<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"model\"<\/span>: model,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"input\"<\/span>: {<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"messages\"<\/span>: [<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"role\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"user\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"content\"<\/span>: [<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<span class=\"code-snippet__string\">\"image\"<\/span>:&nbsp;<span class=\"code-snippet__string\">f\"data:image\/png;base64,<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{image_base64}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>},<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<span class=\"code-snippet__string\">\"text\"<\/span>: ANALYZE_PROMPT}<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; }<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; }<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">try<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; resp = requests.post(api_url, headers=headers, json=payload, timeout=<span class=\"code-snippet__number\">60<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;resp.status_code ==&nbsp;<span class=\"code-snippet__number\">200<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; result = resp.json()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u901a\u4e49\u5343\u95ee\u8fd4\u56de\u683c\u5f0f\uff1aoutput.choices[0].message.content<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; content = (<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; result.get(<span class=\"code-snippet__string\">\"output\"<\/span>, {}).get(<span class=\"code-snippet__string\">\"choices\"<\/span>, [{}])[<span class=\"code-snippet__number\">0<\/span>]<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .get(<span class=\"code-snippet__string\">\"message\"<\/span>, {}).get(<span class=\"code-snippet__string\">\"content\"<\/span>,&nbsp;<span class=\"code-snippet__string\">\"\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u5c1d\u8bd5\u4ece content \u4e2d\u63d0\u53d6 JSON<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">for<\/span>&nbsp;segment&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;content.splitlines():<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; segment = segment.strip()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;segment.startswith(<span class=\"code-snippet__string\">\"{\"<\/span>)&nbsp;<span class=\"code-snippet__keyword\">and<\/span>&nbsp;segment.endswith(<span class=\"code-snippet__string\">\"}\"<\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">try<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; parsed = json.loads(segment)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;parsed<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">except<\/span>&nbsp;json.JSONDecodeError:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">pass<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;{<span class=\"code-snippet__string\">\"normal\"<\/span>:&nbsp;<span class=\"code-snippet__literal\">True<\/span>,&nbsp;<span class=\"code-snippet__string\">\"description\"<\/span>: content[:<span class=\"code-snippet__number\">300<\/span>],&nbsp;<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"confidence\"<\/span>:&nbsp;<span class=\"code-snippet__number\">0.8<\/span>,&nbsp;<span class=\"code-snippet__string\">\"issues\"<\/span>: [],&nbsp;<span class=\"code-snippet__string\">\"fold_state\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"?\"<\/span>,&nbsp;<span class=\"code-snippet__string\">\"step\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"?\"<\/span>}<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">else<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;{<span class=\"code-snippet__string\">\"normal\"<\/span>:&nbsp;<span class=\"code-snippet__literal\">False<\/span>,&nbsp;<span class=\"code-snippet__string\">\"description\"<\/span>:&nbsp;<span class=\"code-snippet__string\">f\"API \u9519\u8bef&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{resp.status_code}<\/span><\/span><span class=\"code-snippet__string\">:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{resp.text[:<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__number\">100<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">]}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"confidence\"<\/span>:&nbsp;<span class=\"code-snippet__number\">0.0<\/span>,&nbsp;<span class=\"code-snippet__string\">\"issues\"<\/span>: [<span class=\"code-snippet__string\">\"API \u8c03\u7528\u5931\u8d25\"<\/span>],&nbsp;<span class=\"code-snippet__string\">\"fold_state\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"?\"<\/span>,&nbsp;<span class=\"code-snippet__string\">\"step\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"?\"<\/span>}<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">except<\/span>&nbsp;requests.exceptions.Timeout:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;{<span class=\"code-snippet__string\">\"normal\"<\/span>:&nbsp;<span class=\"code-snippet__literal\">False<\/span>,&nbsp;<span class=\"code-snippet__string\">\"description\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"API \u8c03\u7528\u8d85\u65f6\"<\/span>,&nbsp;<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"confidence\"<\/span>:&nbsp;<span class=\"code-snippet__number\">0.0<\/span>,&nbsp;<span class=\"code-snippet__string\">\"issues\"<\/span>: [<span class=\"code-snippet__string\">\"\u8d85\u65f6\"<\/span>],&nbsp;<span class=\"code-snippet__string\">\"fold_state\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"?\"<\/span>,&nbsp;<span class=\"code-snippet__string\">\"step\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"?\"<\/span>}<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">except<\/span>&nbsp;Exception&nbsp;<span class=\"code-snippet__keyword\">as<\/span>&nbsp;e:\\n &nbsp; &nbsp; &nbsp; &nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;{<span class=\"code-snippet__string\">\"normal\"<\/span>:&nbsp;<span class=\"code-snippet__literal\">False<\/span>,&nbsp;<span class=\"code-snippet__string\">\"description\"<\/span>:&nbsp;<span class=\"code-snippet__string\">f\"\u5f02\u5e38:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__built_in\">str<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">(e)}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>,&nbsp;<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"confidence\"<\/span>:&nbsp;<span class=\"code-snippet__number\">0.0<\/span>,&nbsp;<span class=\"code-snippet__string\">\"issues\"<\/span>: [<span class=\"code-snippet__built_in\">str<\/span>(e)],&nbsp;<span class=\"code-snippet__string\">\"fold_state\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"?\"<\/span>,&nbsp;<span class=\"code-snippet__string\">\"step\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"?\"<\/span>}<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">parse_filename_info<\/span>(<span class=\"code-snippet__params\">filename:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">str<\/span><\/span>) -&gt;&nbsp;<span class=\"code-snippet__built_in\">dict<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"\u4ece\u622a\u56fe\u6587\u4ef6\u540d\u89e3\u6790\u72b6\u6001\u548c\u6b65\u9aa4\u4fe1\u606f\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u683c\u5f0f: unfold_step1_1234567890.png \u6216 harmony_fold_step2_1234567890.png<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; name = filename.replace(<span class=\"code-snippet__string\">\".png\"<\/span>,&nbsp;<span class=\"code-snippet__string\">\"\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; parts = name.split(<span class=\"code-snippet__string\">\"_\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;<span class=\"code-snippet__string\">\"harmony\"<\/span>&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;parts:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; idx = parts.index(<span class=\"code-snippet__string\">\"harmony\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; state = parts[idx +&nbsp;<span class=\"code-snippet__number\">1<\/span>]&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;idx +&nbsp;<span class=\"code-snippet__number\">1<\/span>&nbsp;&lt;&nbsp;<span class=\"code-snippet__built_in\">len<\/span>(parts)&nbsp;<span class=\"code-snippet__keyword\">else<\/span>&nbsp;<span class=\"code-snippet__string\">\"?\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; step = parts[idx +&nbsp;<span class=\"code-snippet__number\">2<\/span>]&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;idx +&nbsp;<span class=\"code-snippet__number\">2<\/span>&nbsp;&lt;&nbsp;<span class=\"code-snippet__built_in\">len<\/span>(parts)&nbsp;<span class=\"code-snippet__keyword\">else<\/span>&nbsp;<span class=\"code-snippet__string\">\"?\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">else<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; state = parts[<span class=\"code-snippet__number\">0<\/span>]&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;parts&nbsp;<span class=\"code-snippet__keyword\">else<\/span>&nbsp;<span class=\"code-snippet__string\">\"?\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; step = parts[<span class=\"code-snippet__number\">1<\/span>]&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;<span class=\"code-snippet__built_in\">len<\/span>(parts) &gt;&nbsp;<span class=\"code-snippet__number\">1<\/span>&nbsp;<span class=\"code-snippet__keyword\">else<\/span>&nbsp;<span class=\"code-snippet__string\">\"?\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;{<span class=\"code-snippet__string\">\"fold_state\"<\/span>: state,&nbsp;<span class=\"code-snippet__string\">\"step\"<\/span>: step}<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">analyze_all_screenshots<\/span>(<span class=\"code-snippet__params\">screenshot_dir:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">str<\/span><\/span><span class=\"code-snippet__params\">&nbsp;=&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__literal\">None<\/span><\/span><span class=\"code-snippet__params\">, api_url:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">str<\/span><\/span><span class=\"code-snippet__params\">&nbsp;=&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__literal\">None<\/span><\/span><span class=\"code-snippet__params\">,<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; api_key:&nbsp;<span class=\"code-snippet__built_in\">str<\/span>&nbsp;=&nbsp;<span class=\"code-snippet__literal\">None<\/span>, model:&nbsp;<span class=\"code-snippet__built_in\">str<\/span>&nbsp;=&nbsp;<span class=\"code-snippet__literal\">None<\/span>) -&gt;&nbsp;<span class=\"code-snippet__built_in\">list<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u5206\u6790 screenshots \u76ee\u5f55\u4e0b\u6240\u6709\u622a\u56fe\uff0c\u751f\u6210\u5f02\u5e38\u62a5\u544a<\/span><\/code><code><span leaf=\"\"><br  \/><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u53c2\u6570:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; screenshot_dir: \u622a\u56fe\u76ee\u5f55\uff08\u9ed8\u8ba4\u4f7f\u7528\u914d\u7f6e\u533a SCREENSHOT_DIR\uff09<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; api_url: API \u5730\u5740\uff08\u9ed8\u8ba4\u4f7f\u7528\u914d\u7f6e\u533a AI_VISION_API_URL\uff09<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; api_key: API Key\uff08\u9ed8\u8ba4\u4f7f\u7528\u914d\u7f6e\u533a AI_API_KEY\uff09<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; model: \u6a21\u578b\u540d\u79f0\uff08\u9ed8\u8ba4\u4f7f\u7528\u914d\u7f6e\u533a AI_MODEL\uff09<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u8fd4\u56de:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; list: \u6240\u6709\u622a\u56fe\u7684\u5206\u6790\u7ed3\u679c<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \"\"\"<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; screenshot_dir = screenshot_dir&nbsp;<span class=\"code-snippet__keyword\">or<\/span>&nbsp;SCREENSHOT_DIR<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; api_url = api_url&nbsp;<span class=\"code-snippet__keyword\">or<\/span>&nbsp;AI_VISION_API_URL<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; api_key = api_key&nbsp;<span class=\"code-snippet__keyword\">or<\/span>&nbsp;AI_API_KEY<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; model = model&nbsp;<span class=\"code-snippet__keyword\">or<\/span>&nbsp;AI_MODEL<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;<span class=\"code-snippet__keyword\">not<\/span>&nbsp;os.path.exists(screenshot_dir):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"[ERROR] \u622a\u56fe\u76ee\u5f55\u4e0d\u5b58\u5728:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{screenshot_dir}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;[]<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"=\"<\/span>&nbsp;*&nbsp;<span class=\"code-snippet__number\">60<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"AI \u89c6\u89c9\u5206\u6790\u5f00\u59cb\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"\u622a\u56fe\u76ee\u5f55:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{screenshot_dir}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"\u6a21\u578b:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{model}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"=\"<\/span>&nbsp;*&nbsp;<span class=\"code-snippet__number\">60<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; all_results = []<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; png_files =&nbsp;<span class=\"code-snippet__built_in\">sorted<\/span>([f&nbsp;<span class=\"code-snippet__keyword\">for<\/span>&nbsp;f&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;os.listdir(screenshot_dir)&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;f.endswith(<span class=\"code-snippet__string\">\".png\"<\/span>)])<\/span><\/code><code><span leaf=\"\"><br  \/><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;<span class=\"code-snippet__keyword\">not<\/span>&nbsp;png_files:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"[WARN] \u76ee\u5f55\u4e2d\u672a\u627e\u5230\u4efb\u4f55\u622a\u56fe\u6587\u4ef6\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;[]<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"\u627e\u5230&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__built_in\">len<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">(png_files)}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;\u5f20\u622a\u56fe\uff0c\u5f00\u59cb\u5206\u6790...\\n\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">for<\/span>&nbsp;i, filename&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;<span class=\"code-snippet__built_in\">enumerate<\/span>(png_files,&nbsp;<span class=\"code-snippet__number\">1<\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; filepath = os.path.join(screenshot_dir, filename)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; info = parse_filename_info(filename)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"[<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{i}<\/span><\/span><span class=\"code-snippet__string\">\/<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__built_in\">len<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">(png_files)}<\/span><\/span><span class=\"code-snippet__string\">] \u5206\u6790:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{filename}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;(<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{info[<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'fold_state'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">]}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;\u6001 \u7b2c&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{info[<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'step'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">]}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;\u6b65)...\"<\/span>)<\/span><\/code><code><span leaf=\"\"><br  \/><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; result = analyze_single_image(filepath, api_url, api_key, model)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; result[<span class=\"code-snippet__string\">\"filename\"<\/span>] = filename<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; result.update(info)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; all_results.append(result)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; icon =&nbsp;<span class=\"code-snippet__string\">\"\u2705\"<\/span>&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;result.get(<span class=\"code-snippet__string\">\"normal\"<\/span>)&nbsp;<span class=\"code-snippet__keyword\">else<\/span>&nbsp;<span class=\"code-snippet__string\">\"\u26a0\ufe0f\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; conf = result.get(<span class=\"code-snippet__string\">\"confidence\"<\/span>,&nbsp;<span class=\"code-snippet__number\">0<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; desc = result.get(<span class=\"code-snippet__string\">\"description\"<\/span>,&nbsp;<span class=\"code-snippet__string\">\"\"<\/span>)[:<span class=\"code-snippet__number\">80<\/span>]<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\" &nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{icon}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;\u6b63\u5e38=<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{result.get(<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'normal'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">)}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;| \u7f6e\u4fe1\u5ea6=<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{conf:<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__number\">.2<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">f}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\" &nbsp;\u63cf\u8ff0:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{desc}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;result.get(<span class=\"code-snippet__string\">\"issues\"<\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">for<\/span>&nbsp;issue&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;result[<span class=\"code-snippet__string\">\"issues\"<\/span>]:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\" &nbsp;\u26a0\ufe0f \u95ee\u9898:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{issue}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u63a7\u5236\u8c03\u7528\u9891\u7387\uff08\u901a\u4e49\u5343\u95ee\u9650\u901f\uff09<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;i &lt;&nbsp;<span class=\"code-snippet__built_in\">len<\/span>(png_files):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; time.sleep(<span class=\"code-snippet__number\">1<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u6c47\u603b\u62a5\u544a<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; total =&nbsp;<span class=\"code-snippet__built_in\">len<\/span>(all_results)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; abnormal =&nbsp;<span class=\"code-snippet__built_in\">sum<\/span>(<span class=\"code-snippet__number\">1<\/span>&nbsp;<span class=\"code-snippet__keyword\">for<\/span>&nbsp;r&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;all_results&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;<span class=\"code-snippet__keyword\">not<\/span>&nbsp;r.get(<span class=\"code-snippet__string\">\"normal\"<\/span>))<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; normal = total - abnormal<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"=\"<\/span>&nbsp;*&nbsp;<span class=\"code-snippet__number\">60<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"\ud83d\udcca \u6298\u53e0\u5c4f\u517c\u5bb9\u6027\u6d4b\u8bd5\u62a5\u544a\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"=\"<\/span>&nbsp;*&nbsp;<span class=\"code-snippet__number\">60<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"\u6d4b\u8bd5\u65f6\u95f4:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{time.strftime(<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'%Y-%m-%d %H:%M:%S'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">)}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"\u622a\u56fe\u603b\u6570:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{total}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;| \u6b63\u5e38:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{normal}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;| \u5f02\u5e38:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{abnormal}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"\u5f02\u5e38\u7387:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{abnormal\/total*<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__number\">100<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">:<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__number\">.1<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">f}<\/span><\/span><span class=\"code-snippet__string\">%\"<\/span>&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;total &gt;&nbsp;<span class=\"code-snippet__number\">0<\/span>&nbsp;<span class=\"code-snippet__keyword\">else<\/span>&nbsp;<span class=\"code-snippet__string\">\"\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"-\"<\/span>&nbsp;*&nbsp;<span class=\"code-snippet__number\">60<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">for<\/span>&nbsp;r&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;all_results:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; icon =&nbsp;<span class=\"code-snippet__string\">\"\u2705\"<\/span>&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;r.get(<span class=\"code-snippet__string\">\"normal\"<\/span>)&nbsp;<span class=\"code-snippet__keyword\">else<\/span>&nbsp;<span class=\"code-snippet__string\">\"\u26a0\ufe0f\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; state_ch =&nbsp;<span class=\"code-snippet__string\">\"\u5c55\u5f00\"<\/span>&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;r.get(<span class=\"code-snippet__string\">\"fold_state\"<\/span>) ==&nbsp;<span class=\"code-snippet__string\">\"unfold\"<\/span>&nbsp;<span class=\"code-snippet__keyword\">else<\/span>&nbsp;<span class=\"code-snippet__string\">\"\u6298\u53e0\"<\/span>&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;r.get(<span class=\"code-snippet__string\">\"fold_state\"<\/span>) ==&nbsp;<span class=\"code-snippet__string\">\"fold\"<\/span>&nbsp;<span class=\"code-snippet__keyword\">else<\/span>&nbsp;r.get(<span class=\"code-snippet__string\">\"fold_state\"<\/span>,&nbsp;<span class=\"code-snippet__string\">\"?\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{icon}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;[<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{state_ch}<\/span><\/span><span class=\"code-snippet__string\">\u6001 \u6b65\u9aa4<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{r.get(<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'step'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">,<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'?'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">)}<\/span><\/span><span class=\"code-snippet__string\">]&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{r[<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'filename'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">]}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\" &nbsp; \u7f6e\u4fe1\u5ea6:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{r.get(<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'confidence'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">,&nbsp;<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__number\">0<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">):<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__number\">.2<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">f}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;|&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{r.get(<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'description'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">,<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">''<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">)[:<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__number\">60<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">]}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;r.get(<span class=\"code-snippet__string\">\"issues\"<\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">for<\/span>&nbsp;issue&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;r[<span class=\"code-snippet__string\">\"issues\"<\/span>]:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\" &nbsp; \u26a0\ufe0f&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{issue}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"=\"<\/span>&nbsp;*&nbsp;<span class=\"code-snippet__number\">60<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u4fdd\u5b58\u62a5\u544a\u6587\u4ef6<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; report_path = REPORT_PATH<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">with<\/span>&nbsp;<span class=\"code-snippet__built_in\">open<\/span>(report_path,&nbsp;<span class=\"code-snippet__string\">\"w\"<\/span>, encoding=<span class=\"code-snippet__string\">\"utf-8\"<\/span>)&nbsp;<span class=\"code-snippet__keyword\">as<\/span>&nbsp;f:\\n &nbsp; &nbsp; &nbsp; &nbsp;f.write(<span class=\"code-snippet__string\">\"\u6298\u53e0\u5c4f\u517c\u5bb9\u6027\u6d4b\u8bd5\u62a5\u544a\\n\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; f.write(<span class=\"code-snippet__string\">f\"\u751f\u6210\u65f6\u95f4:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{time.strftime(<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'%Y-%m-%d %H:%M:%S'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">)}<\/span><\/span><span class=\"code-snippet__string\">\\n\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; f.write(<span class=\"code-snippet__string\">f\"\u622a\u56fe\u76ee\u5f55:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{screenshot_dir}<\/span><\/span><span class=\"code-snippet__string\">\\n\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; f.write(<span class=\"code-snippet__string\">f\"\u6a21\u578b:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{model}<\/span><\/span><span class=\"code-snippet__string\">\\n\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; f.write(<span class=\"code-snippet__string\">f\"\u603b\u622a\u56fe\u6570:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{total}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;| \u6b63\u5e38:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{normal}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;| \u5f02\u5e38:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{abnormal}<\/span><\/span><span class=\"code-snippet__string\">\\n\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; f.write(<span class=\"code-snippet__string\">\"=\"<\/span>&nbsp;*&nbsp;<span class=\"code-snippet__number\">60<\/span>&nbsp;+&nbsp;<span class=\"code-snippet__string\">\"\\n\\n\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">for<\/span>&nbsp;r&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;all_results:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; icon =&nbsp;<span class=\"code-snippet__string\">\"\u2705\"<\/span>&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;r.get(<span class=\"code-snippet__string\">\"normal\"<\/span>)&nbsp;<span class=\"code-snippet__keyword\">else<\/span>&nbsp;<span class=\"code-snippet__string\">\"\u26a0\ufe0f\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; state_ch =&nbsp;<span class=\"code-snippet__string\">\"\u5c55\u5f00\"<\/span>&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;r.get(<span class=\"code-snippet__string\">\"fold_state\"<\/span>) ==&nbsp;<span class=\"code-snippet__string\">\"unfold\"<\/span>&nbsp;<span class=\"code-snippet__keyword\">else<\/span>&nbsp;<span class=\"code-snippet__string\">\"\u6298\u53e0\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; f.write(<span class=\"code-snippet__string\">f\"<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{icon}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;[<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{state_ch}<\/span><\/span><span class=\"code-snippet__string\">\u6001 \u6b65\u9aa4<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{r.get(<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'step'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">,<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'?'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">)}<\/span><\/span><span class=\"code-snippet__string\">]&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{r[<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'filename'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">]}<\/span><\/span><span class=\"code-snippet__string\">\\n\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; f.write(<span class=\"code-snippet__string\">f\" &nbsp;\u7f6e\u4fe1\u5ea6:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{r.get(<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'confidence'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">,&nbsp;<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__number\">0<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">):<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__number\">.2<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">f}<\/span><\/span><span class=\"code-snippet__string\">\\n\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; f.write(<span class=\"code-snippet__string\">f\" &nbsp;\u63cf\u8ff0:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{r.get(<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'description'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">,&nbsp;<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">''<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">)}<\/span><\/span><span class=\"code-snippet__string\">\\n\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;r.get(<span class=\"code-snippet__string\">\"issues\"<\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">for<\/span>&nbsp;issue&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;r[<span class=\"code-snippet__string\">\"issues\"<\/span>]:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; f.write(<span class=\"code-snippet__string\">f\" &nbsp;\u95ee\u9898:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{issue}<\/span><\/span><span class=\"code-snippet__string\">\\n\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; f.write(<span class=\"code-snippet__string\">\"\\n\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; f.write(<span class=\"code-snippet__string\">\"\\n\"<\/span>&nbsp;+&nbsp;<span class=\"code-snippet__string\">\"=\"<\/span>&nbsp;*&nbsp;<span class=\"code-snippet__number\">60<\/span>&nbsp;+&nbsp;<span class=\"code-snippet__string\">\"\\n\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; f.write(<span class=\"code-snippet__string\">\"\u5f02\u5e38\u622a\u56fe\u6e05\u5355\uff1a\\n\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">for<\/span>&nbsp;r&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;all_results:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;<span class=\"code-snippet__keyword\">not<\/span>&nbsp;r.get(<span class=\"code-snippet__string\">\"normal\"<\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; state_ch =&nbsp;<span class=\"code-snippet__string\">\"\u5c55\u5f00\"<\/span>&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;r.get(<span class=\"code-snippet__string\">\"fold_state\"<\/span>) ==&nbsp;<span class=\"code-snippet__string\">\"unfold\"<\/span>&nbsp;<span class=\"code-snippet__keyword\">else<\/span>&nbsp;<span class=\"code-snippet__string\">\"\u6298\u53e0\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; f.write(<span class=\"code-snippet__string\">f\" &nbsp;\u26a0\ufe0f&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{r[<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'filename'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">]}<\/span><\/span><span class=\"code-snippet__string\">\uff08<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{state_ch}<\/span><\/span><span class=\"code-snippet__string\">\u6001 \u7b2c<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{r.get(<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'step'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">,<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'?'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">)}<\/span><\/span><span class=\"code-snippet__string\">\u6b65\uff09\\n\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"\\n\ud83d\udcc4 \u62a5\u544a\u5df2\u4fdd\u5b58:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{report_path}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;all_results<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">if<\/span>&nbsp;__name__ ==&nbsp;<span class=\"code-snippet__string\">\"__main__\"<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u76f4\u63a5\u8fd0\u884c\uff1a\u5206\u6790 screenshots \u76ee\u5f55\u4e2d\u7684\u6240\u6709\u622a\u56fe<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; analyze_all_screenshots()<\/span><\/code><\/pre>\n<\/section>\n<section><span leaf=\"\"><br  \/><\/span><\/section>\n<hr style=\"border-style: solid;border-width: 1px 0 0;border-color: rgba(0,0,0,0.1);-webkit-transform-origin: 0 0;-webkit-transform: scale(1, 0.5);transform-origin: 0 0;transform: scale(1, 0.5);\"  \/>\n<p data-pm-slice=\"0 0 []\"><span style=\"box-sizing: border-box;margin: 0px;padding: 3px 10px;font-size: 0.75rem;background: rgba(255, 255, 255, 0.25);border-radius: 99px;letter-spacing: 1px;font-weight: 700;\"><span leaf=\"\"><br  \/><\/span><\/span><\/p>\n<p data-pm-slice=\"0 0 []\"><span><span leaf=\"\" style=\"box-sizing: border-box;margin: 0px;padding: 3px 10px;font-size: 0.75rem;background: rgba(255, 255, 255, 0.25);border-radius: 99px;letter-spacing: 1px;font-weight: 700;\"><span textstyle=\"\" style=\"font-size: 18px;color: #d6a841;font-weight: bold;\">\u7b2c\u4e03\u7ae0&nbsp;<\/span><span textstyle=\"\" style=\"font-size: 17px;color: #0052ff;font-weight: bold;\">\u5b8c\u6574\u811a\u672c\uff1aAndroid+HarmonyOS\u53cc\u7248\u672c+AI\u5206\u6790\u5168\u6d41\u7a0b<\/span><\/span><\/span><\/p>\n<p style=\"box-sizing: border-box;margin: 0px 0px 14px;padding: 0px;line-height: 1.9;color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: medium;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u4e3a\u4e86\u65b9\u4fbf\u8bfb\u8005\u76f4\u63a5\u4f7f\u7528\uff0c\u672c\u7ae0\u628a\u524d\u9762\u5404\u7ae0\u7684\u4ee3\u7801\u6574\u5408\u6210\u4e24\u4e2a\u5b8c\u6574\u7684\u72ec\u7acb\u6587\u4ef6\uff0c\u5e76\u7ed9\u51fa\u5177\u4f53\u7684\u4f7f\u7528\u6b65\u9aa4\u3002\u4e24\u4e2a\u6587\u4ef6\u5206\u522b\u5bf9\u5e94 Android \u548c HarmonyOS \u5e73\u53f0\uff0c\u8fd0\u884c\u540e\u81ea\u52a8\u5b8c\u6210\uff1a\u6298\u53e0\u72b6\u6001\u63a7\u5236 \u2192 \u6267\u884c\u6d4b\u8bd5 \u2192 AI \u89c6\u89c9\u5206\u6790 \u2192 \u8f93\u51fa\u62a5\u544a\u3002<\/span><\/p>\n<h3 style=\"box-sizing: border-box;margin: 24px 0px 12px;padding: 0px;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\" style=\"box-sizing: border-box;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span textstyle=\"\" style=\"font-size: 16px;color: #7a4fd6;\">7.1 Android \u5b8c\u6574\u811a\u672c<\/span><\/span><\/h3>\n<p style=\"box-sizing: border-box;margin: 0px 0px 14px;padding: 0px;line-height: 1.9;color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: medium;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u4fdd\u5b58\u4e3a&nbsp;<\/span><code style=\"box-sizing: border-box;margin: 0px;padding: 1px 6px;background: rgb(241, 245, 249);border: 1px solid rgb(226, 232, 240);border-radius: 4px;font-size: 0.88em;color: rgb(99, 102, 241);font-family: &quot;Cascadia Code&quot;, &quot;Fira Code&quot;, monospace;\"><span leaf=\"\">foldable_test_android.py<\/span><\/code><span leaf=\"\">\uff0c\u4fee\u6539\u914d\u7f6e\u533a\u7684 5 \u4e2a\u53c2\u6570\u540e\u76f4\u63a5\u8fd0\u884c\uff1a<\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"576\">\n<h4 style=\"box-sizing: border-box;margin: 0px 0px 8px;padding: 0px;font-size: medium;color: rgb(22, 101, 52);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\">\u9700\u8981\u4fee\u6539\u7684\u914d\u7f6e\u9879\uff08\u5171 5 \u5904\uff09<\/span><\/h4>\n<ol style=\"box-sizing: border-box;margin: 8px 0px 14px 24px;padding: 0px;color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: medium;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" class=\"list-paddingleft-1\">\n<li style=\"box-sizing: border-box;margin: 0px 0px 6px;padding: 0px;line-height: 1.8;\"><code style=\"box-sizing: border-box;margin: 0px;padding: 1px 6px;background: rgb(241, 245, 249);border: 1px solid rgb(226, 232, 240);border-radius: 4px;font-size: 0.88em;color: rgb(99, 102, 241);font-family: &quot;Cascadia Code&quot;, &quot;Fira Code&quot;, monospace;\"><span leaf=\"\">ANDROID_DEVICE_ADDR<\/span><\/code><br \/>\n<section><span leaf=\"\">\uff1aADB \u8bbe\u5907\u5730\u5740\uff08\u6267\u884c&nbsp;<\/span><code style=\"box-sizing: border-box;margin: 0px;padding: 1px 6px;background: rgb(241, 245, 249);border: 1px solid rgb(226, 232, 240);border-radius: 4px;font-size: 0.88em;color: rgb(99, 102, 241);font-family: &quot;Cascadia Code&quot;, &quot;Fira Code&quot;, monospace;\"><span leaf=\"\">adb devices<\/span><\/code><span leaf=\"\">&nbsp;\u67e5\u5230\uff09<\/span><\/section>\n<\/li>\n<li style=\"box-sizing: border-box;margin: 0px 0px 6px;padding: 0px;line-height: 1.8;\"><code style=\"box-sizing: border-box;margin: 0px;padding: 1px 6px;background: rgb(241, 245, 249);border: 1px solid rgb(226, 232, 240);border-radius: 4px;font-size: 0.88em;color: rgb(99, 102, 241);font-family: &quot;Cascadia Code&quot;, &quot;Fira Code&quot;, monospace;\"><span leaf=\"\">ORIGINAL_RESOLUTION<\/span><\/code><br \/>\n<section><span leaf=\"\">&nbsp;\/&nbsp;<\/span><code style=\"box-sizing: border-box;margin: 0px;padding: 1px 6px;background: rgb(241, 245, 249);border: 1px solid rgb(226, 232, 240);border-radius: 4px;font-size: 0.88em;color: rgb(99, 102, 241);font-family: &quot;Cascadia Code&quot;, &quot;Fira Code&quot;, monospace;\"><span leaf=\"\">FOLDED_RESOLUTION<\/span><\/code><span leaf=\"\">\uff1a\u4f60\u7684\u6298\u53e0\u5c4f\u5b9e\u9645\u5206\u8fa8\u7387\uff08\u6267\u884c&nbsp;<\/span><code style=\"box-sizing: border-box;margin: 0px;padding: 1px 6px;background: rgb(241, 245, 249);border: 1px solid rgb(226, 232, 240);border-radius: 4px;font-size: 0.88em;color: rgb(99, 102, 241);font-family: &quot;Cascadia Code&quot;, &quot;Fira Code&quot;, monospace;\"><span leaf=\"\">adb shell wm size<\/span><\/code><span leaf=\"\">&nbsp;\u67e5\u5230\uff09<\/span><\/section>\n<\/li>\n<li style=\"box-sizing: border-box;margin: 0px 0px 6px;padding: 0px;line-height: 1.8;\"><code style=\"box-sizing: border-box;margin: 0px;padding: 1px 6px;background: rgb(241, 245, 249);border: 1px solid rgb(226, 232, 240);border-radius: 4px;font-size: 0.88em;color: rgb(99, 102, 241);font-family: &quot;Cascadia Code&quot;, &quot;Fira Code&quot;, monospace;\"><span leaf=\"\">AI_API_KEY<\/span><\/code><br \/>\n<section><span leaf=\"\">\uff1a\u901a\u4e49\u5343\u95ee API Key\uff08\u524d\u5f80 dashscope.console.aliyun.com \u7533\u8bf7\uff09<\/span><\/section>\n<\/li>\n<li style=\"box-sizing: border-box;margin: 0px 0px 6px;padding: 0px;line-height: 1.8;\"><code style=\"box-sizing: border-box;margin: 0px;padding: 1px 6px;background: rgb(241, 245, 249);border: 1px solid rgb(226, 232, 240);border-radius: 4px;font-size: 0.88em;color: rgb(99, 102, 241);font-family: &quot;Cascadia Code&quot;, &quot;Fira Code&quot;, monospace;\"><span leaf=\"\">SCREENSHOT_DIR<\/span><\/code><br \/>\n<section><span leaf=\"\">\uff1a\u622a\u56fe\u4fdd\u5b58\u76ee\u5f55\uff08\u4efb\u610f\u8def\u5f84\uff09<\/span><\/section>\n<\/li>\n<li style=\"box-sizing: border-box;margin: 0px 0px 6px;padding: 0px;line-height: 1.8;\">\n<section><span leaf=\"\">\u641c\u7d22\u6846\u5b9a\u4f4d\u5668\uff1a\u6839\u636e\u5f53\u524d\u6296\u97f3\u7248\u672c\u7528 Appium Inspector \u91cd\u65b0\u6293\u53d6<\/span><\/section>\n<\/li>\n<\/ol>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3 style=\"box-sizing: border-box;margin: 24px 0px 12px;padding: 0px;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\" style=\"box-sizing: border-box;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span textstyle=\"\" style=\"font-size: 16px;color: #7a4fd6;\">7.2 Har<\/span><\/span><span leaf=\"\" style=\"box-sizing: border-box;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span textstyle=\"\" style=\"font-size: 16px;color: #7a4fd6;\">monyOS \u5b8c\u6574<\/span><\/span><span leaf=\"\" style=\"box-sizing: border-box;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span textstyle=\"\" style=\"font-size: 16px;color: #7a4fd6;\">\u811a\u672c<\/span><\/span><\/h3>\n<p style=\"box-sizing: border-box;margin: 0px 0px 14px;padding: 0px;line-height: 1.9;color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: medium;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u4fdd\u5b58\u4e3a&nbsp;<\/span><code style=\"box-sizing: border-box;margin: 0px;padding: 1px 6px;background: rgb(241, 245, 249);border: 1px solid rgb(226, 232, 240);border-radius: 4px;font-size: 0.88em;color: rgb(99, 102, 241);font-family: &quot;Cascadia Code&quot;, &quot;Fira Code&quot;, monospace;\"><span leaf=\"\">foldable_test_harmony.py<\/span><\/code><span leaf=\"\">\uff0c\u4fee\u6539\u914d\u7f6e\u533a\u7684 4 \u4e2a\u53c2\u6570\u540e\u76f4\u63a5\u8fd0\u884c\uff1a<\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"576\">\n<h4 style=\"box-sizing: border-box;margin: 0px 0px 8px;padding: 0px;font-size: medium;color: rgb(22, 101, 52);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\">\u9700\u8981\u4fee\u6539\u7684\u914d\u7f6e\u9879\uff08\u5171 4 \u5904\uff09<\/span><\/h4>\n<ol style=\"box-sizing: border-box;margin: 8px 0px 14px 24px;padding: 0px;color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: medium;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" class=\"list-paddingleft-1\">\n<li style=\"box-sizing: border-box;margin: 0px 0px 6px;padding: 0px;line-height: 1.8;\"><code style=\"box-sizing: border-box;margin: 0px;padding: 1px 6px;background: rgb(241, 245, 249);border: 1px solid rgb(226, 232, 240);border-radius: 4px;font-size: 0.88em;color: rgb(99, 102, 241);font-family: &quot;Cascadia Code&quot;, &quot;Fira Code&quot;, monospace;\"><span leaf=\"\">HDC_PATH<\/span><\/code><br \/>\n<section><span leaf=\"\">\uff1ahdc.exe \u7684\u5b9e\u9645\u8def\u5f84\uff08DevEco Studio \u5b89\u88c5\u76ee\u5f55\u4e0b\uff09<\/span><\/section>\n<\/li>\n<li style=\"box-sizing: border-box;margin: 0px 0px 6px;padding: 0px;line-height: 1.8;\"><code style=\"box-sizing: border-box;margin: 0px;padding: 1px 6px;background: rgb(241, 245, 249);border: 1px solid rgb(226, 232, 240);border-radius: 4px;font-size: 0.88em;color: rgb(99, 102, 241);font-family: &quot;Cascadia Code&quot;, &quot;Fira Code&quot;, monospace;\"><span leaf=\"\">HARMONY_DEVICE_ID<\/span><\/code><br \/>\n<section><span leaf=\"\">\uff1a\u591a\u8bbe\u5907\u65f6\u586b\u5165\uff08\u5355\u8bbe\u5907\u7559\u7a7a\u81ea\u52a8\u5339\u914d\uff09<\/span><\/section>\n<\/li>\n<li style=\"box-sizing: border-box;margin: 0px 0px 6px;padding: 0px;line-height: 1.8;\"><code style=\"box-sizing: border-box;margin: 0px;padding: 1px 6px;background: rgb(241, 245, 249);border: 1px solid rgb(226, 232, 240);border-radius: 4px;font-size: 0.88em;color: rgb(99, 102, 241);font-family: &quot;Cascadia Code&quot;, &quot;Fira Code&quot;, monospace;\"><span leaf=\"\">DOUYIN_BUNDLE_NAME<\/span><\/code><br \/>\n<section><span leaf=\"\">\uff1a\u9e3f\u8499\u7248\u6296\u97f3\u5305\u540d\uff08\u53ef\u80fd\u4e0e Android \u4e0d\u540c\uff09<\/span><\/section>\n<\/li>\n<li style=\"box-sizing: border-box;margin: 0px 0px 6px;padding: 0px;line-height: 1.8;\"><code style=\"box-sizing: border-box;margin: 0px;padding: 1px 6px;background: rgb(241, 245, 249);border: 1px solid rgb(226, 232, 240);border-radius: 4px;font-size: 0.88em;color: rgb(99, 102, 241);font-family: &quot;Cascadia Code&quot;, &quot;Fira Code&quot;, monospace;\"><span leaf=\"\">AI_API_KEY<\/span><\/code><br \/>\n<section><span leaf=\"\">\uff1a\u901a\u4e49\u5343\u95ee API Key<\/span><\/section>\n<\/li>\n<\/ol>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3 style=\"box-sizing: border-box;margin: 24px 0px 12px;padding: 0px;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\" style=\"box-sizing: border-box;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span textstyle=\"\" style=\"font-size: 16px;color: #7a4fd6;\">7.<\/span><\/span><span leaf=\"\" style=\"box-sizing: border-box;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span textstyle=\"\" style=\"font-size: 16px;color: #7a4fd6;\">3<\/span><\/span><span leaf=\"\" style=\"box-sizing: border-box;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span textstyle=\"\" style=\"font-size: 16px;color: #7a4fd6;\">&nbsp;\u4e00\u952e\u8fd0\u884c\u811a\u672c<\/span><\/span><\/h3>\n<p style=\"box-sizing: border-box;margin: 0px 0px 14px;padding: 0px;line-height: 1.9;color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: medium;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u521b\u5efa\u8fd0\u884c\u811a\u672c&nbsp;<\/span><code style=\"box-sizing: border-box;margin: 0px;padding: 1px 6px;background: rgb(241, 245, 249);border: 1px solid rgb(226, 232, 240);border-radius: 4px;font-size: 0.88em;color: rgb(99, 102, 241);font-family: &quot;Cascadia Code&quot;, &quot;Fira Code&quot;, monospace;\"><span leaf=\"\">run_test.bat<\/span><\/code><span leaf=\"\">\uff08Windows\uff09\uff0c\u4e00\u952e\u542f\u52a8 Appium + \u8fd0\u884c\u6d4b\u8bd5\uff1a<\/span><\/p>\n<p><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;background-color: #00d5ff;color: #ffffff;font-weight: bold;\">run_test.bat \u2014 \u4e00\u952e\u542f\u52a8\u6d4b\u8bd5<\/span><\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"bash\"><code><span leaf=\"\">@<span class=\"code-snippet__built_in\">echo<\/span>&nbsp;off<\/span><\/code><code><span leaf=\"\">chcp 65001 &gt;nul<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__built_in\">echo<\/span>&nbsp;========================================<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__built_in\">echo<\/span>&nbsp; \u6298\u53e0\u5c4f\u517c\u5bb9\u6027\u6d4b\u8bd5\u4e00\u952e\u8fd0\u884c\u811a\u672c<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__built_in\">echo<\/span>&nbsp;========================================<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__built_in\">echo<\/span>.<\/span><\/code><code><span leaf=\"\">:: \u542f\u52a8 Appium Server\uff08\u540e\u53f0\u8fd0\u884c\uff09<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__built_in\">echo<\/span>&nbsp;[1\/3] \u542f\u52a8 Appium Server...<\/span><\/code><code><span leaf=\"\">start&nbsp;<span class=\"code-snippet__string\">\"Appium\"<\/span>&nbsp;cmd \/c&nbsp;<span class=\"code-snippet__string\">\"appium --allow-cors\"<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__built_in\">timeout<\/span>&nbsp;\/t 5 \/nobreak &gt;nul<\/span><\/code><code><span leaf=\"\">:: \u9009\u62e9\u6d4b\u8bd5\u5e73\u53f0<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__built_in\">echo<\/span>.<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__built_in\">echo<\/span>&nbsp;\u8bf7\u9009\u62e9\u6d4b\u8bd5\u5e73\u53f0\uff1a<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__built_in\">echo<\/span>&nbsp; &nbsp;1 - Android<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__built_in\">echo<\/span>&nbsp; &nbsp;2 - HarmonyOS<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__built_in\">echo<\/span>&nbsp; &nbsp;3 - \u5168\u90e8\uff08\u5148 Android \u540e HarmonyOS\uff09<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__built_in\">set<\/span>&nbsp;\/p choice=\u8bf7\u8f93\u5165\u9009\u9879\uff081\/2\/3\uff09:<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">if<\/span>&nbsp;<span class=\"code-snippet__string\">\"%choice%\"<\/span>==<span class=\"code-snippet__string\">\"1\"<\/span>&nbsp;(<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">echo<\/span>.<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">echo<\/span>&nbsp;[2\/3] \u8fd0\u884c Android \u6298\u53e0\u5c4f\u6d4b\u8bd5...<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; python&nbsp;<span class=\"code-snippet__string\">\"%~dp0foldable_test_android.py\"<\/span><\/span><\/code><code><span leaf=\"\">)&nbsp;<span class=\"code-snippet__keyword\">else<\/span>&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;<span class=\"code-snippet__string\">\"%choice%\"<\/span>==<span class=\"code-snippet__string\">\"2\"<\/span>&nbsp;(<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">echo<\/span>.<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">echo<\/span>&nbsp;[2\/3] \u8fd0\u884c HarmonyOS \u6298\u53e0\u5c4f\u6d4b\u8bd5...<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; python&nbsp;<span class=\"code-snippet__string\">\"%~dp0foldable_test_harmony.py\"<\/span><\/span><\/code><code><span leaf=\"\">)&nbsp;<span class=\"code-snippet__keyword\">else<\/span>&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;<span class=\"code-snippet__string\">\"%choice%\"<\/span>==<span class=\"code-snippet__string\">\"3\"<\/span>&nbsp;(<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">echo<\/span>.<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">echo<\/span>&nbsp;[2\/3] \u8fd0\u884c Android \u6298\u53e0\u5c4f\u6d4b\u8bd5...<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; python&nbsp;<span class=\"code-snippet__string\">\"%~dp0foldable_test_android.py\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">echo<\/span>.<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">echo<\/span>&nbsp;[3\/3] \u8fd0\u884c HarmonyOS \u6298\u53e0\u5c4f\u6d4b\u8bd5...<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; python&nbsp;<span class=\"code-snippet__string\">\"%~dp0foldable_test_harmony.py\"<\/span><\/span><\/code><code><span leaf=\"\">)&nbsp;<span class=\"code-snippet__keyword\">else<\/span>&nbsp;(<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">echo<\/span>&nbsp;[ERROR] \u65e0\u6548\u9009\u9879\uff0c\u8bf7\u8f93\u5165 1\u30012 \u6216 3<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; pause<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">exit<\/span>&nbsp;\/b 1<\/span><\/code><code><span leaf=\"\">)<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__built_in\">echo<\/span>.<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__built_in\">echo<\/span>&nbsp;========================================<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__built_in\">echo<\/span>&nbsp; \u6d4b\u8bd5\u5b8c\u6210\uff01\u62a5\u544a\u4fdd\u5b58\u5728\u622a\u56fe\u76ee\u5f55\u4e0b\u7684 test_report.txt<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__built_in\">echo<\/span>&nbsp;========================================<\/span><\/code><code><span leaf=\"\">pause<\/span><\/code><\/pre>\n<\/section>\n<section><span leaf=\"\"><br  \/><\/span><\/section>\n<hr style=\"border-style: solid;border-width: 1px 0 0;border-color: rgba(0,0,0,0.1);-webkit-transform-origin: 0 0;-webkit-transform: scale(1, 0.5);transform-origin: 0 0;transform: scale(1, 0.5);\"  \/>\n<section><span style=\"box-sizing: border-box;margin: 0px;padding: 3px 10px;font-size: 0.75rem;background: rgba(255, 255, 255, 0.25);border-radius: 99px;letter-spacing: 1px;font-weight: 700;color: rgb(255, 255, 255);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\"><br  \/><\/span><\/span><\/section>\n<section><span data-pm-slice=\"0 0 []\"><span leaf=\"\" style=\"box-sizing: border-box;margin: 0px;padding: 3px 10px;font-size: 0.75rem;background: rgba(255, 255, 255, 0.25);border-radius: 99px;letter-spacing: 1px;font-weight: 700;\"><span textstyle=\"\" style=\"font-size: 18px;color: #d6a841;font-weight: bold;\">\u7b2c\u516b\u7ae0<\/span><span textstyle=\"\" style=\"font-size: 17px;color: #0052ff;font-weight: bold;\">&nbsp;\u5e38\u89c1\u95ee\u9898\u4e0e\u7ef4\u62a4\u6307\u5357<\/span><\/span><\/span><\/section>\n<h3 style=\"box-sizing: border-box;margin: 24px 0px 12px;padding: 0px;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\" style=\"box-sizing: border-box;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span textstyle=\"\" style=\"font-size: 16px;color: #7a4fd6;\">8.1 \u6298\u53e0\u72b6\u6001\u63a7\u5236\u95ee\u9898<\/span><\/span><\/h3>\n<table style=\"box-sizing: border-box;margin: 16px 0px;padding: 0px;width: 864px;border-collapse: collapse;font-size: 0.9rem;color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\">\n<tbody>\n<tr style=\"box-sizing: border-box;margin: 0px;padding: 0px;\">\n<th style=\"box-sizing: border-box;margin: 0px;padding: 10px 14px;background: none 0% 0% \/ auto repeat scroll padding-box border-box rgb(15, 23, 42);color: rgb(255, 255, 255);text-align: left;font-weight: 700;\">\n<section style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;color: #d6a841;\">\u95ee\u9898<\/span><\/span><\/section>\n<\/th>\n<th style=\"box-sizing: border-box;margin: 0px;padding: 10px 14px;background: none 0% 0% \/ auto repeat scroll padding-box border-box rgb(15, 23, 42);color: rgb(255, 255, 255);text-align: left;font-weight: 700;\">\n<section style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;color: #d6a841;\">\u539f\u56e0<\/span><\/span><\/section>\n<\/th>\n<th style=\"box-sizing: border-box;margin: 0px;padding: 10px 14px;background: none 0% 0% \/ auto repeat scroll padding-box border-box rgb(15, 23, 42);color: rgb(255, 255, 255);text-align: left;font-weight: 700;\">\n<section style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;color: #d6a841;\">\u89e3\u51b3\u65b9\u6848<\/span><\/span><\/section>\n<\/th>\n<\/tr>\n<tr style=\"box-sizing: border-box;margin: 0px;padding: 0px;\">\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);background: rgb(248, 250, 252);font-family: monospace;color: rgb(220, 38, 38);font-size: 0.85rem;\">\n<section><span leaf=\"\">adb shell wm size \u62a5\u9519 permission denied<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);background: rgb(248, 250, 252);\">\n<section><span leaf=\"\">\u666e\u901a\u5e94\u7528\u65e0\u6cd5\u4fee\u6539\u7cfb\u7edf\u5206\u8fa8\u7387<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);background: rgb(248, 250, 252);\">\n<section><span leaf=\"\">\u8bbe\u5907\u9700\u8981 root \u6743\u9650\uff1b\u6216\u4f7f\u7528\u5382\u5546\u63d0\u4f9b\u7684\u6298\u53e0\u63a7\u5236 API\uff08\u5982\u534e\u4e3a HiCar SDK\uff09<\/span><\/section>\n<\/td>\n<\/tr>\n<tr style=\"box-sizing: border-box;margin: 0px;padding: 0px;\">\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);font-family: monospace;color: rgb(220, 38, 38);font-size: 0.85rem;\">\n<section><span leaf=\"\">\u5206\u8fa8\u7387\u5207\u6362\u540e\u5e94\u7528\u672a\u91cd\u65b0\u5e03\u5c40<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);\">\n<section><span leaf=\"\">\u5e94\u7528\u672a\u76d1\u542c configuration changed<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);\">\n<section><span leaf=\"\">\u624b\u52a8\u65cb\u8f6c\u5c4f\u5e55\u89e6\u53d1\u91cd\u65b0\u5e03\u5c40\uff1a<\/span><code style=\"box-sizing: border-box;margin: 0px;padding: 1px 6px;background: rgb(241, 245, 249);border: 1px solid rgb(226, 232, 240);border-radius: 4px;font-size: 0.88em;color: rgb(99, 102, 241);font-family: &quot;Cascadia Code&quot;, &quot;Fira Code&quot;, monospace;\"><span leaf=\"\">adb shell settings put system user_rotation 1<\/span><\/code><\/section>\n<\/td>\n<\/tr>\n<tr style=\"box-sizing: border-box;margin: 0px;padding: 0px;\">\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);background: rgb(248, 250, 252);font-family: monospace;color: rgb(220, 38, 38);font-size: 0.85rem;\">\n<section><span leaf=\"\">hdc shell bm setDisplayMode \u62a5\u9519<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);background: rgb(248, 250, 252);\">\n<section><span leaf=\"\">\u8bbe\u5907\u578b\u53f7\u4e0d\u652f\u6301\u8be5\u547d\u4ee4<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);background: rgb(248, 250, 252);\">\n<section><span leaf=\"\">\u90e8\u5206\u6298\u53e0\u5c4f\u8bbe\u5907\u6298\u53e0\u72b6\u6001\u5207\u6362\u9700\u901a\u8fc7\u7cfb\u7edf\u8bbe\u7f6e\u624b\u52a8\u64cd\u4f5c\uff0cHDC \u547d\u4ee4\u4ec5\u4f9b\u53c2\u8003<\/span><\/section>\n<\/td>\n<\/tr>\n<tr style=\"box-sizing: border-box;margin: 0px;padding: 0px;\">\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);font-family: monospace;color: rgb(220, 38, 38);font-size: 0.85rem;\">\n<section><span leaf=\"\">\u6298\u53e0\u72b6\u6001\u5207\u6362\u540e Appium \u8fde\u63a5\u65ad\u5f00<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);\">\n<section><span leaf=\"\">\u8bbe\u5907\u5206\u8fa8\u7387\u53d8\u5316\u5bfc\u81f4 Appium session \u5931\u6548<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);\">\n<section><span leaf=\"\">\u5207\u6362\u540e\u91cd\u65b0\u521d\u59cb\u5316 driver\uff08\u811a\u672c\u4e2d\u5df2\u5b9e\u73b0 driver.quit() \u540e\u91cd\u5efa\uff09<\/span><\/section>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3 style=\"box-sizing: border-box;margin: 24px 0px 12px;padding: 0px;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\" style=\"box-sizing: border-box;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span textstyle=\"\" style=\"font-size: 16px;color: #7a4fd6;\">8.2 \u811a\u672c\u6267\u884c\u95ee\u9898<\/span><\/span><\/h3>\n<table style=\"box-sizing: border-box;margin: 16px 0px;padding: 0px;width: 864px;border-collapse: collapse;font-size: 0.9rem;color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\">\n<tbody>\n<tr style=\"box-sizing: border-box;margin: 0px;padding: 0px;\">\n<th style=\"box-sizing: border-box;margin: 0px;padding: 10px 14px;background: none 0% 0% \/ auto repeat scroll padding-box border-box rgb(15, 23, 42);color: rgb(255, 255, 255);text-align: left;font-weight: 700;\">\n<section style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;color: #d6a841;\">\u95ee\u9898<\/span><\/span><\/section>\n<\/th>\n<th style=\"box-sizing: border-box;margin: 0px;padding: 10px 14px;background: none 0% 0% \/ auto repeat scroll padding-box border-box rgb(15, 23, 42);color: rgb(255, 255, 255);text-align: left;font-weight: 700;\">\n<section style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;color: #d6a841;\">\u539f\u56e0<\/span><\/span><\/section>\n<\/th>\n<th style=\"box-sizing: border-box;margin: 0px;padding: 10px 14px;background: none 0% 0% \/ auto repeat scroll padding-box border-box rgb(15, 23, 42);color: rgb(255, 255, 255);text-align: left;font-weight: 700;\">\n<section style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;color: #d6a841;\">\u89e3\u51b3\u65b9\u6848<\/span><\/span><\/section>\n<\/th>\n<\/tr>\n<tr style=\"box-sizing: border-box;margin: 0px;padding: 0px;\">\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);background: rgb(248, 250, 252);font-family: monospace;color: rgb(220, 38, 38);font-size: 0.85rem;\">\n<section><span leaf=\"\">\u5143\u7d20\u5b9a\u4f4d\u8d85\u65f6\uff08ElementNotFound\uff09<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);background: rgb(248, 250, 252);\">\n<section><span leaf=\"\">\u6296\u97f3\u7248\u672c\u66f4\u65b0\uff0cID\/XPath \u53d8\u5316<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);background: rgb(248, 250, 252);\">\n<section><span leaf=\"\">\u7528 Appium Inspector \u91cd\u65b0\u6293\u53d6\u5f53\u524d\u7248\u672c\u7684\u5143\u7d20\u5b9a\u4f4d\u5668<\/span><\/section>\n<\/td>\n<\/tr>\n<tr style=\"box-sizing: border-box;margin: 0px;padding: 0px;\">\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);font-family: monospace;color: rgb(220, 38, 38);font-size: 0.85rem;\">\n<section><span leaf=\"\">Appium Server \u62a5\u9519 Connection refused<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);\">\n<section><span leaf=\"\">Appium \u672a\u542f\u52a8\u6216\u7aef\u53e3\u88ab\u5360\u7528<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);\">\n<section><span leaf=\"\">\u786e\u8ba4 4723 \u7aef\u53e3\u7a7a\u95f2\uff08<\/span><code style=\"box-sizing: border-box;margin: 0px;padding: 1px 6px;background: rgb(241, 245, 249);border: 1px solid rgb(226, 232, 240);border-radius: 4px;font-size: 0.88em;color: rgb(99, 102, 241);font-family: &quot;Cascadia Code&quot;, &quot;Fira Code&quot;, monospace;\"><span leaf=\"\">netstat -ano | findstr 4723<\/span><\/code><span leaf=\"\">\uff09\uff0c\u91cd\u65b0\u542f\u52a8 appium<\/span><\/section>\n<\/td>\n<\/tr>\n<tr style=\"box-sizing: border-box;margin: 0px;padding: 0px;\">\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);background: rgb(248, 250, 252);font-family: monospace;color: rgb(220, 38, 38);font-size: 0.85rem;\">\n<section><span leaf=\"\">\u622a\u56fe\u6587\u4ef6\u5927\u5c0f\u4e3a 0<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);background: rgb(248, 250, 252);\">\n<section><span leaf=\"\">\u622a\u56fe\u5199\u5165\u5931\u8d25\uff08\u78c1\u76d8\u6ee1\u6216\u6743\u9650\u4e0d\u8db3\uff09<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);background: rgb(248, 250, 252);\">\n<section><span leaf=\"\">\u68c0\u67e5\u622a\u56fe\u76ee\u5f55\u662f\u5426\u5b58\u5728\u3001\u662f\u5426\u6709\u5199\u5165\u6743\u9650<\/span><\/section>\n<\/td>\n<\/tr>\n<tr style=\"box-sizing: border-box;margin: 0px;padding: 0px;\">\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);font-family: monospace;color: rgb(220, 38, 38);font-size: 0.85rem;\">\n<section><span leaf=\"\">AI \u5206\u6790 API \u8fd4\u56de 401 Unauthorized<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);\">\n<section><span leaf=\"\">API Key \u9519\u8bef\u6216\u5df2\u8fc7\u671f<\/span><\/section>\n<\/td>\n<td style=\"box-sizing: border-box;margin: 0px;padding: 9px 14px;border-bottom: 1px solid rgb(229, 231, 235);\">\n<section><span leaf=\"\">\u767b\u5f55\u963f\u91cc\u4e91 dashscope \u63a7\u5236\u53f0\uff0c\u91cd\u65b0\u83b7\u53d6 API Key<\/span><\/section>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3 style=\"box-sizing: border-box;margin: 24px 0px 12px;padding: 0px;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\" style=\"box-sizing: border-box;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span textstyle=\"\" style=\"font-size: 16px;color: #7a4fd6;\">8.3 \u5982\u4f55\u6269\u5c55\u6d4b\u8bd5\u573a\u666f<\/span><\/span><\/h3>\n<ol style=\"box-sizing: border-box;margin: 8px 0px 14px 24px;padding: 0px;color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: medium;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" class=\"list-paddingleft-1\">\n<li style=\"box-sizing: border-box;margin: 0px 0px 6px;padding: 0px;line-height: 1.8;\"><strong style=\"box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(15, 23, 42);font-weight: 700;\"><span leaf=\"\">\u6362 APP<\/span><\/strong><br \/>\n<section><span leaf=\"\">\uff1a\u4fee\u6539\u914d\u7f6e\u533a\u7684\u5305\u540d \/ Activity \u548c\u641c\u7d22\u6846\u5b9a\u4f4d\u5668\u5373\u53ef\uff0c\u5176\u4ed6\u4ee3\u7801\u4e0d\u53d8<\/span><\/section>\n<\/li>\n<li style=\"box-sizing: border-box;margin: 0px 0px 6px;padding: 0px;line-height: 1.8;\"><strong style=\"box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(15, 23, 42);font-weight: 700;\"><span leaf=\"\">\u589e\u52a0\u6d4b\u8bd5\u6b65\u9aa4<\/span><\/strong><br \/>\n<section><span leaf=\"\">\uff1a\u5728&nbsp;<\/span><code style=\"box-sizing: border-box;margin: 0px;padding: 1px 6px;background: rgb(241, 245, 249);border: 1px solid rgb(226, 232, 240);border-radius: 4px;font-size: 0.88em;color: rgb(99, 102, 241);font-family: &quot;Cascadia Code&quot;, &quot;Fira Code&quot;, monospace;\"><span leaf=\"\">execute_douyin_steps()<\/span><\/code><span leaf=\"\">&nbsp;\u51fd\u6570\u4e2d\u8ffd\u52a0\u6b65\u9aa4\u51fd\u6570\u8c03\u7528<\/span><\/section>\n<\/li>\n<li style=\"box-sizing: border-box;margin: 0px 0px 6px;padding: 0px;line-height: 1.8;\"><strong style=\"box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(15, 23, 42);font-weight: 700;\"><span leaf=\"\">\u6362 AI \u6a21\u578b<\/span><\/strong><br \/>\n<section><span leaf=\"\">\uff1a\u4fee\u6539&nbsp;<\/span><code style=\"box-sizing: border-box;margin: 0px;padding: 1px 6px;background: rgb(241, 245, 249);border: 1px solid rgb(226, 232, 240);border-radius: 4px;font-size: 0.88em;color: rgb(99, 102, 241);font-family: &quot;Cascadia Code&quot;, &quot;Fira Code&quot;, monospace;\"><span leaf=\"\">AI_VISION_API_URL<\/span><\/code><span leaf=\"\">&nbsp;\u548c&nbsp;<\/span><code style=\"box-sizing: border-box;margin: 0px;padding: 1px 6px;background: rgb(241, 245, 249);border: 1px solid rgb(226, 232, 240);border-radius: 4px;font-size: 0.88em;color: rgb(99, 102, 241);font-family: &quot;Cascadia Code&quot;, &quot;Fira Code&quot;, monospace;\"><span leaf=\"\">AI_MODEL<\/span><\/code><span leaf=\"\">&nbsp;\u53c2\u6570\u5373\u53ef\uff08\u652f\u6301\u901a\u4e49\u5343\u95ee \/ GPT-4V \/ Claude \u7b49\uff09<\/span><\/section>\n<\/li>\n<li style=\"box-sizing: border-box;margin: 0px 0px 6px;padding: 0px;line-height: 1.8;\"><strong style=\"box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(15, 23, 42);font-weight: 700;\"><span leaf=\"\">\u63a5\u5165 CI\/CD<\/span><\/strong><br \/>\n<section><span leaf=\"\">\uff1a\u5c06\u811a\u672c\u6ce8\u518c\u5230 Jenkins \/ GitHub Actions\uff0c\u914d\u7f6e\u89e6\u53d1\u6761\u4ef6\u4e3a\u4ee3\u7801\u5408\u5e76\u540e\u81ea\u52a8\u6267\u884c<\/span><\/section>\n<\/li>\n<\/ol>\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"576\">\n<section>\n<p><strong style=\"box-sizing: border-box;margin: 0px 0px 4px;padding: 0px;color: rgb(15, 23, 42);font-weight: 700;display: block;\"><span leaf=\"\" data-pm-slice=\"1 1 [&quot;para&quot;,{&quot;tagName&quot;:&quot;p&quot;,&quot;attributes&quot;:{},&quot;namespaceURI&quot;:&quot;http:\/\/www.w3.org\/1999\/xhtml&quot;},&quot;node&quot;,{&quot;tagName&quot;:&quot;strong&quot;,&quot;attributes&quot;:{&quot;style&quot;:&quot;box-sizing: border-box; margin: 0px 0px 4px; padding: 0px; color: rgb(15, 23, 42); font-weight: 700; display: block;&quot;},&quot;namespaceURI&quot;:&quot;http:\/\/www.w3.org\/1999\/xhtml&quot;}]\"><span textstyle=\"\" style=\"color: #ff2941;\">\u63a8\u8350\uff1a\u6301\u7eed\u96c6\u6210\u65b9\u6848<\/span><\/span><\/strong><\/p>\n<p><strong style=\"box-sizing: border-box;margin: 0px 0px 4px;padding: 0px;color: rgb(15, 23, 42);font-weight: 700;display: block;\"><span leaf=\"\" data-pm-slice=\"1 1 [&quot;para&quot;,{&quot;tagName&quot;:&quot;p&quot;,&quot;attributes&quot;:{},&quot;namespaceURI&quot;:&quot;http:\/\/www.w3.org\/1999\/xhtml&quot;},&quot;node&quot;,{&quot;tagName&quot;:&quot;strong&quot;,&quot;attributes&quot;:{&quot;style&quot;:&quot;box-sizing: border-box; margin: 0px 0px 4px; padding: 0px; color: rgb(15, 23, 42); font-weight: 700; display: block;&quot;},&quot;namespaceURI&quot;:&quot;http:\/\/www.w3.org\/1999\/xhtml&quot;}]\"><span textstyle=\"\" style=\"font-size: 15px;font-weight: normal;\">\u5c06\u6298\u53e0\u5c4f\u6d4b\u8bd5\u63a5\u5165 CI\/CD \u6d41\u6c34\u7ebf\uff0c\u5efa\u8bae\u6d41\u7a0b\uff1a\u4ee3\u7801\u5408\u5e76 \u2192 \u89e6\u53d1 Jenkins \u2192 \u6267\u884c\u6298\u53e0\u5c4f\u6d4b\u8bd5\u811a\u672c \u2192 AI \u5206\u6790\u62a5\u544a\u751f\u6210 \u2192 \u62a5\u544a\u4e0a\u4f20\u5230 Artifacts \u2192 \u53d1\u9001\u9489\u9489\/\u4f01\u4e1a\u5fae\u4fe1\u901a\u77e5\u3002\u6bcf\u65e5\u6784\u5efa\u81ea\u52a8\u8dd1\u6298\u53e0\u5c4f\u517c\u5bb9\u6027\u6d4b\u8bd5\uff0c\u53d1\u73b0\u5f02\u5e38\u53ca\u65f6\u544a\u8b66\u3002<\/span><\/span><\/strong><\/p>\n<\/section>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong style=\"box-sizing: border-box;margin: 0px 0px 4px;padding: 0px;color: rgb(15, 23, 42);font-weight: 700;display: block;\"><span leaf=\"\"><br  \/><\/span><\/strong><\/p>\n<hr style=\"border-style: solid;border-width: 1px 0 0;border-color: rgba(0,0,0,0.1);-webkit-transform-origin: 0 0;-webkit-transform: scale(1, 0.5);transform-origin: 0 0;transform: scale(1, 0.5);\"  \/>\n<section><span style=\"box-sizing: border-box;margin: 0px;padding: 3px 10px;font-size: 0.75rem;background: rgba(255, 255, 255, 0.25);border-radius: 99px;letter-spacing: 1px;font-weight: 700;color: rgb(255, 255, 255);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\"><br  \/><\/span><\/span><\/section>\n<section><span data-pm-slice=\"0 0 []\"><span leaf=\"\" style=\"box-sizing: border-box;margin: 0px;padding: 3px 10px;font-size: 0.75rem;background: rgba(255, 255, 255, 0.25);border-radius: 99px;letter-spacing: 1px;font-weight: 700;\"><span textstyle=\"\" style=\"font-size: 18px;color: #d6a841;font-weight: bold;\">\u603b\u7ed3<\/span><span textstyle=\"\" style=\"font-size: 17px;color: #0052ff;font-weight: bold;\">&nbsp;\u4e09\u4efd\u6838\u5fc3\u8d44\u4ea7+\u6269\u5c55\u601d\u8def<\/span><\/span><\/span><\/section>\n<p style=\"text-indent: 2em;\"><strong style=\"box-sizing: border-box;margin: 0px 0px 4px;padding: 0px;color: rgb(15, 23, 42);font-weight: 700;display: block;\"><span style=\"color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: medium;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\" data-pm-slice=\"0 0 []\"><span leaf=\"\">\u672c\u6587\u5b8c\u6574\u4ecb\u7ecd\u4e86\u4f7f\u7528\u5927\u6a21\u578b\u89e3\u51b3\u6298\u53e0\u5c4f\u517c\u5bb9\u6027\u6d4b\u8bd5\u7684\u65b9\u6848\uff0c\u4ece AI \u751f\u6210\u811a\u672c\u3001\u6298\u53e0\u72b6\u6001\u63a7\u5236\u3001AI \u89c6\u89c9\u5206\u6790\u4e09\u4e2a\u73af\u8282\u4f9d\u6b21\u5c55\u5f00\uff0c\u7ed9\u51fa\u4e86 Android \u548c HarmonyOS \u4e24\u5957\u5b8c\u6574\u53ef\u8fd0\u884c\u7684\u4ee3\u7801\u3002<\/span><\/span><\/strong><\/p>\n<h4 style=\"box-sizing: border-box;margin: 0px 0px 8px;padding: 0px;font-size: medium;color: rgb(22, 101, 52);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\">\ud83d\udce6 \u672c\u6587\u4ea4\u4ed8\u7684\u4e09\u4efd\u6838\u5fc3\u8d44\u4ea7<\/span><\/h4>\n<ol style=\"box-sizing: border-box;margin: 8px 0px 14px 24px;padding: 0px;color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: medium;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" class=\"list-paddingleft-1\">\n<li style=\"box-sizing: border-box;margin: 0px 0px 6px;padding: 0px;line-height: 1.8;\"><strong style=\"box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(15, 23, 42);font-weight: 700;\"><span leaf=\"\">Android \u5b8c\u6574\u811a\u672c<\/span><\/strong><br \/>\n<section><span leaf=\"\">\uff08foldable_test_android.py\uff09\uff1aADB \u6298\u53e0\u63a7\u5236 + \u6296\u97f3\u56db\u6b65\u64cd\u4f5c + AI \u89c6\u89c9\u5206\u6790\uff0c\u5f00\u7bb1\u5373\u7528<\/span><\/section>\n<\/li>\n<li style=\"box-sizing: border-box;margin: 0px 0px 6px;padding: 0px;line-height: 1.8;\"><strong style=\"box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(15, 23, 42);font-weight: 700;\"><span leaf=\"\">HarmonyOS \u5b8c\u6574\u811a\u672c<\/span><\/strong><br \/>\n<section><span leaf=\"\">\uff08foldable_test_harmony.py\uff09\uff1aHDC \u6298\u53e0\u63a7\u5236 + \u6296\u97f3\u56db\u6b65\u64cd\u4f5c + AI \u89c6\u89c9\u5206\u6790\uff0c\u9002\u914d\u9e3f\u8499\u751f\u6001<\/span><\/section>\n<\/li>\n<li style=\"box-sizing: border-box;margin: 0px 0px 6px;padding: 0px;line-height: 1.8;\"><strong style=\"box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(15, 23, 42);font-weight: 700;\"><span leaf=\"\">AI \u89c6\u89c9\u5206\u6790\u6a21\u5757<\/span><\/strong><br \/>\n<section><span leaf=\"\">\uff08ai_vision_analyzer.py\uff09\uff1a\u53ef\u72ec\u7acb\u8fd0\u884c\uff0c\u5206\u6790\u4efb\u610f\u622a\u56fe\u76ee\u5f55\uff0c\u81ea\u52a8\u8f93\u51fa\u62a5\u544a<\/span><\/section>\n<\/li>\n<\/ol>\n<h3 style=\"box-sizing: border-box;margin: 24px 0px 12px;padding: 0px;font-size: 1.15rem;color: rgb(30, 41, 59);font-weight: 700;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"color: #ff2941;\">\u6269\u5c55\u601d\u8def<\/span><\/span><\/h3>\n<ul style=\"box-sizing: border-box;margin: 8px 0px 14px 24px;padding: 0px;color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: medium;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" class=\"list-paddingleft-1\">\n<li style=\"box-sizing: border-box;margin: 0px 0px 6px;padding: 0px;line-height: 1.8;\"><strong style=\"box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(15, 23, 42);font-weight: 700;\"><span leaf=\"\">\u6362 APP<\/span><\/strong><br \/>\n<section><span leaf=\"\">\uff1a\u5c06\u6296\u97f3\u6362\u6210\u4f60\u4eec\u5b9e\u9645\u7684\u88ab\u6d4b APP\uff0c\u4fee\u6539\u5305\u540d\u548c\u5b9a\u4f4d\u5668\u5373\u53ef<\/span><\/section>\n<\/li>\n<li style=\"box-sizing: border-box;margin: 0px 0px 6px;padding: 0px;line-height: 1.8;\"><strong style=\"box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(15, 23, 42);font-weight: 700;\"><span leaf=\"\">\u6362\u6d4b\u8bd5\u6b65\u9aa4<\/span><\/strong><br \/>\n<section><span leaf=\"\">\uff1a\u5728 Skill \u4e2d\u5b9a\u4e49\u65b0\u7684\u64cd\u4f5c\u6b65\u9aa4\uff0cAI \u81ea\u52a8\u751f\u6210\u5bf9\u5e94\u811a\u672c<\/span><\/section>\n<\/li>\n<li style=\"box-sizing: border-box;margin: 0px 0px 6px;padding: 0px;line-height: 1.8;\"><strong style=\"box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(15, 23, 42);font-weight: 700;\"><span leaf=\"\">\u6362 AI \u6a21\u578b<\/span><\/strong><br \/>\n<section><span leaf=\"\">\uff1a\u5c06\u901a\u4e49\u5343\u95ee\u6362\u6210 GPT-4V \/ Claude Vision\uff0cPrompt \u683c\u5f0f\u7565\u6709\u4e0d\u540c\u4f46\u903b\u8f91\u76f8\u540c<\/span><\/section>\n<\/li>\n<li style=\"box-sizing: border-box;margin: 0px 0px 6px;padding: 0px;line-height: 1.8;\"><strong style=\"box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(15, 23, 42);font-weight: 700;\"><span leaf=\"\">\u63a5 CI\/CD<\/span><\/strong><br \/>\n<section><span leaf=\"\">\uff1a\u6ce8\u518c\u5230 Jenkins \u6216 GitHub Actions\uff0c\u6bcf\u65e5\u6784\u5efa\u81ea\u52a8\u89e6\u53d1\u6298\u53e0\u5c4f\u6d4b\u8bd5<\/span><\/section>\n<\/li>\n<li style=\"box-sizing: border-box;margin: 0px 0px 6px;padding: 0px;line-height: 1.8;\"><strong style=\"box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(15, 23, 42);font-weight: 700;\"><span leaf=\"\">\u591a\u8bbe\u5907\u5e76\u884c<\/span><\/strong><br \/>\n<section><span leaf=\"\">\uff1a\u7528 Python multiprocessing \u540c\u65f6\u63a7\u5236\u591a\u53f0\u8bbe\u5907\uff0c\u6279\u91cf\u6d4b\u8bd5<\/span><\/section>\n<\/li>\n<\/ul>\n<p style=\"box-sizing: border-box;margin: 0px 0px 14px;padding: 0px;line-height: 1.9;color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: medium;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u6298\u53e0\u5c4f\u7684\u788e\u7247\u5316\u95ee\u9898\u662f\u957f\u671f\u6311\u6218\uff0c\u4f46\u901a\u8fc7 AI + \u81ea\u52a8\u5316\u7684\u65b9\u5f0f\uff0c\u53ef\u4ee5\u5c06&#8221;\u6bcf\u6b21\u53d1\u7248\u90fd\u8981\u4eba\u5de5\u6298\u53e0\u6d4b\u8bd5&#8221;\u53d8\u6210&#8221;\u4e00\u952e\u81ea\u52a8\u8dd1\u5b8c\u5168\u90e8\u573a\u666f&#8221;\u3002\u5e0c\u671b\u672c\u6587\u7684\u65b9\u6848\u80fd\u5e2e\u4f60\u628a\u8fd9\u4e2a\u80fd\u529b\u771f\u6b63\u843d\u5730\u3002<\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"576\"><strong style=\"box-sizing: border-box;margin: 0px 0px 4px;padding: 0px;color: rgb(15, 23, 42);font-weight: 700;display: block;font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: medium;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"color: #0052ff;\">\u4e0b\u4e00\u6b65\u5efa\u8bae<\/span><\/span><\/strong><\/p>\n<p style=\"box-sizing: border-box;margin: 0px 0px 14px;padding: 0px;line-height: 1.9;color: rgb(30, 41, 59);font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif;font-size: medium;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u62ff\u4f60\u7684\u6298\u53e0\u5c4f\u8bbe\u5907\uff0c\u6309\u672c\u6587\u6b65\u9aa4\u914d\u7f6e\u73af\u5883\uff0c\u5148\u8dd1\u901a Android \u7248\u811a\u672c\u2014\u2014\u62ff\u5230\u7b2c\u4e00\u4efd AI \u5206\u6790\u62a5\u544a\u540e\uff0c\u4f60\u4f1a\u5bf9\u8fd9\u4e2a\u65b9\u6848\u7684\u4ef7\u503c\u6709\u6700\u76f4\u89c2\u7684\u611f\u53d7\u3002\u7136\u540e\u518d\u8fc1\u79fb\u5230\u4f60\u7684\u5b9e\u9645\u88ab\u6d4b APP\uff0c\u9010\u6b65\u6269\u5927\u6d4b\u8bd5\u8986\u76d6\u9762\u3002<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<section><span leaf=\"\"><br  \/><\/span><\/section>\n<p style=\"display: none;\"><mp-style-type data-value=\"3\"><\/mp-style-type><\/p>\n","protected":false},"excerpt":{"rendered":"<p>AI \u751f\u6210\u81ea\u52a8\u5316\u811a\u672c + ADB \/ HDC \u6298\u53e0\u72b6\u6001\u63a7\u5236 + \u89c6\u89c9 AI \u5206\u6790\u4e00\u5957\u4ee3\u7801\u8dd1\u5b8c\u5c55\u5f00 \/ \u6298\u53e0\u5168\u6d41 [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":104,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-105","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ai"],"_links":{"self":[{"href":"https:\/\/www.deartester.com\/index.php\/wp-json\/wp\/v2\/posts\/105","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.deartester.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.deartester.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.deartester.com\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.deartester.com\/index.php\/wp-json\/wp\/v2\/comments?post=105"}],"version-history":[{"count":2,"href":"https:\/\/www.deartester.com\/index.php\/wp-json\/wp\/v2\/posts\/105\/revisions"}],"predecessor-version":[{"id":204,"href":"https:\/\/www.deartester.com\/index.php\/wp-json\/wp\/v2\/posts\/105\/revisions\/204"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.deartester.com\/index.php\/wp-json\/wp\/v2\/media\/104"}],"wp:attachment":[{"href":"https:\/\/www.deartester.com\/index.php\/wp-json\/wp\/v2\/media?parent=105"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.deartester.com\/index.php\/wp-json\/wp\/v2\/categories?post=105"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.deartester.com\/index.php\/wp-json\/wp\/v2\/tags?post=105"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}