{"id":95,"date":"2026-08-07T00:01:18","date_gmt":"2026-08-06T16:01:18","guid":{"rendered":"https:\/\/www.deartester.com\/index.php\/2026\/08\/07\/%e8%87%aa%e5%8a%a8%e5%8c%96%e8%84%9a%e6%9c%ac%e5%81%b6%e5%8f%91%e5%a4%b1%e8%b4%a5%ef%bc%9f5%e4%b8%aa%e5%ae%9a%e4%bd%8d%e6%80%9d%e8%b7%af%e4%bf%ae%e5%a4%8d%e6%96%b9%e6%a1%88%e5%bd%bb%e5%ba%95%e5%91%8a\/"},"modified":"2026-09-03T23:17:21","modified_gmt":"2026-09-03T15:17:21","slug":"%e8%87%aa%e5%8a%a8%e5%8c%96%e8%84%9a%e6%9c%ac%e5%81%b6%e5%8f%91%e5%a4%b1%e8%b4%a5%ef%bc%9f5%e4%b8%aa%e5%ae%9a%e4%bd%8d%e6%80%9d%e8%b7%af%e4%bf%ae%e5%a4%8d%e6%96%b9%e6%a1%88%e5%bd%bb%e5%ba%95%e5%91%8a","status":"publish","type":"post","link":"https:\/\/www.deartester.com\/index.php\/2026\/08\/07\/%e8%87%aa%e5%8a%a8%e5%8c%96%e8%84%9a%e6%9c%ac%e5%81%b6%e5%8f%91%e5%a4%b1%e8%b4%a5%ef%bc%9f5%e4%b8%aa%e5%ae%9a%e4%bd%8d%e6%80%9d%e8%b7%af%e4%bf%ae%e5%a4%8d%e6%96%b9%e6%a1%88%e5%bd%bb%e5%ba%95%e5%91%8a\/","title":{"rendered":"\u81ea\u52a8\u5316\u811a\u672c\u5076\u53d1\u5931\u8d25\uff1f5\u4e2a\u5b9a\u4f4d\u601d\u8def+\u4fee\u590d\u65b9\u6848\u5f7b\u5e95\u544a\u522b\u6267\u884cFlaky"},"content":{"rendered":"<h2 style=\"margin: 42px 0px 18px;padding: 0px 0px 0px 14px;box-sizing: border-box;font-size: 21px;color: rgb(15, 52, 96);border-left: 5px solid rgb(79, 195, 247);line-height: 1.4;font-weight: 700;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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=\"\">\u5f15\u8a00\uff1a\u90a3\u4e2a\u8ba9\u6211\u5931\u7720\u7684\u5468\u4e94\u665a\u4e0a<\/span><\/h2>\n<p style=\"margin: 14px 0px;padding: 0px;box-sizing: border-box;color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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=\"\">\u4e00\u4e2a\u5468\u672b\u7684\u665a\u4e0a\uff0c\u6211\u8bb0\u5f97\u5f88\u6e05\u695a\u2014\u2014\u5f53\u65f6\u5728\u7ed9\u4e00\u5bb6\u57ce\u5546\u884c\u505a\u6d4b\u8bd5\u6846\u67b6\u5347\u7ea7\uff0c\u4e0a\u7ebf\u524d\u591c\uff0c\u6240\u6709\u7528\u4f8b\u5728CI\u4e0a\u8dd1\u4e86\u4e09\u904d\uff0c\u7ec8\u4e8e\u5168\u90e8\u7eff\u8272\u3002\u677e\u4e86\u53e3\u6c14\uff0c\u5173\u7535\u8111\uff0c\u56de\u5bb6\u5403\u996d<\/span><\/p>\n<p style=\"margin: 14px 0px;padding: 0px;box-sizing: border-box;color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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=\"\">\u5468\u4e00\u65e9\u4e0a\u6253\u5f00\u90ae\u7bb1\uff0c\u770b\u5230\u7684\u662f\u4e00\u7247\u7ea2\u8272\u90ae\u4ef6\u63d0\u9192\u3002\u6211\u8d76\u7d27\u6253\u5f00Jenkins\u770b\u2014\u2014\u4e09\u6761\u7528\u4f8b\u5931\u8d25\u4e86\uff0c\u90fd\u662f\u767b\u5f55\u6a21\u5757\u7684\u3002\u66f4\u8be1\u5f02\u7684\u662f\uff0c\u4e09\u6761\u7528\u4f8b\u7684\u62a5\u9519\u4fe1\u606f\u4e00\u6a21\u4e00\u6837\uff1a<\/span><code style=\"margin: 0px;padding: 0px;box-sizing: border-box;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(255, 41, 65);\">ElementClickInterceptedException: Element &lt;button&gt; was not clickable at point (412, 89)<\/span><\/span><\/code><\/p>\n<p style=\"margin: 14px 0px;padding: 0px;box-sizing: border-box;color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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=\"\">\u6211\u7b2c\u4e00\u53cd\u5e94\u662f\uff1a<span textstyle=\"\" style=\"color: rgb(171, 25, 66);\">\u51fa\u4ec0\u4e48bug\u4e86<\/span><span textstyle=\"\" style=\"color: rgb(0, 0, 0);\">\uff1f<\/span><span textstyle=\"\" style=\"color: rgb(171, 25, 66);\">\u767b\u5f55\u6a21\u5757\u6539\u4ee3\u7801\u4e86<\/span><span textstyle=\"\" style=\"color: rgb(0, 0, 0);\">\uff1f<\/span><\/span><\/p>\n<p style=\"margin: 14px 0px;padding: 0px;box-sizing: border-box;color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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=\"\">\u7ed3\u679c\u67e5\u4e86\u4e00\u5708\uff0c\u4ee3\u7801\u6ca1\u52a8\uff0c\u9875\u9762\u6ca1\u6539\uff0c\u7528\u4f8b\u672c\u8eab\u4e5f\u6ca1\u52a8\u3002<span textstyle=\"\" style=\"color: rgb(2, 30, 170);\">\u672c\u5730\u91cd\u8dd1\u4e00\u6b21\uff0c\u8fc7\u4e86<\/span>\u3002<span textstyle=\"\" style=\"color: rgb(255, 41, 65);\">\u7b2c\u56db\u6b21\u2014\u2014\u53c8\u7ea2\u4e86<\/span><\/span><\/p>\n<p style=\"margin: 14px 0px;padding: 0px;box-sizing: border-box;color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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=\"\">\u6211\u540e\u6765\u7edf\u8ba1\u4e86\u4e00\u4e0b\uff0c\u90a3\u4e09\u6761\u7528\u4f8b\u5728\u7248\u672c\u91cc\uff0c\u5355\u72ec\u8dd1\u7684\u6210\u529f\u7387\u5927\u7ea6\u662f73%\uff0c\u8fde\u7eed\u8dd1\u7684\u6210\u529f\u7387\u53ea\u670941%<\/span><\/p>\n<p style=\"margin: 14px 0px;padding: 0px;box-sizing: border-box;color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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=\"\">\u8fd9\u5c31\u662f\u6211\u5165\u884c\u4ee5\u6765\uff0c\u9047\u5230\u8fc7\u7684\u6700\u5178\u578b\u7684Flaky Test\u6848\u4f8b\u3002\u90a3\u6bb5\u65f6\u95f4\u6211\u51e0\u4e4e\u6bcf\u5929\u90fd\u5728\u60f3\uff1a\u4e3a\u4ec0\u4e48\uff1f\u51ed\u4ec0\u4e48\uff1f\u660e\u660e\u4ee3\u7801\u4e00\u6837\u7684\uff0c\u73af\u5883\u4e5f&#8221;\u4e00\u6837&#8221;\u7684\uff0c\u600e\u4e48\u5c31\u65f6\u597d\u65f6\u574f\uff1f<\/span><\/p>\n<p style=\"margin: 14px 0px;padding: 0px;box-sizing: border-box;color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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=\"\">\u540e\u6765\u6211\u628a\u8fd9\u4ef6\u4e8b\u5f53\u6210\u8bfe\u9898\u6765\u7814\u7a76\uff0c\u7ffb\u4e86\u5927\u91cf\u8bba\u6587<span textstyle=\"\" style=\"font-size: 12px;\">\uff08Google 2019\u7684\u4e00\u7bc7<\/span><span textstyle=\"\" style=\"font-size: 12px;color: rgb(2, 30, 170);\">\u300aAn Empirical Analysis of&nbsp;<\/span><\/span><span leaf=\"\" data-pm-slice=\"1 1 [&quot;para&quot;,{&quot;tagName&quot;:&quot;p&quot;,&quot;attributes&quot;:{&quot;style&quot;:&quot;margin: 14px 0px; padding: 0px; box-sizing: border-box; color: rgb(51, 51, 51); font-size: 15px; font-family: -apple-system, \\&quot;PingFang SC\\&quot;, \\&quot;Microsoft YaHei\\&quot;, \\&quot;Helvetica Neue\\&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;&quot;},&quot;namespaceURI&quot;:&quot;http:\/\/www.w3.org\/1999\/xhtml&quot;}]\"><span textstyle=\"\" style=\"font-size: 12px;\">Flaky<\/span>&nbsp;<span textstyle=\"\" style=\"font-size: 12px;color: rgb(2, 30, 170);\">Tests\u300b<\/span><span textstyle=\"\" style=\"font-size: 12px;\">\u6211\u73b0\u5728\u8fd8\u80fd\u80cc\u51fa\u5173\u952e\u6570\u636e\uff1a<\/span><span textstyle=\"\" style=\"font-size: 12px;text-decoration: underline;\">\u6240\u6709\u5931\u8d25\u7684\u6d4b\u8bd5\u6267\u884c\u91cc\uff0c\u670916%\u5176\u5b9e<\/span><\/span><span leaf=\"\" data-pm-slice=\"1 1 [&quot;para&quot;,{&quot;tagName&quot;:&quot;p&quot;,&quot;attributes&quot;:{&quot;style&quot;:&quot;margin: 14px 0px; padding: 0px; box-sizing: border-box; color: rgb(51, 51, 51); font-size: 15px; font-family: -apple-system, \\&quot;PingFang SC\\&quot;, \\&quot;Microsoft YaHei\\&quot;, \\&quot;Helvetica Neue\\&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;&quot;},&quot;namespaceURI&quot;:&quot;http:\/\/www.w3.org\/1999\/xhtml&quot;}]\" style=\"box-sizing: border-box;color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span textstyle=\"\" style=\"font-size: 12px;text-decoration: underline;\">\u662f<\/span><\/span><span leaf=\"\" data-pm-slice=\"1 1 [&quot;para&quot;,{&quot;tagName&quot;:&quot;p&quot;,&quot;attributes&quot;:{&quot;style&quot;:&quot;margin: 14px 0px; padding: 0px; box-sizing: border-box; color: rgb(51, 51, 51); font-size: 15px; font-family: -apple-system, \\&quot;PingFang SC\\&quot;, \\&quot;Microsoft YaHei\\&quot;, \\&quot;Helvetica Neue\\&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;&quot;},&quot;namespaceURI&quot;:&quot;http:\/\/www.w3.org\/1999\/xhtml&quot;}]\" style=\"box-sizing: border-box;color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span textstyle=\"\" style=\"font-size: 12px;text-decoration: underline;\">Flaky&nbsp;<\/span><\/span><span leaf=\"\" data-pm-slice=\"1 1 [&quot;para&quot;,{&quot;tagName&quot;:&quot;p&quot;,&quot;attributes&quot;:{&quot;style&quot;:&quot;margin: 14px 0px; padding: 0px; box-sizing: border-box; color: rgb(51, 51, 51); font-size: 15px; font-family: -apple-system, \\&quot;PingFang SC\\&quot;, \\&quot;Microsoft YaHei\\&quot;, \\&quot;Helvetica Neue\\&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;&quot;},&quot;namespaceURI&quot;:&quot;http:\/\/www.w3.org\/1999\/xhtml&quot;}]\"><span textstyle=\"\" style=\"font-size: 12px;text-decoration: underline;\">Test<\/span><span textstyle=\"\" style=\"font-size: 12px;\">\uff09<\/span>\uff0c\u4e5f\u8e29\u4e86\u5f88\u591a\u5751\uff0c\u7ec8\u4e8e<\/span><span leaf=\"\" data-pm-slice=\"1 1 [&quot;para&quot;,{&quot;tagName&quot;:&quot;p&quot;,&quot;attributes&quot;:{&quot;style&quot;:&quot;margin: 14px 0px; padding: 0px; box-sizing: border-box; color: rgb(51, 51, 51); font-size: 15px; font-family: -apple-system, \\&quot;PingFang SC\\&quot;, \\&quot;Microsoft YaHei\\&quot;, \\&quot;Helvetica Neue\\&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;&quot;},&quot;namespaceURI&quot;:&quot;http:\/\/www.w3.org\/1999\/xhtml&quot;}]\" style=\"box-sizing: border-box;color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\">\u628a<\/span><span leaf=\"\" data-pm-slice=\"1 1 [&quot;para&quot;,{&quot;tagName&quot;:&quot;p&quot;,&quot;attributes&quot;:{&quot;style&quot;:&quot;margin: 14px 0px; padding: 0px; box-sizing: border-box; color: rgb(51, 51, 51); font-size: 15px; font-family: -apple-system, \\&quot;PingFang SC\\&quot;, \\&quot;Microsoft YaHei\\&quot;, \\&quot;Helvetica Neue\\&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;&quot;},&quot;namespaceURI&quot;:&quot;http:\/\/www.w3.org\/1999\/xhtml&quot;}]\" style=\"box-sizing: border-box;color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\">Flaky<\/span><span leaf=\"\" style=\"box-sizing: border-box;color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\">\u7684<\/span><span leaf=\"\">\u6839\u56e0\u5f52\u7c7b\u6e05\u695a\u4e86\uff1a<\/span><strong style=\"margin: 0px;padding: 0px;box-sizing: border-box;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(64, 118, 0);\">90%\u7684\u5076\u53d1\u5931\u8d25\uff0c\u90fd\u53ef\u4ee5\u5f52\u52305\u4e2a\u7c7b\u522b\u4e0b\u9762<\/span><\/span><\/strong><span leaf=\"\">\u3002\u4eca\u5929\u8fd9\u7bc7\u6587\u7ae0\uff0c\u5c31\u662f\u6211\u628a\u8fd9\u4e9b\u5e74\u8e29\u8fc7\u7684\u5751\u3001\u6392\u67e5\u8fc7\u7684\u6848\u4f8b\u6574\u7406\u51fa\u6765\u7684\u5b9e\u6218\u65b9\u6cd5\u8bba<\/span><\/p>\n<blockquote style=\"margin: 20px 0px;padding: 14px 18px;box-sizing: border-box;background: rgb(240, 247, 255);border-left: 4px solid rgb(79, 195, 247);color: rgb(52, 73, 94);border-radius: 0px 6px 6px 0px;font-size: 15px;line-height: 1.75;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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: 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;\">\n<p><strong style=\"margin: 0px;padding: 0px;box-sizing: border-box;color: rgb(15, 52, 96);\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(171, 25, 66);\">\u6838\u5fc3\u7ed3\u8bba<\/span><\/span><\/strong><\/p>\n<section><span leaf=\"\" data-pm-slice=\"1 1 [&quot;para&quot;,{&quot;tagName&quot;:&quot;p&quot;,&quot;attributes&quot;:{&quot;style&quot;:&quot;margin: 14px 0px; padding: 0px; box-sizing: border-box; color: rgb(51, 51, 51); font-size: 15px; font-family: -apple-system, \\&quot;PingFang SC\\&quot;, \\&quot;Microsoft YaHei\\&quot;, \\&quot;Helvetica Neue\\&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;&quot;},&quot;namespaceURI&quot;:&quot;http:\/\/www.w3.org\/1999\/xhtml&quot;}]\">Flaky&nbsp;<\/span><span leaf=\"\">Test\u4e0d\u662f\u7384\u5b66\u3002\u540c\u4e00\u6bb5\u4ee3\u7801\u3001\u540c\u4e00\u5957\u73af\u5883\uff0c\u6709\u65f6\u901a\u8fc7\u6709\u65f6\u5931\u8d25\uff0c\u80cc\u540e\u4e00\u5b9a\u6709\u539f\u56e0\u300290%\u7684\u95ee\u9898\u53ef\u4ee5\u5f52\u52305\u7c7b\uff1a\u7b49\u5f85\u673a\u5236\u3001\u6570\u636e\u4f9d\u8d56\u3001\u73af\u5883\u6b8b\u7559\u3001\u65f6\u5e8f\u7ade\u4e89\u3001\u5916\u90e8\u4f9d\u8d56\u3002\u5269\u4e0b\u768410%\u4e5f\u6709\u7ae0\u53ef\u5faa<\/span><\/section>\n<\/blockquote>\n<section style=\"text-align: center;\" nodeleaf=\"\">\n<figure class=\"wx-qr-wrap\"><img decoding=\"async\" class=\"rich_pages wxw-img\" data-ratio=\"0.48\" data-s=\"300,640\" data-type=\"png\" data-w=\"1050\" type=\"block\" data-imgfileid=\"100000645\" data-aistatus=\"1\" src=\"https:\/\/mmbiz.qpic.cn\/sz_mmbiz_png\/BWmfcibGhS1K4lV3qLdgkTtKhMw8Hn7uwVVUxvrg0oOER0tAoxpy3GqYt4eeg8V4knia1gOib7slWQkszHCvsAfniaervsePqcsLneJib5F2MeRE\/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 leaf=\"\" data-pm-slice=\"1 1 [&quot;para&quot;,{&quot;tagName&quot;:&quot;p&quot;,&quot;attributes&quot;:{&quot;style&quot;:&quot;margin: 14px 0px; padding: 0px; box-sizing: border-box; color: rgb(51, 51, 51); font-size: 15px; font-family: -apple-system, \\&quot;PingFang SC\\&quot;, \\&quot;Microsoft YaHei\\&quot;, \\&quot;Helvetica Neue\\&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;&quot;},&quot;namespaceURI&quot;:&quot;http:\/\/www.w3.org\/1999\/xhtml&quot;}]\" style=\"text-align: center;color: rgb(111, 125, 150);font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, sans-serif;font-size: 13px;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;\">Flaky&nbsp;<\/span><span style=\"text-align: center;color: rgb(111, 125, 150);font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, sans-serif;font-size: 13px;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=\"\" style=\"color: rgb(111, 125, 150);font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, sans-serif;font-size: 13px;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;\">Te<\/span><\/span><span style=\"color: rgb(111, 125, 150);font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, sans-serif;font-size: 13px;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=\"\">st 5\u5927\u6839\u56e0\u5206\u7c7b \u2014 90%\u7684\u5076\u53d1\u5931\u8d25\u90fd\u53ef\u4ee5\u5f52\u5230\u8fd95\u7c7b\u4e4b\u4e2d<\/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<p data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 18px;color: rgb(64, 118, 0);font-weight: bold;\">\u7b2c\u4e00\u7ae0<\/span><span textstyle=\"\" style=\"font-size: 18px;color: rgb(2, 30, 170);font-weight: bold;\">&nbsp;\u00b7 \u7b49\u5f85\u673a\u5236\u7528\u9519\u4e86\u2014\u2014\u5143\u7d20\u51fa\u73b0 \u2260 \u53ef\u70b9\u51fb<\/span><\/span><\/p>\n<p><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 12px;\">Web\u81ea\u52a8\u5316<\/span><\/span><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 12px;\">\u91cc<\/span><\/span><span leaf=\"\" data-pm-slice=\"1 1 [&quot;para&quot;,{&quot;tagName&quot;:&quot;p&quot;,&quot;attributes&quot;:{&quot;style&quot;:&quot;margin: 14px 0px; padding: 0px; box-sizing: border-box; color: rgb(51, 51, 51); font-size: 15px; font-family: -apple-system, \\&quot;PingFang SC\\&quot;, \\&quot;Microsoft YaHei\\&quot;, \\&quot;Helvetica Neue\\&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;&quot;},&quot;namespaceURI&quot;:&quot;http:\/\/www.w3.org\/1999\/xhtml&quot;}]\"><span textstyle=\"\" style=\"font-size: 12px;\">Flaky<\/span><\/span><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 12px;\">\u7684\u5934<\/span><\/span><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 12px;\">\u53f7\u539f\u56e0\uff0c\u4e5f\u662f\u6700\u5bb9\u6613\u4fee\u590d\u3001\u6700\u5bb9\u6613\u88ab\u5ffd\u89c6\u7684\u95ee\u9898<\/span><\/span><\/p>\n<h2 style=\"margin: 42px 0px 18px;padding: 0px 0px 0px 14px;box-sizing: border-box;font-size: 21px;color: rgb(15, 52, 96);border-left: 5px solid rgb(79, 195, 247);line-height: 1.4;font-weight: 700;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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=\"\">1.1 \u6211\u5728\u57ce\u5546\u884c\u9879\u76ee\u91cc\u8e29\u7684\u90a3\u4e2a\u5751<\/span><\/h2>\n<p style=\"margin: 14px 0px;padding: 0px;box-sizing: border-box;color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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: 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=\"\">\u7ed9\u57ce\u5546\u884c\u505a\u6d4b\u8bd5\u6846\u67b6\uff0c\u767b\u5f55\u6a21\u5757\u6709\u4e2a\u7528\u4f8b\u662f\u8fd9\u6837\u7684\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<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"apache\"><code><span leaf=\"\"><span class=\"code-snippet__comment\"># \u7528\u4f8b\uff1a\u767b\u5f55\u540e\u70b9\u51fb\"\u8fdb\u5165\u7cfb\u7edf\"\u6309\u94ae<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__attribute\">driver<\/span>.get(<span class=\"code-snippet__string\">\"https:\/\/bank.example.com\/login\"<\/span>)<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__attribute\">driver<\/span>.find_element(By.ID,&nbsp;<span class=\"code-snippet__string\">\"username\"<\/span>).send_keys(<span class=\"code-snippet__string\">\"test_user\"<\/span>)<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__attribute\">driver<\/span>.find_element(By.ID,&nbsp;<span class=\"code-snippet__string\">\"password\"<\/span>).send_keys(<span class=\"code-snippet__string\">\"Test@123\"<\/span>)<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__attribute\">driver<\/span>.find_element(By.ID,&nbsp;<span class=\"code-snippet__string\">\"login-btn\"<\/span>).click()<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># \u7b49\u5f85\u767b\u5f55\u8df3\u8f6c\u5b8c\u6210\u540e\uff0c\u70b9\u51fb\"\u8fdb\u5165\u7cfb\u7edf\"\u6309\u94ae<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__attribute\">time<\/span>.sleep(<span class=\"code-snippet__number\">3<\/span>) &nbsp;# \u56fa\u5b9a\u7b49\u5f85<span class=\"code-snippet__number\">3<\/span>\u79d2\uff0c\u610f\u56fe\u662f\u7b49\u9875\u9762\u8df3\u8f6c\u5b8c\u6210<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__attribute\">driver<\/span>.find_element(By.XPATH,&nbsp;<span class=\"code-snippet__string\">\"\/\/button[text()='\u8fdb\u5165\u7cfb\u7edf']\"<\/span>).click()<\/span><\/code><\/pre>\n<\/section>\n<p style=\"margin: 14px 0px;padding: 0px;box-sizing: border-box;color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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;\" data-pm-slice=\"0 0 []\"><span leaf=\"\">\u8fd9\u6761\u7528\u4f8b\u5728\u672c\u5730\u8dd1\u4e86\u4e09\u4e2a\u6708\uff0c\u4e00\u6b21\u90fd\u6ca1\u5931\u8d25\u8fc7\u3002\u7ed3\u679cCI\u4e0a\u4e00\u4e0a\u5e76\u53d1\uff0c\u7b2c\u4e00\u5929\u5c31\u6709\u4e24\u6761\u7528\u4f8b\u62a5\u4e86\uff1a<\/span><code style=\"margin: 0px;padding: 0px;box-sizing: border-box;\"><span leaf=\"\">ElementClickInterceptedException<\/span><\/code><\/p>\n<p style=\"margin: 14px 0px;padding: 0px;box-sizing: border-box;color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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=\"\">\u6211\u6392\u67e5\u4e86\u4e24\u5929\u624d\u53d1\u73b0\u771f\u6b63\u539f\u56e0\uff1a\u9875\u9762\u7528\u4e86\u61d2\u52a0\u8f7d\uff0c&#8221;\u8fdb\u5165\u7cfb\u7edf&#8221;\u6309\u94ae\u867d\u7136\u5728DOM\u91cc\u51fa\u73b0\u4e86\uff0c\u4f46CSS transition\u52a8\u753b\u8fd8\u5728\u8dd1<span textstyle=\"\" style=\"font-size: 12px;\">\uff08\u6309\u94ae\u4ece\u900f\u660e\u6e10\u53d8\u5230\u5b8c\u5168\u53ef\u89c1\u82b1\u4e861.8\u79d2\uff09<\/span>\u3002\u672c\u5730\u8dd1\u7684\u65f6\u5019CI\u673a\u5668\u8d1f\u8f7d\u4f4e\uff0c\u52a8\u753b\u8dd1\u5f97\u8fd8\u7b97\u987a\u7545\uff1b\u5e76\u53d1\u4e00\u5f00\uff0c\u673a\u5668CPU\u4e00\u6253\u7d27\uff0c\u52a8\u753b\u5ef6\u8fdf\u5230\u4e863\u79d2\u4ee5\u4e0a\uff0c\u56fa\u5b9a\u7b49\u5f85\u76843\u79d2\u5c31\u4e0d\u591f\u4e86<\/span><\/p>\n<p style=\"margin: 14px 0px;padding: 0px;box-sizing: border-box;color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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=\"\">\u8fd9\u6574\u4e2a\u6392\u67e5\u8fc7\u7a0b\u6d6a\u8d39\u4e86\u6211\u4e24\u4e2a\u5de5\u4f5c\u65e5\u3002\u4e8b\u540e\u6211\u60f3\uff0c\u5982\u679c\u5f53\u65f6\u5c31\u7528\u663e\u5f0f\u7b49\u5f85\uff0c\u5b8c\u5168\u53ef\u4ee5\u907f\u514d\u8fd9\u4e2a\u95ee\u9898<\/span><\/p>\n<h2 style=\"margin: 42px 0px 18px;padding: 0px 0px 0px 14px;box-sizing: border-box;font-size: 21px;color: rgb(15, 52, 96);border-left: 5px solid rgb(79, 195, 247);line-height: 1.4;font-weight: 700;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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=\"\">1.2 \u4e09\u79cd\u7b49\u5f85\u65b9\u5f0f\uff0c\u5230\u5e95\u5dee\u5728\u54ea\u91cc\uff1f<\/span><\/h2>\n<p style=\"margin: 14px 0px;padding: 0px;box-sizing: border-box;color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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: 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=\"\">\u5148\u8bf4\u6e05\u695a\u4e09\u79cd\u7b49\u5f85\u7684\u672c\u8d28\u533a\u522b\uff1a<\/span><\/p>\n<ul style=\"margin: 10px 0px 16px 22px;padding: 0px;box-sizing: border-box;color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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: 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=\"margin: 0px 0px 8px;padding: 0px;box-sizing: border-box;line-height: 1.75;\"><strong style=\"margin: 0px;padding: 0px;box-sizing: border-box;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(123, 12, 0);\">\u56fa\u5b9asleep<\/span><\/span><\/strong><br \/>\n<section><span leaf=\"\">\uff08<\/span><code style=\"margin: 0px;padding: 0px;box-sizing: border-box;\"><span leaf=\"\">time.sleep(3)<\/span><\/code><span leaf=\"\">\uff09\uff1a\u4e0d\u7ba1\u5143\u7d20\u72b6\u6001\uff0c\u50bb\u7b493\u79d2\u5c31\u8d70\u3002\u8981\u4e0d\u7b49\u592a\u4e45\u6d6a\u8d39CI\u65f6\u95f4\uff0c\u8981\u4e0d\u5c31\u7b49\u4e0d\u591f\u4f9d\u7136<\/span><span leaf=\"\" data-pm-slice=\"1 1 [&quot;para&quot;,{&quot;tagName&quot;:&quot;p&quot;,&quot;attributes&quot;:{&quot;style&quot;:&quot;margin: 14px 0px; padding: 0px; box-sizing: border-box; color: rgb(51, 51, 51); font-size: 15px; font-family: -apple-system, \\&quot;PingFang SC\\&quot;, \\&quot;Microsoft YaHei\\&quot;, \\&quot;Helvetica Neue\\&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;&quot;},&quot;namespaceURI&quot;:&quot;http:\/\/www.w3.org\/1999\/xhtml&quot;}]\">Fail<\/span><\/section>\n<\/li>\n<li style=\"margin: 0px 0px 8px;padding: 0px;box-sizing: border-box;line-height: 1.75;\"><strong style=\"margin: 0px;padding: 0px;box-sizing: border-box;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(123, 12, 0);\">\u9690\u5f0f\u7b49\u5f85<\/span><\/span><\/strong><br \/>\n<section><span leaf=\"\">\uff08<\/span><code style=\"margin: 0px;padding: 0px;box-sizing: border-box;\"><span leaf=\"\">driver.implicitly_wait(10)<\/span><\/code><span leaf=\"\">\uff09\uff1a\u5168\u5c40\u751f\u6548\uff0c\u6bcf\u6b21\u67e5\u627e\u5143\u7d20\u6700\u591a\u7b4910\u79d2\u3002\u6bd4\u56fa\u5b9asleep\u806a\u660e\u4e00\u70b9\uff0c\u4f46\u53ea\u8ba4&#8221;\u5143\u7d20\u5728DOM\u91cc&#8221;\uff0c\u4e0d\u8ba4&#8221;\u5143\u7d20\u53ef\u4ee5\u4ea4\u4e92&#8221;<\/span><\/section>\n<\/li>\n<li style=\"margin: 0px 0px 8px;padding: 0px;box-sizing: border-box;line-height: 1.75;\"><strong style=\"margin: 0px;padding: 0px;box-sizing: border-box;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(123, 12, 0);\">\u663e\u5f0f\u7b49\u5f85<\/span><\/span><\/strong><br \/>\n<section><span leaf=\"\">\uff08<\/span><code style=\"margin: 0px;padding: 0px;box-sizing: border-box;\"><span leaf=\"\">WebDriverWait(...).until(...)<\/span><\/code><span leaf=\"\">\uff09\uff1a\u9488\u5bf9\u5355\u4e2a\u5143\u7d20\uff0c\u8f6e\u8be2\u68c0\u67e5\u6761\u4ef6\uff0c\u8d85\u65f6\u624d\u629b\u5f02\u5e38\u3002\u751f\u4ea7\u73af\u5883\u7684\u63a8\u8350\u65b9\u6848<\/span><\/section>\n<\/li>\n<\/ul>\n<p style=\"margin: 14px 0px;padding: 0px;box-sizing: border-box;color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, sans-serif;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;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: rgb(255, 41, 65);font-weight: bold;\">\u4e09\u79cd\u65b9\u5f0f\u7684\u672c\u8d28\u5dee\u5f02\uff1a<\/span><\/span><\/p>\n<table style=\"margin: 20px 0px;padding: 0px;box-sizing: border-box;width: 700px;border-collapse: collapse;font-size: 14px;color: rgb(44, 44, 58);font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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<thead>\n<tr style=\"margin: 0px;padding: 0px;box-sizing: border-box;\">\n<th style=\"margin: 0px;padding: 11px 14px;box-sizing: border-box;background: rgb(22, 33, 62);color: rgb(255, 255, 255);text-align: left;font-weight: 600;border-bottom: 2px solid rgb(79, 195, 247);\">\n<section style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(214, 168, 65);\">\u7b49\u5f85\u65b9\u5f0f<\/span><\/span><\/section>\n<\/th>\n<th style=\"margin: 0px;padding: 11px 14px;box-sizing: border-box;background: rgb(22, 33, 62);color: rgb(255, 255, 255);text-align: left;font-weight: 600;border-bottom: 2px solid rgb(79, 195, 247);\">\n<section style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(214, 168, 65);\">\u4f5c\u7528\u8303\u56f4<\/span><\/span><\/section>\n<\/th>\n<th style=\"margin: 0px;padding: 11px 14px;box-sizing: border-box;background: rgb(22, 33, 62);color: rgb(255, 255, 255);text-align: left;font-weight: 600;border-bottom: 2px solid rgb(79, 195, 247);\">\n<section style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(214, 168, 65);\">\u667a\u80fd\u7a0b\u5ea6<\/span><\/span><\/section>\n<\/th>\n<th style=\"margin: 0px;padding: 11px 14px;box-sizing: border-box;background: rgb(22, 33, 62);color: rgb(255, 255, 255);text-align: left;font-weight: 600;border-bottom: 2px solid rgb(79, 195, 247);\">\n<section style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(214, 168, 65);\">\u63a8\u8350\u573a\u666f<\/span><\/span><\/section>\n<\/th>\n<th style=\"margin: 0px;padding: 11px 14px;box-sizing: border-box;background: rgb(22, 33, 62);color: rgb(255, 255, 255);text-align: left;font-weight: 600;border-bottom: 2px solid rgb(79, 195, 247);\">\n<section style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(214, 168, 65);\">\u98ce\u9669\u70b9<\/span><\/span><\/section>\n<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr style=\"margin: 0px;padding: 0px;box-sizing: border-box;\">\n<td style=\"margin: 0px;padding: 10px 14px;box-sizing: border-box;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(51, 51, 51);\"><code style=\"margin: 0px;padding: 1px 5px;box-sizing: border-box;background: rgb(234, 244, 255);color: rgb(15, 52, 96);border-radius: 3px;font-size: 12.5px;\"><span leaf=\"\">time.sleep()<\/span><\/code><\/td>\n<td style=\"margin: 0px;padding: 10px 14px;box-sizing: border-box;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(51, 51, 51);\">\n<section><span leaf=\"\">\u5168\u5c40<\/span><\/section>\n<\/td>\n<td style=\"margin: 0px;padding: 10px 14px;box-sizing: border-box;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(51, 51, 51);\">\n<section><span leaf=\"\">\u274c \u56fa\u5b9a\u7b49\u5f85<\/span><\/section>\n<\/td>\n<td style=\"margin: 0px;padding: 10px 14px;box-sizing: border-box;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(51, 51, 51);\">\n<section><span leaf=\"\">\u8c03\u8bd5\/JS\u52a8\u753b<\/span><\/section>\n<\/td>\n<td style=\"margin: 0px;padding: 10px 14px;box-sizing: border-box;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(51, 51, 51);\">\n<section><span leaf=\"\">\u6d6a\u8d39\u65f6\u95f4\u6216\u7b49\u4e0d\u591f<\/span><\/section>\n<\/td>\n<\/tr>\n<tr style=\"margin: 0px;padding: 0px;box-sizing: border-box;background: rgb(246, 248, 251);\">\n<td style=\"margin: 0px;padding: 10px 14px;box-sizing: border-box;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(51, 51, 51);\"><code style=\"margin: 0px;padding: 1px 5px;box-sizing: border-box;background: rgb(234, 244, 255);color: rgb(15, 52, 96);border-radius: 3px;font-size: 12.5px;\"><span leaf=\"\">implicitly_wait()<\/span><\/code><\/td>\n<td style=\"margin: 0px;padding: 10px 14px;box-sizing: border-box;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(51, 51, 51);\">\n<section><span leaf=\"\">\u5168\u5c40<\/span><\/section>\n<\/td>\n<td style=\"margin: 0px;padding: 10px 14px;box-sizing: border-box;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(51, 51, 51);\">\n<section><span leaf=\"\">\u26a0\ufe0f \u534a\u667a\u80fd<\/span><\/section>\n<\/td>\n<td style=\"margin: 0px;padding: 10px 14px;box-sizing: border-box;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(51, 51, 51);\">\n<section><span leaf=\"\">\u515c\u5e95\u7b56\u7565<\/span><\/section>\n<\/td>\n<td style=\"margin: 0px;padding: 10px 14px;box-sizing: border-box;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(51, 51, 51);\">\n<section><span leaf=\"\">\u53ea\u7b49DOM\uff0c\u4e0d\u7b49\u53ef\u70b9\u51fb<\/span><\/section>\n<\/td>\n<\/tr>\n<tr style=\"margin: 0px;padding: 0px;box-sizing: border-box;\">\n<td style=\"margin: 0px;padding: 10px 14px;box-sizing: border-box;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(51, 51, 51);\"><code style=\"margin: 0px;padding: 1px 5px;box-sizing: border-box;background: rgb(234, 244, 255);color: rgb(15, 52, 96);border-radius: 3px;font-size: 12.5px;\"><span leaf=\"\">WebDriverWait()<\/span><\/code><\/td>\n<td style=\"margin: 0px;padding: 10px 14px;box-sizing: border-box;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(51, 51, 51);\">\n<section><span leaf=\"\">\u5355\u4e2a\u5143\u7d20<\/span><\/section>\n<\/td>\n<td style=\"margin: 0px;padding: 10px 14px;box-sizing: border-box;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(51, 51, 51);\">\n<section><span leaf=\"\">\u2705 \u7cbe\u51c6<\/span><\/section>\n<\/td>\n<td style=\"margin: 0px;padding: 10px 14px;box-sizing: border-box;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(51, 51, 51);\">\n<section><span leaf=\"\">\u751f\u4ea7\u4e3b\u529b<\/span><\/section>\n<\/td>\n<td style=\"margin: 0px;padding: 10px 14px;box-sizing: border-box;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(51, 51, 51);\">\n<section><span leaf=\"\">\u9700\u8981\u5199\u6761\u4ef6\u4ee3\u7801<\/span><\/section>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"margin: 14px 0px;padding: 0px;box-sizing: border-box;color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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: 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=\"\">\u9690\u5f0f\u7b49\u5f85\u867d\u7136\u7701\u4e8b\uff0c\u4f46\u6709\u4e00\u4e2a\u81f4\u547d\u7f3a\u9677\uff1a<\/span><strong style=\"margin: 0px;padding: 0px;box-sizing: border-box;\"><span leaf=\"\">\u5b83\u53ea\u7b49&#8221;\u5143\u7d20\u51fa\u73b0\u5728DOM\u91cc&#8221;\uff0c\u4e0d\u7b49&#8221;\u5143\u7d20\u771f\u6b63\u53ef\u4ee5\u4ea4\u4e92&#8221;<\/span><\/strong><span leaf=\"\">\u3002\u8fd9\u4e24\u4e2a\u72b6\u6001\u4e4b\u95f4\u53ef\u80fd\u76f8\u5dee\u597d\u51e0\u79d2\uff0c\u800c\u8fd9\u91cc\u6070\u6070\u5c31\u662f<\/span><span leaf=\"\" data-pm-slice=\"1 1 [&quot;para&quot;,{&quot;tagName&quot;:&quot;p&quot;,&quot;attributes&quot;:{&quot;style&quot;:&quot;margin: 14px 0px; padding: 0px; box-sizing: border-box; color: rgb(51, 51, 51); font-size: 15px; font-family: -apple-system, \\&quot;PingFang SC\\&quot;, \\&quot;Microsoft YaHei\\&quot;, \\&quot;Helvetica Neue\\&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;&quot;},&quot;namespaceURI&quot;:&quot;http:\/\/www.w3.org\/1999\/xhtml&quot;}]\">Fail<\/span><span leaf=\"\">\u7684\u6e29\u5e8a<\/span><\/p>\n<h2 style=\"margin: 42px 0px 18px;padding: 0px 0px 0px 14px;box-sizing: border-box;font-size: 21px;color: rgb(15, 52, 96);border-left: 5px solid rgb(79, 195, 247);line-height: 1.4;font-weight: 700;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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=\"\">1.3 \u5143\u7d20\u51fa\u73b0\u76845\u79cd\u65f6\u5e8f\u9677\u9631<\/span><\/h2>\n<p style=\"margin: 14px 0px;padding: 0px;box-sizing: border-box;color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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: 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=\"\">\u4f60\u4ee5\u4e3a\u5143\u7d20\u51fa\u73b0\u5728DOM\u91cc\u5c31\u80fd\u70b9\uff1f\u592a\u5929\u771f\u4e86\u3002\u5b9e\u9645\u9879\u76ee\u4e2d\uff0c\u6709\u5927\u91cf\u573a\u666f\u4f1a\u8ba9\u5143\u7d20&#8221;\u53ef\u89c1\u4f46\u4e0d\u53ef\u4ea4\u4e92&#8221;\uff1a<\/span><\/p>\n<ul style=\"margin: 10px 0px 16px 22px;padding: 0px;box-sizing: border-box;color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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: 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=\"margin: 0px 0px 8px;padding: 0px;box-sizing: border-box;line-height: 1.75;\"><strong style=\"margin: 0px;padding: 0px;box-sizing: border-box;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(123, 12, 0);\">CSS\u9690\u85cf<\/span><\/span><\/strong><br \/>\n<section><code style=\"margin: 0px;padding: 0px;box-sizing: border-box;\"><span leaf=\"\">display: none<\/span><\/code><span leaf=\"\">\u3001<\/span><code style=\"margin: 0px;padding: 0px;box-sizing: border-box;\"><span leaf=\"\">visibility: hidden<\/span><\/code><span leaf=\"\">\u2014\u2014\u5143\u7d20\u5728DOM\u91cc\uff0c\u4f46\u7528\u6237\u770b\u4e0d\u5230\uff0c\u4e5f\u70b9\u4e0d\u4e86\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin: 0px 0px 8px;padding: 0px;box-sizing: border-box;line-height: 1.75;\"><strong style=\"margin: 0px;padding: 0px;box-sizing: border-box;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(123, 12, 0);\">\u52a8\u753b\u8fc7\u6e21\u671f<\/span><\/span><\/strong><br \/>\n<section><span leaf=\"\">CSS transition\u6216JS\u52a8\u753b\u8fd8\u5728\u8dd1\uff0c\u5143\u7d20\u5728\u79fb\u52a8\u4e2d\uff0c\u70b9\u51fb\u5750\u6807\u504f\u79fb\u3002\u8fd9\u662f\u4e0a\u6587\u6211\u8e29\u7684\u90a3\u4e2a\u5751<\/span><\/section>\n<\/li>\n<li style=\"margin: 0px 0px 8px;padding: 0px;box-sizing: border-box;line-height: 1.75;\"><strong style=\"margin: 0px;padding: 0px;box-sizing: border-box;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(123, 12, 0);\">iframe\u672a\u52a0\u8f7d\u5b8c<\/span><\/span><\/strong><br \/>\n<section><span leaf=\"\">\u4e3b\u6587\u6863\u8ba4\u4e3aiframe\u5b58\u5728\u4e86\uff0c\u5207\u6362\u8fdb\u53bb\u53d1\u73b0\u91cc\u9762\u662f\u7a7a\u7684<\/span><\/section>\n<\/li>\n<li style=\"margin: 0px 0px 8px;padding: 0px;box-sizing: border-box;line-height: 1.75;\"><strong style=\"margin: 0px;padding: 0px;box-sizing: border-box;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(123, 12, 0);\">\u61d2\u52a0\u8f7d\u7ec4\u4ef6<\/span><\/span><\/strong><br \/>\n<section><span leaf=\"\">React\/Vue\u9aa8\u67b6\u5c4f\u8fd8\u5728\uff0c\u52a0\u8f7d\u4e2d\u6587\u672c\u8fd8\u6ca1\u6e32\u67d3\uff0c\u6d4b\u8bd5\u8bfb\u5230\u7684\u503c\u662f&#8221;\u52a0\u8f7d\u4e2d&#8230;&#8221;<\/span><\/section>\n<\/li>\n<li style=\"margin: 0px 0px 8px;padding: 0px;box-sizing: border-box;line-height: 1.75;\"><strong style=\"margin: 0px;padding: 0px;box-sizing: border-box;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(123, 12, 0);\">\u6309\u94ae\u4e8b\u4ef6\u672a\u7ed1\u5b9a<\/span><\/span><\/strong><br \/>\n<section><span leaf=\"\">\u8fd9\u662f\u6700\u5751\u7684\u4e00\u79cd\u3002\u5143\u7d20\u5df2\u7ecf\u6e32\u67d3\u4e86\uff0c\u4f46JS\u7684<\/span><code style=\"margin: 0px;padding: 0px;box-sizing: border-box;\"><span leaf=\"\">addEventListener<\/span><\/code><span leaf=\"\">\u8fd8\u6ca1\u6267\u884c\uff0c\u70b9\u51fb\u6ca1\u6709\u4efb\u4f55\u53cd\u5e94\u3002\u8fd9\u79cd<\/span><span leaf=\"\" data-pm-slice=\"1 1 [&quot;para&quot;,{&quot;tagName&quot;:&quot;p&quot;,&quot;attributes&quot;:{&quot;style&quot;:&quot;margin: 14px 0px; padding: 0px; box-sizing: border-box; color: rgb(51, 51, 51); font-size: 15px; font-family: -apple-system, \\&quot;PingFang SC\\&quot;, \\&quot;Microsoft YaHei\\&quot;, \\&quot;Helvetica Neue\\&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;&quot;},&quot;namespaceURI&quot;:&quot;http:\/\/www.w3.org\/1999\/xhtml&quot;}]\">Flaky<\/span><span leaf=\"\">\u7684\u7279\u5f81\u662f\uff1a\u6162\u7684\u65f6\u5019\u8fd8\u597d\uff0c\u5feb\u7684\u65f6\u5019\u53cd\u800c\u5931\u8d25<\/span><\/section>\n<\/li>\n<\/ul>\n<h2 style=\"margin: 42px 0px 18px;padding: 0px 0px 0px 14px;box-sizing: border-box;font-size: 21px;color: rgb(15, 52, 96);border-left: 5px solid rgb(79, 195, 247);line-height: 1.4;font-weight: 700;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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=\"\">1.4 \u663e\u5f0f\u7b49\u5f85\u7684\u6b63\u786e\u7528\u6cd5<\/span><\/h2>\n<p style=\"margin: 14px 0px;padding: 0px;box-sizing: border-box;color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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: rgb(172, 57, 255);text-decoration: underline;\">\u751f\u4ea7\u73af\u5883\u91cc\uff0c\u6240\u6709\u7b49\u5f85\u90fd\u5e94\u8be5\u5c01\u88c5\u6210\u7edf\u4e00\u51fd\u6570\u8c03\u7528\u3002\u597d\u5904\u6709\u4e24\u4e2a\uff1a\u4ee3\u7801\u7b80\u6d01\uff0c\u65e5\u5fd7\u6e05\u6670\u3002\u4e0b\u9762\u662f\u6211\u5728\u9879\u76ee\u91cc\u5b9e\u9645\u4f7f\u7528\u7684\u7b49\u5f85\u5de5\u5177\u5c01\u88c5<\/span><span textstyle=\"\" style=\"text-decoration: underline;\">\uff1a<\/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<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"python\"><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=\"\">\u663e\u5f0f\u7b49\u5f85\u5de5\u5177\u51fd\u6570\u5c01\u88c5 \u2014 \u57ce\u5546\u884c\u9879\u76ee\u5b9e\u6218\u7248<\/span><\/code><code><span leaf=\"\">\u6bcf\u6b21\u4ea4\u4e92\u524d\u4f7f\u7528 element_to_be_clickable\uff0c\u907f\u514d\u9690\u5f0f\u7b49\u5f85\u548c\u56fa\u5b9asleep\u5e26\u6765\u7684Fail<\/span><\/code><code><span leaf=\"\">\"\"\"<\/span><\/code><code><span leaf=\"\"><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=\"\"><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=\"\"><span class=\"code-snippet__keyword\">from<\/span>&nbsp;selenium.webdriver.common.by&nbsp;<span class=\"code-snippet__keyword\">import<\/span>&nbsp;By<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">from<\/span>&nbsp;selenium.common.exceptions&nbsp;<span class=\"code-snippet__keyword\">import<\/span>&nbsp;TimeoutException<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">from<\/span>&nbsp;typing&nbsp;<span class=\"code-snippet__keyword\">import<\/span>&nbsp;<span class=\"code-snippet__type\">Optional<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;logging<\/span><\/code><code><span leaf=\"\">logger = logging.getLogger(__name__)<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">wait_for_clickable<\/span>(<span class=\"code-snippet__params\">driver, locator:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">tuple<\/span><\/span><span class=\"code-snippet__params\">, timeout:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">int<\/span><\/span><span class=\"code-snippet__params\">&nbsp;=&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__number\">10<\/span><\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u7b49\u5f85\u5143\u7d20\u53ef\u70b9\u51fb\uff08\u53ef\u89c1+enabled\uff09\u3002<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u8fd9\u662f\u70b9\u51fb\u64cd\u4f5c\u524d\u6700\u63a8\u8350\u7684\u7b49\u5f85\u65b9\u5f0f\u3002<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u57ce\u5546\u884c\u9879\u76ee\u5b9e\u8df5\u8bc1\u660e\uff1a\u4f7f\u7528\u6b64\u51fd\u6570\u540e\uff0c\u767b\u5f55\u6a21\u5757\u7528\u4f8b\u7a33\u5b9a\u6027\u4ece73%\u63d0\u5347\u81f399.2%\u3002<\/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; el = WebDriverWait(driver, timeout, poll_frequency=<span class=\"code-snippet__number\">0.5<\/span>).until(<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; EC.element_to_be_clickable(locator),<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">f\"\u5143\u7d20&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{locator}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;\u5728&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{timeout}<\/span><\/span><span class=\"code-snippet__string\">s \u5185\u672a\u53d8\u4e3a\u53ef\u70b9\u51fb\u72b6\u6001\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; logger.info(<span class=\"code-snippet__string\">f\"\u2705 \u5143\u7d20\u5df2\u53ef\u70b9\u51fb:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{locator}<\/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;el<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">except<\/span>&nbsp;TimeoutException:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; logger.error(<span class=\"code-snippet__string\">f\"\u274c \u7b49\u5f85\u5143\u7d20\u53ef\u70b9\u51fb\u8d85\u65f6:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{locator}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">raise<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">wait_for_visible<\/span>(<span class=\"code-snippet__params\">driver, locator:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">tuple<\/span><\/span><span class=\"code-snippet__params\">, timeout:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">int<\/span><\/span><span class=\"code-snippet__params\">&nbsp;=&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__number\">10<\/span><\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"\u7b49\u5f85\u5143\u7d20\u53ef\u89c1\uff08display!=none, visibility!=hidden\uff09\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;WebDriverWait(driver, timeout).until(<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; EC.visibility_of_element_located(locator)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">wait_for_text<\/span>(<span class=\"code-snippet__params\">driver, locator:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">tuple<\/span><\/span><span class=\"code-snippet__params\">, expected:&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\">int<\/span><\/span><span class=\"code-snippet__params\">&nbsp;=&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__number\">10<\/span><\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"\u7b49\u5f85\u5143\u7d20\u5305\u542b\u6307\u5b9a\u6587\u672c\uff0c\u5e38\u7528\u4e8e\uff1a\u52a0\u8f7d\u4e2d... -&gt; \u64cd\u4f5c\u6210\u529f\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; WebDriverWait(driver, timeout).until(<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; EC.text_to_be_present_in_element(locator, expected)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">wait_for_gone<\/span>(<span class=\"code-snippet__params\">driver, locator:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">tuple<\/span><\/span><span class=\"code-snippet__params\">, timeout:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">int<\/span><\/span><span class=\"code-snippet__params\">&nbsp;=&nbsp;<\/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\u5f85loading\u906e\u7f69\/\u5f39\u7a97\u6d88\u5931\u540e\u518d\u7ee7\u7eed\u64cd\u4f5c\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; WebDriverWait(driver, timeout).until(<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; EC.invisibility_of_element_located(locator)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; logger.info(<span class=\"code-snippet__string\">f\"\u2705 \u5143\u7d20\u5df2\u6d88\u5931:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{locator}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># ===== \u57ce\u5546\u884c\u9879\u76ee\u4e2d\u7684\u5b9e\u9645\u7528\u6cd5 =====<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># \u4fee\u590d\u540e\u7684\u767b\u5f55\u7528\u4f8b\uff08\u5bf9\u6bd41.1\u8282\u7684\u95ee\u9898\u4ee3\u7801\uff09\uff1a<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># driver.get(\"https:\/\/bank.example.com\/login\")<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># driver.find_element(By.ID, \"username\").send_keys(\"test_user\")<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># driver.find_element(By.ID, \"password\").send_keys(\"Test@123\")<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># driver.find_element(By.ID, \"login-btn\").click()<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># wait_for_gone(driver, (By.CLASS_NAME, \"loading-spinner\"), timeout=20) &nbsp;# \u7b49loading\u6d88\u5931<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># wait_for_clickable(driver, (By.XPATH, \"\/\/button[text()='\u8fdb\u5165\u7cfb\u7edf']\"), timeout=15).click()<\/span><\/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-ratio=\"0.4622093023255814\" data-s=\"300,640\" data-type=\"png\" data-w=\"1032\" type=\"block\" data-imgfileid=\"100000646\" data-aistatus=\"1\" src=\"https:\/\/mmbiz.qpic.cn\/sz_mmbiz_png\/BWmfcibGhS1K5YLxt344fIdnL7UTQ6G4OjXRXjQyxBeMw9B34HPBOEnjmVMNWSnyFhL7lhOwqDPTdwRUVE0BlgyRbE2IiaGgWVjpPFUAggl1E\/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(111, 125, 150);font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, sans-serif;font-size: 13px;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=\"\">\u4e09\u79cd\u7b49\u5f85\u673a\u5236\u884c\u4e3a\u5bf9\u6bd4 \u2014 \u663e\u5f0f\u7b49\u5f85\u7cbe\u786e\u5224\u65ad&#8221;\u53ef\u70b9\u51fb&#8221;\uff0c\u56fa\u5b9asleep\u6d6a\u8d39CI\u65f6\u95f4\uff0c\u9690\u5f0f\u7b49\u5f85\u53ea\u8ba4DOM<\/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<p data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 18px;color: rgb(64, 118, 0);font-weight: bold;\">\u7b2c\u4e8c\u7ae0 \u00b7<\/span><span textstyle=\"\" style=\"font-size: 18px;color: rgb(2, 30, 170);font-weight: bold;\">\u6d4b\u8bd5\u6570\u636e\u4f9d\u8d56\u2014\u2014\u7528\u4f8b\u4e4b\u95f4\u7684\u9690\u5f62\u8026\u5408<\/span><\/span><\/p>\n<p><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 12px;\">\u7528\u4f8bA\u521b\u5efa\u4e86\u6570\u636e\uff0c\u7528\u4f8bB\u53bb\u8bfb\uff0c\u4e24\u6761\u7528\u4f8b\u8dd1\u6210\u4e00\u6761\u3002\u6570\u636e\u4f9d\u8d56<\/span><\/span><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 12px;\">\u662f<\/span><\/span><span leaf=\"\" data-pm-slice=\"1 1 [&quot;para&quot;,{&quot;tagName&quot;:&quot;p&quot;,&quot;attributes&quot;:{&quot;style&quot;:&quot;margin: 14px 0px; padding: 0px; box-sizing: border-box; color: rgb(51, 51, 51); font-size: 15px; font-family: -apple-system, \\&quot;PingFang SC\\&quot;, \\&quot;Microsoft YaHei\\&quot;, \\&quot;Helvetica Neue\\&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;&quot;},&quot;namespaceURI&quot;:&quot;http:\/\/www.w3.org\/1999\/xhtml&quot;}]\"><span textstyle=\"\" style=\"font-size: 12px;\">Fail<\/span><\/span><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 12px;\">\u7684\u7b2c\u4e8c\u5927<\/span><\/span><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 12px;\">\u5143\u51f6<\/span><\/span><\/p>\n<h2 style=\"margin: 42px 0px 18px;padding: 0px 0px 0px 14px;box-sizing: border-box;font-size: 21px;color: rgb(15, 52, 96);border-left: 5px solid rgb(79, 195, 247);line-height: 1.4;font-weight: 700;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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=\"\">2.1 \u6211\u89c1\u8fc7\u6700\u79bb\u8c31\u7684<\/span><span leaf=\"\" data-pm-slice=\"1 1 [&quot;para&quot;,{&quot;tagName&quot;:&quot;p&quot;,&quot;attributes&quot;:{&quot;style&quot;:&quot;margin: 14px 0px; padding: 0px; box-sizing: border-box; color: rgb(51, 51, 51); font-size: 15px; font-family: -apple-system, \\&quot;PingFang SC\\&quot;, \\&quot;Microsoft YaHei\\&quot;, \\&quot;Helvetica Neue\\&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;&quot;},&quot;namespaceURI&quot;:&quot;http:\/\/www.w3.org\/1999\/xhtml&quot;}]\">Flaky<\/span><span leaf=\"\">\uff1atestuser001\u7684&#8221;\u7231\u6068\u60c5\u4ec7&#8221;<\/span><\/h2>\n<p style=\"margin: 14px 0px;padding: 0px;box-sizing: border-box;color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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: 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=\"\">2025\u5e74\u505a\u4e00\u4e2a\u7535\u5546\u9879\u76ee\uff0c\u767b\u5f55\u540e\u7684\u7528\u4f8b\u91cc\u6709\u4e09\u4e2a\u8fd9\u6837\u7684\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<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"ruby\"><code><span leaf=\"\"><span class=\"code-snippet__comment\"># conftest.py \u91cc\u7684\u8001\u4ee3\u7801\uff08\u6709\u95ee\u9898\uff09<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__variable\">TEST_USER<\/span>&nbsp;=&nbsp;<span class=\"code-snippet__string\">\"testuser001\"<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># test_module_a.py - TestUserCreation<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">test_rename_user<\/span>():<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; api.rename(<span class=\"code-snippet__variable\">TEST_USER<\/span>,&nbsp;<span class=\"code-snippet__string\">\"testuser001_renamed\"<\/span>) &nbsp;<span class=\"code-snippet__comment\"># \u628atestuser001\u6539\u540d<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; api.delete(<span class=\"code-snippet__string\">\"testuser001_renamed\"<\/span>) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u518d\u5220\u6389<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># test_module_b.py - TestSearchUser<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">test_user_not_found<\/span>():<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; result = api.search(<span class=\"code-snippet__variable\">TEST_USER<\/span>) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class=\"code-snippet__comment\"># \u641c\u7d22testuser001<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; assert result.count ==&nbsp;<span class=\"code-snippet__number\">0<\/span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u671f\u671b\u627e\u4e0d\u5230<\/span><\/span><\/code><\/pre>\n<\/section>\n<p style=\"margin: 14px 0px;padding: 0px;box-sizing: border-box;color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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;\" data-pm-slice=\"0 0 []\"><span leaf=\"\">\u5355\u72ec\u8dd1<\/span><code style=\"margin: 0px;padding: 0px;box-sizing: border-box;\"><span leaf=\"\">test_user_not_found<\/span><\/code><span leaf=\"\">\uff0c\u901a\u8fc7\u3002\u8ddf<\/span><code style=\"margin: 0px;padding: 0px;box-sizing: border-box;\"><span leaf=\"\">test_rename_user<\/span><\/code><span leaf=\"\">\u4e00\u8d77\u8dd1\uff1f\u5931\u8d25\u4e86\u2014\u2014\u56e0\u4e3a\u641c\u7d22\u7528\u4f8b\u5148\u8dd1\uff0c\u627e\u5230\u7684\u662f\u539f\u59cb\u7684testuser001\uff0c\u8fd8\u6ca1\u88ab\u6539\u540d\u5220\u9664<\/span><\/p>\n<p style=\"margin: 14px 0px;padding: 0px;box-sizing: border-box;color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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=\"\">\u8fd9\u662f\u5178\u578b\u7684<\/span><strong style=\"margin: 0px;padding: 0px;box-sizing: border-box;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(255, 41, 65);\">\u7528\u4f8b\u987a\u5e8f\u51b3\u5b9a\u6210\u8d25<\/span><\/span><\/strong><span leaf=\"\">\u3002\u5355\u72ec\u8dd1\u4e00\u6761\u7528\u4f8b\u53ef\u80fd\u901a\u8fc7\uff0c\u591a\u6761\u7528\u4f8b\u4e00\u8d77\u8dd1\u53cd\u800c\u5931\u8d25\uff1bA\u5148\u8dd1\u5219\u901a\u8fc7\uff0cB\u5148\u8dd1\u5219\u5931\u8d25\u3002\u8fd9\u5c31\u662f<\/span><span leaf=\"\" data-pm-slice=\"1 1 [&quot;para&quot;,{&quot;tagName&quot;:&quot;p&quot;,&quot;attributes&quot;:{&quot;style&quot;:&quot;margin: 14px 0px; padding: 0px; box-sizing: border-box; color: rgb(51, 51, 51); font-size: 15px; font-family: -apple-system, \\&quot;PingFang SC\\&quot;, \\&quot;Microsoft YaHei\\&quot;, \\&quot;Helvetica Neue\\&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;&quot;},&quot;namespaceURI&quot;:&quot;http:\/\/www.w3.org\/1999\/xhtml&quot;}]\">Flaky<\/span><span leaf=\"\">\u7684\u5178\u578b\u75c7\u72b6<\/span><\/p>\n<h2 style=\"margin: 42px 0px 18px;padding: 0px 0px 0px 14px;box-sizing: border-box;font-size: 21px;color: rgb(15, 52, 96);border-left: 5px solid rgb(79, 195, 247);line-height: 1.4;font-weight: 700;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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=\"\">2.2 \u89e3\u51b3\u65b9\u6848\uff1a\u5de5\u5382Fixture\u6a21\u5f0f<\/span><\/h2>\n<p style=\"margin: 14px 0px;padding: 0px;box-sizing: border-box;color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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=\"\">\u6838\u5fc3\u7406\u5ff5\u5f88\u7b80\u5355\uff1a<\/span><strong style=\"margin: 0px;padding: 0px;box-sizing: border-box;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(255, 41, 65);\">\u6bcf\u6761\u7528\u4f8b\u81ea\u5df1\u5bf9\u81ea\u5df1\u7684\u6570\u636e\u8d1f\u8d23<\/span><\/span><\/strong><span leaf=\"\">\u3002\u7528pytest\u7684\u5de5\u5382fixture\uff0c\u6bcf\u6b21\u8c03\u7528\u521b\u5efa\u5168\u65b0\u72ec\u7acb\u6570\u636e\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<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<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\"># -*- coding: utf-8 -*-<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__string\">\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">\u5de5\u5382Fixture \u2014 \u6bcf\u6761\u7528\u4f8b\u72ec\u7acb\u521b\u5efa\u81ea\u5df1\u7684\u6570\u636e<\/span><\/code><code><span leaf=\"\">\u89e3\u51b3\u7528\u4f8b\u95f4\u6570\u636e\u4f9d\u8d56\u95ee\u9898\uff0c\u7528\u4f8b\u53ef\u4efb\u610f\u987a\u5e8f\u3001\u4efb\u610f\u5e76\u53d1\u6267\u884c<\/span><\/code><code><span leaf=\"\">\"\"\"<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;pytest<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;uuid<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">class<\/span>&nbsp;<span class=\"code-snippet__title\">MockAPI<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"\u6a21\u62df\u88ab\u6d4b\u7cfb\u7edfAPI\uff082021\u5e74\u7535\u5546\u9879\u76ee\u5b9e\u6218\u4ee3\u7801\u7b80\u5316\u7248\uff09\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">create_user<\/span>(<span class=\"code-snippet__params\">self, name:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">str<\/span><\/span><span class=\"code-snippet__params\">, role:&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__string\">\"member\"<\/span><\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; user_id =&nbsp;<span class=\"code-snippet__string\">f\"u_<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{uuid.uuid4().<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__built_in\">hex<\/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\">8<\/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\">return<\/span>&nbsp;{<span class=\"code-snippet__string\">\"id\"<\/span>: user_id,&nbsp;<span class=\"code-snippet__string\">\"name\"<\/span>: name,&nbsp;<span class=\"code-snippet__string\">\"role\"<\/span>: role,&nbsp;<span class=\"code-snippet__string\">\"status\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"active\"<\/span>}<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">delete_user<\/span>(<span class=\"code-snippet__params\">self, uid:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">str<\/span><\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;{<span class=\"code-snippet__string\">\"success\"<\/span>:&nbsp;<span class=\"code-snippet__literal\">True<\/span>}<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">create_order<\/span>(<span class=\"code-snippet__params\">self, uid:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">str<\/span><\/span><span class=\"code-snippet__params\">, product:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">str<\/span><\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;{<span class=\"code-snippet__string\">\"id\"<\/span>:&nbsp;<span class=\"code-snippet__string\">f\"o_<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{uuid.uuid4().<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__built_in\">hex<\/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\">8<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">]}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>,&nbsp;<span class=\"code-snippet__string\">\"uid\"<\/span>: uid,&nbsp;<span class=\"code-snippet__string\">\"product\"<\/span>: product,&nbsp;<span class=\"code-snippet__string\">\"status\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"pending\"<\/span>}<\/span><\/code><code><span leaf=\"\">api = MockAPI()<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__meta\">@pytest.fixture<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">fresh_user<\/span>():<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u5de5\u5382Fixture \u2014 \u6bcf\u6b21\u8c03\u7528\u521b\u5efa\u5168\u65b0\u72ec\u7acb\u7528\u6237\u3002<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u4e0d\u4f1a\u518d\u8ddf\u5176\u4ed6\u7528\u4f8b\u5171\u4eab\u6570\u636e\uff0c\u4e0d\u4f1a\u88ab\u5176\u4ed6\u7528\u4f8b\u5f71\u54cd\u3002<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u9000\u51fa\u65f6\u81ea\u52a8\u6e05\u7406\uff08yield teardown\uff09\u3002<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \"\"\"<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; created = []<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">_create<\/span>(<span class=\"code-snippet__params\">name=<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__literal\">None<\/span><\/span><span class=\"code-snippet__params\">, role=<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__string\">\"member\"<\/span><\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;name&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; &nbsp; name =&nbsp;<span class=\"code-snippet__string\">f\"user_<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{uuid.uuid4().<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__built_in\">hex<\/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\">8<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">]}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>&nbsp;&nbsp;<span class=\"code-snippet__comment\"># UUID\u4fdd\u8bc1\u552f\u4e00\u6027<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; user = api.create_user(name, role)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; created.append(user)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;user<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">yield<\/span>&nbsp;_create &nbsp;<span class=\"code-snippet__comment\"># \u628a\u5de5\u5382\u51fd\u6570\u66b4\u9732\u7ed9\u6d4b\u8bd5\u7528\u4f8b<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># ===== Teardown\uff1a\u81ea\u52a8\u6e05\u7406 =====<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">for<\/span>&nbsp;u&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;<span class=\"code-snippet__built_in\">reversed<\/span>(created):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; api.delete_user(u[<span class=\"code-snippet__string\">\"id\"<\/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\"[\u6e05\u7406] \u5220\u9664\u7528\u6237:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{u[<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'name'<\/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__meta\">@pytest.fixture<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">fresh_order<\/span>(<span class=\"code-snippet__params\">fresh_user<\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"\u4f9d\u8d56Fixture\uff1a\u5148\u521b\u5efa\u7528\u6237\uff0c\u518d\u521b\u5efa\u8be5\u7528\u6237\u7684\u8ba2\u5355\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; created_orders = []<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">_create<\/span>(<span class=\"code-snippet__params\">product=<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__string\">\"\u9ed8\u8ba4\u5546\u54c1\"<\/span><\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; user = fresh_user() &nbsp;<span class=\"code-snippet__comment\"># \u6bcf\u4e2a\u8ba2\u5355\u7ed1\u5b9a\u5168\u65b0\u7528\u6237\uff0c\u4e92\u4e0d\u5e72\u6270<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; order = api.create_order(user[<span class=\"code-snippet__string\">\"id\"<\/span>], product)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; created_orders.append(order)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;{<span class=\"code-snippet__string\">\"user\"<\/span>: user,&nbsp;<span class=\"code-snippet__string\">\"order\"<\/span>: order}<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">yield<\/span>&nbsp;_create<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">for<\/span>&nbsp;o&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;<span class=\"code-snippet__built_in\">reversed<\/span>(created_orders):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"[\u6e05\u7406] \u5220\u9664\u8ba2\u5355:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{o[<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'id'<\/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\"># ===== \u6d4b\u8bd5\u7528\u4f8b\uff1a\u5b8c\u5168\u72ec\u7acb\uff0c\u4e92\u4e0d\u5f71\u54cd =====<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__meta\">@pytest.mark.parametrize(<\/span><span class=\"code-snippet__meta\"><span class=\"code-snippet__params\"><span class=\"code-snippet__string\">\"role\"<\/span><\/span><\/span><span class=\"code-snippet__meta\"><span class=\"code-snippet__params\">, [<\/span><\/span><span class=\"code-snippet__meta\"><span class=\"code-snippet__params\"><span class=\"code-snippet__string\">\"member\"<\/span><\/span><\/span><span class=\"code-snippet__meta\"><span class=\"code-snippet__params\">,&nbsp;<\/span><\/span><span class=\"code-snippet__meta\"><span class=\"code-snippet__params\"><span class=\"code-snippet__string\">\"vip\"<\/span><\/span><\/span><span class=\"code-snippet__meta\"><span class=\"code-snippet__params\">]<\/span><\/span><span class=\"code-snippet__meta\">)<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">test_user_creation<\/span>(<span class=\"code-snippet__params\">fresh_user, role<\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; user = fresh_user(role=role)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;user[<span class=\"code-snippet__string\">\"status\"<\/span>] ==&nbsp;<span class=\"code-snippet__string\">\"active\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"\u2705&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{role}<\/span><\/span><span class=\"code-snippet__string\">\u7528\u6237\u521b\u5efa\u6210\u529f\"<\/span>)<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">test_order_creation<\/span>(<span class=\"code-snippet__params\">fresh_order<\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; data = fresh_order(product=<span class=\"code-snippet__string\">\"iPhone 16\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;data[<span class=\"code-snippet__string\">\"order\"<\/span>][<span class=\"code-snippet__string\">\"status\"<\/span>] ==&nbsp;<span class=\"code-snippet__string\">\"pending\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"\u2705 \u8ba2\u5355\u521b\u5efa\u6210\u529f\"<\/span>)<\/span><\/code><\/pre>\n<\/section>\n<h2 style=\"margin: 42px 0px 18px;padding: 0px 0px 0px 14px;box-sizing: border-box;font-size: 21px;color: rgb(15, 52, 96);border-left: 5px solid rgb(79, 195, 247);line-height: 1.4;font-weight: 700;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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=\"\">2.3 \u6570\u636e\u9694\u79bb\u7684\u4e09\u4e2a\u5c42\u6b21<\/span><\/h2>\n<table style=\"margin: 20px 0px;padding: 0px;box-sizing: border-box;width: 700px;border-collapse: collapse;font-size: 14px;color: rgb(44, 44, 58);font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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<thead>\n<tr style=\"margin: 0px;padding: 0px;box-sizing: border-box;\">\n<th style=\"margin: 0px;padding: 11px 14px;box-sizing: border-box;background: rgb(22, 33, 62);color: rgb(255, 255, 255);text-align: left;font-weight: 600;border-bottom: 2px solid rgb(79, 195, 247);\">\n<section style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(214, 168, 65);\">\u9694\u79bb\u5c42\u6b21<\/span><\/span><\/section>\n<\/th>\n<th style=\"margin: 0px;padding: 11px 14px;box-sizing: border-box;background: rgb(22, 33, 62);color: rgb(255, 255, 255);text-align: left;font-weight: 600;border-bottom: 2px solid rgb(79, 195, 247);\">\n<section style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(214, 168, 65);\">\u5b9e\u73b0\u65b9\u5f0f<\/span><\/span><\/section>\n<\/th>\n<th style=\"margin: 0px;padding: 11px 14px;box-sizing: border-box;background: rgb(22, 33, 62);color: rgb(255, 255, 255);text-align: left;font-weight: 600;border-bottom: 2px solid rgb(79, 195, 247);\">\n<section style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(214, 168, 65);\">\u9002\u7528\u573a\u666f<\/span><\/span><\/section>\n<\/th>\n<th style=\"margin: 0px;padding: 11px 14px;box-sizing: border-box;background: rgb(22, 33, 62);color: rgb(255, 255, 255);text-align: left;font-weight: 600;border-bottom: 2px solid rgb(79, 195, 247);\">\n<section style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(214, 168, 65);\">\u4f18\u70b9<\/span><\/span><\/section>\n<\/th>\n<th style=\"margin: 0px;padding: 11px 14px;box-sizing: border-box;background: rgb(22, 33, 62);color: rgb(255, 255, 255);text-align: left;font-weight: 600;border-bottom: 2px solid rgb(79, 195, 247);\">\n<section style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(214, 168, 65);\">\u7f3a\u70b9<\/span><\/span><\/section>\n<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr style=\"margin: 0px;padding: 0px;box-sizing: border-box;\">\n<td style=\"margin: 0px;padding: 10px 14px;box-sizing: border-box;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(51, 51, 51);\">\n<section><span leaf=\"\">\u6570\u636e\u5e93\u7ea7<\/span><\/section>\n<\/td>\n<td style=\"margin: 0px;padding: 10px 14px;box-sizing: border-box;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(51, 51, 51);\">\n<section><span leaf=\"\">\u4e8b\u52a1\u56de\u6eda<\/span><\/section>\n<\/td>\n<td style=\"margin: 0px;padding: 10px 14px;box-sizing: border-box;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(51, 51, 51);\">\n<section><span leaf=\"\">\u6709DB\u6d4b\u8bd5\u73af\u5883<\/span><\/section>\n<\/td>\n<td style=\"margin: 0px;padding: 10px 14px;box-sizing: border-box;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(51, 51, 51);\">\n<section><span leaf=\"\">100%\u9694\u79bb\uff0c\u65e0\u9700\u6e05\u7406<\/span><\/section>\n<\/td>\n<td style=\"margin: 0px;padding: 10px 14px;box-sizing: border-box;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(51, 51, 51);\">\n<section><span leaf=\"\">\u4e0d\u652f\u6301\u8de8DB\u4e8b\u52a1<\/span><\/section>\n<\/td>\n<\/tr>\n<tr style=\"margin: 0px;padding: 0px;box-sizing: border-box;background: rgb(246, 248, 251);\">\n<td style=\"margin: 0px;padding: 10px 14px;box-sizing: border-box;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(51, 51, 51);\">\n<section><span leaf=\"\">API\u7ea7<\/span><\/section>\n<\/td>\n<td style=\"margin: 0px;padding: 10px 14px;box-sizing: border-box;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(51, 51, 51);\">\n<section><span leaf=\"\">\u72ec\u7acb\u8d26\u53f7+UUID\u6570\u636e<\/span><\/section>\n<\/td>\n<td style=\"margin: 0px;padding: 10px 14px;box-sizing: border-box;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(51, 51, 51);\">\n<section><span leaf=\"\">\u5fae\u670d\u52a1\u63a5\u53e3\u6d4b\u8bd5<\/span><\/section>\n<\/td>\n<td style=\"margin: 0px;padding: 10px 14px;box-sizing: border-box;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(51, 51, 51);\">\n<section><span leaf=\"\">\u771f\u5b9e\u4e1a\u52a1\u573a\u666f<\/span><\/section>\n<\/td>\n<td style=\"margin: 0px;padding: 10px 14px;box-sizing: border-box;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(51, 51, 51);\">\n<section><span leaf=\"\">\u521b\u5efa\/\u6e05\u7406\u8017\u65f6<\/span><\/section>\n<\/td>\n<\/tr>\n<tr style=\"margin: 0px;padding: 0px;box-sizing: border-box;\">\n<td style=\"margin: 0px;padding: 10px 14px;box-sizing: border-box;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(51, 51, 51);\">\n<section><span leaf=\"\">\u6587\u4ef6\u7ea7<\/span><\/section>\n<\/td>\n<td style=\"margin: 0px;padding: 10px 14px;box-sizing: border-box;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(51, 51, 51);\">\n<section><span leaf=\"\">\u4e34\u65f6\u76ee\u5f55+UUID\u547d\u540d<\/span><\/section>\n<\/td>\n<td style=\"margin: 0px;padding: 10px 14px;box-sizing: border-box;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(51, 51, 51);\">\n<section><span leaf=\"\">\u6587\u4ef6\u4e0a\u4f20\/\u5bfc\u51fa\u6d4b\u8bd5<\/span><\/section>\n<\/td>\n<td style=\"margin: 0px;padding: 10px 14px;box-sizing: border-box;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(51, 51, 51);\">\n<section><span leaf=\"\">\u4e0d\u5f71\u54cd\u5176\u4ed6\u7528\u4f8b<\/span><\/section>\n<\/td>\n<td style=\"margin: 0px;padding: 10px 14px;box-sizing: border-box;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(51, 51, 51);\">\n<section><span leaf=\"\">\u6ce8\u610f\u78c1\u76d8\u7a7a\u95f4<\/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<p data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 18px;color: rgb(123, 12, 0);font-weight: bold;\">\u7b2c\u4e09\u7ae0&nbsp;<\/span><span textstyle=\"\" style=\"font-size: 18px;color: rgb(2, 30, 170);font-weight: bold;\">\u00b7 \u73af\u5883\u72b6\u6001\u6b8b\u7559\u2014\u2014\u4e0a\u6b21\u6267\u884c\u6c61\u67d3\u4e86\u4e0b\u6b21<\/span><\/span><\/p>\n<p><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 14px;\">Cookie\u3001LocalStorage\u3001\u540e\u53f0\u7f13\u5b58\u2026\u2026\u8fd9\u4e9b\u4e1c\u897f\u8ba9\u7528\u4f8b\u4ee5\u4e3a\u81ea\u5df1\u8fd0\u884c\u5728\u5e72\u51c0\u73af\u5883\u91cc\uff0c\u5b9e\u9645\u4e0a\u5df2\u7ecf\u88ab&#8221;\u6c61\u67d3&#8221;\u4e86<\/span><\/span><\/p>\n<h2 style=\"margin: 42px 0px 18px;padding: 0px 0px 0px 14px;box-sizing: border-box;font-size: 21px;color: rgb(15, 52, 96);border-left: 5px solid rgb(79, 195, 247);line-height: 1.4;font-weight: 700;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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=\"\">3.1 \u771f\u5b9e\u6848\u4f8b\uff1a\u79df\u6237\u6c61\u67d3\u5bfc\u81f4\u8fde\u7eed\u5931\u8d253\u5929<\/span><\/h2>\n<p style=\"margin: 14px 0px;padding: 0px;box-sizing: border-box;color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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=\"\">2024\u5e74\u505a\u4e00\u4e2a\u4fdd\u9669\u6838\u5fc3\u7cfb\u7edf\uff0c\u9879\u76ee\u67b6\u6784\u662f\u591a\u79df\u6237\u7684\uff0c\u6bcf\u5957\u73af\u5883\u5bf9\u5e94\u4e00\u4e2a\u79df\u6237ID\u3002\u6d4b\u8bd5\u56e2\u961f\u4e00\u5f00\u59cb\u7684\u505a\u6cd5\u662f\uff1a\u767b\u5f55\u65f6\u5e26\u4e0a\u79df\u6237ID\uff0c\u4e4b\u540e\u7684\u64cd\u4f5c\u9ed8\u8ba4\u5c31\u5e26\u8fd9\u4e2a\u79df\u6237\u4e0a\u4e0b\u6587\u3002<\/span><\/p>\n<p style=\"margin: 14px 0px;padding: 0px;box-sizing: border-box;color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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: 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-weight: bold;\">\u95ee\u9898\u6765\u4e86\uff1a<\/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=\"python\"><code><span leaf=\"\"><span class=\"code-snippet__comment\"># conftest.py \u2014 \u6709\u95ee\u9898\u7684setup\uff08\u65e9\u671f\u7248\u672c\uff09<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__meta\">@pytest.fixture(<\/span><span class=\"code-snippet__meta\"><span class=\"code-snippet__params\">scope=<\/span><\/span><span class=\"code-snippet__meta\"><span class=\"code-snippet__params\"><span class=\"code-snippet__string\">\"function\"<\/span><\/span><\/span><span class=\"code-snippet__meta\">)<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">browser<\/span>():<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; driver = Chrome()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; driver.implicitly_wait(<span class=\"code-snippet__number\">8<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">yield<\/span>&nbsp;driver<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; driver.quit()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u95ee\u9898\uff1a\u6ca1\u6709\u6e05\u7406Cookie\/LocalStorage\uff01<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># test_risk.py \u2014 \u79df\u6237A\u7684\u7528\u4f8b<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">test_risk_query_tenant_a<\/span>(<span class=\"code-snippet__params\">browser<\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; browser.get(<span class=\"code-snippet__string\">\"https:\/\/insure.example.com\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; browser.execute_script(<span class=\"code-snippet__string\">f\"localStorage.setItem('tenant_id', 'tenant_a')\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; browser.find_element(By.ID,&nbsp;<span class=\"code-snippet__string\">\"query-btn\"<\/span>).click()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;<span class=\"code-snippet__string\">\"tenant_a\"<\/span>&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;get_tenant_display(browser)<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># test_risk.py \u2014 \u79df\u6237B\u7684\u7528\u4f8b<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">test_risk_query_tenant_b<\/span>(<span class=\"code-snippet__params\">browser<\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; browser.get(<span class=\"code-snippet__string\">\"https:\/\/insure.example.com\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u95ee\u9898\uff1a\u6ca1\u6709\u663e\u5f0f\u8bbe\u7f6etenant_id\uff0c\u60f3\u5f53\u7136\u8ba4\u4e3a\u9ed8\u8ba4\u662ftenant_b<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u4f46\u4e0a\u4e00\u4e2a\u7528\u4f8b\u8bbe\u7f6e\u4e86tenant_a\u5230LocalStorage\uff0c<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u8fd9\u4e2a\u7528\u4f8b\u8bfb\u5230\u7684\u662ftenant_a\u7684\u6570\u636e\uff0c\u5bfc\u81f4\u65ad\u8a00\u5931\u8d25<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; browser.find_element(By.ID,&nbsp;<span class=\"code-snippet__string\">\"query-btn\"<\/span>).click()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;<span class=\"code-snippet__string\">\"tenant_b\"<\/span>&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;get_tenant_display(browser)<\/span><\/code><\/pre>\n<\/section>\n<p style=\"margin: 14px 0px;padding: 0px;box-sizing: border-box;color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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: 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=\"\">\u8fd9\u6761<\/span><span leaf=\"\" data-pm-slice=\"1 1 [&quot;para&quot;,{&quot;tagName&quot;:&quot;p&quot;,&quot;attributes&quot;:{&quot;style&quot;:&quot;margin: 14px 0px; padding: 0px; box-sizing: border-box; color: rgb(51, 51, 51); font-size: 15px; font-family: -apple-system, \\&quot;PingFang SC\\&quot;, \\&quot;Microsoft YaHei\\&quot;, \\&quot;Helvetica Neue\\&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;&quot;},&quot;namespaceURI&quot;:&quot;http:\/\/www.w3.org\/1999\/xhtml&quot;}]\">Fail<\/span><span leaf=\"\">\u6301\u7eed\u4e863\u5929\u624d\u88ab\u53d1\u73b0\u6839\u56e0\uff1a\u6bcf\u6b21\u5355\u72ec\u8dd1tenant_b\u7528\u4f8b\u901a\u8fc7\uff0c\u4e00\u8d77\u8dd1\u65f6\u5931\u8d25\u3002\u56e0\u4e3aLocalStorage\u91cc\u7684tenant_id\u88ab\u4e0a\u4e00\u4e2a\u7528\u4f8b\u6c61\u67d3\u4e86\u3002Selenium\u539f\u751f\u7684<\/span><code style=\"margin: 0px;padding: 0px;box-sizing: border-box;\"><span leaf=\"\"><span textstyle=\"\" style=\"background-color: rgb(255, 251, 0);color: rgb(2, 30, 170);\">delete_all_cookies()<\/span><\/span><\/code><span leaf=\"\">\u6839\u672c\u4e0d\u7ba1LocalStorage<\/span><\/p>\n<h2 style=\"margin: 42px 0px 18px;padding: 0px 0px 0px 14px;box-sizing: border-box;font-size: 21px;color: rgb(15, 52, 96);border-left: 5px solid rgb(79, 195, 247);line-height: 1.4;font-weight: 700;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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 \u6df1\u5ea6\u6e05\u7406\uff1adelete_all_cookies\u4e0d\u591f\u7528<\/span><\/h2>\n<p style=\"margin: 14px 0px;padding: 0px;box-sizing: border-box;color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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;\"><code style=\"margin: 0px;padding: 0px;box-sizing: border-box;\"><span leaf=\"\"><span textstyle=\"\" style=\"background-color: rgb(255, 251, 0);color: rgb(2, 30, 170);\">delete_all_cookies()<\/span><\/span><\/code><span leaf=\"\">\u53ea\u6e05HTTP Cookie\uff0cLocalStorage\u548cSessionStorage\u5b8c\u5168\u78b0\u4e0d\u5230\u3002\u6b63\u786e\u505a\u6cd5\u662f\u901a\u8fc7JavaScript\u6df1\u5ea6\u6e05\u7406\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<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<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\"># -*- coding: utf-8 -*-<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__string\">\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">\u6d4f\u89c8\u5668\u6df1\u5ea6\u6e05\u7406\u5de5\u5177 \u2014 \u6bd4delete_all_cookies\u66f4\u5f7b\u5e95<\/span><\/code><code><span leaf=\"\">\u89e3\u51b3LocalStorage\/SessionStorage\u6b8b\u7559\u5bfc\u81f4\u7684Fail<\/span><\/code><code><span leaf=\"\">\u4fdd\u9669\u6838\u5fc3\u7cfb\u7edf\u9879\u76ee\u5b9e\u8df5\u8bc1\u660e\uff1a\u5f15\u5165\u540eFlaky\u4ece\u6bcf\u5468\u5e73\u57474.3\u6761\u964d\u81f30.2\u6761<\/span><\/code><code><span leaf=\"\">\"\"\"<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">from<\/span>&nbsp;selenium.webdriver&nbsp;<span class=\"code-snippet__keyword\">import<\/span>&nbsp;Chrome<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">from<\/span>&nbsp;selenium.webdriver.chrome.options&nbsp;<span class=\"code-snippet__keyword\">import<\/span>&nbsp;Options<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;time<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">cleanup_browser_state<\/span>(<span class=\"code-snippet__params\">driver<\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u6df1\u5ea6\u6e05\u7406\u6d4f\u89c8\u5668\u72b6\u6001\uff0c\u9002\u7528\u4e8e\u540c\u4e00driver\u590d\u7528\u591a\u7528\u4f8b\u7684\u573a\u666f\u3002<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \"\"\"<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># 1. \u6e05\u7406\u6240\u6709Cookie\uff08delete_all_cookies\u80fd\u505a\u5230\u7684\uff09<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; driver.delete_all_cookies()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># 2. \u6e05\u7406LocalStorage + SessionStorage\uff08delete_all_cookies\u505a\u4e0d\u5230\u7684\u90e8\u5206\uff09<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; driver.execute_script(<span class=\"code-snippet__string\">\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; if (window.localStorage) window.localStorage.clear();<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; if (window.sessionStorage) window.sessionStorage.clear();<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \"\"\")<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"[\u6e05\u7406] LocalStorage + SessionStorage \u5df2\u6e05\u7a7a\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># 3. \u91cd\u7f6e\u7a97\u53e3\u5927\u5c0f\uff08\u907f\u514d\u4e0a\u6761\u7528\u4f8b\u6539\u53d8\u4e86\u7a97\u53e3\u5c3a\u5bf8\u5bfc\u81f4\u5143\u7d20\u5750\u6807\u53d8\u5316\uff09<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; driver.set_window_size(<span class=\"code-snippet__number\">1920<\/span>,&nbsp;<span class=\"code-snippet__number\">1080<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># 4. \u5207\u56de\u4e3b\u6587\u6863\uff08\u5982\u679c\u4e0a\u6761\u7528\u4f8b\u5728iframe\u91cc\u64cd\u4f5c\uff09<\/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.switch_to.default_content()<\/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\">pass<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">\"[\u6e05\u7406] \u6d4f\u89c8\u5668\u72b6\u6001\u6df1\u5ea6\u6e05\u7406\u5b8c\u6210\"<\/span>)<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__meta\">@pytest.fixture<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">isolated_browser<\/span>():<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u9694\u79bb\u6d4f\u89c8\u5668Fixture \u2014 \u6bcf\u6761\u7528\u4f8b\u524d\u540e\u81ea\u52a8\u6e05\u7406\u72b6\u6001\u3002<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u63a8\u8350\u5728conftest.py\u91cc\u5168\u5c40\u914d\u7f6e\uff0c\u6240\u6709\u7528\u4f8b\u81ea\u52a8\u4f7f\u7528\u3002<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \"\"\"<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; options = Options()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u6bcf\u6b21\u542f\u52a8\u4f7f\u7528\u65b0profile\u76ee\u5f55\uff0c\u5b8c\u5168\u9694\u79bb<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; options.add_argument(<span class=\"code-snippet__string\">f\"--user-data-dir=\/tmp\/qa-profile-<\/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\">int<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">(time.time())}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; driver = Chrome(options=options)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; driver.implicitly_wait(<span class=\"code-snippet__number\">5<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">yield<\/span>&nbsp;driver<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; cleanup_browser_state(driver)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; driver.quit()<\/span><\/code><\/pre>\n<\/section>\n<p style=\"margin: 14px 0px;padding: 0px;box-sizing: border-box;color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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: 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=\"\"><br  \/><\/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 leaf=\"\"><span textstyle=\"\" style=\"font-size: 18px;color: rgb(123, 12, 0);font-weight: bold;\">\u7b2c\u56db\u7ae0<\/span><span textstyle=\"\" style=\"font-size: 18px;font-weight: bold;\">&nbsp;<\/span><span textstyle=\"\" style=\"font-size: 18px;color: rgb(2, 30, 170);font-weight: bold;\">\u00b7 \u65f6\u5e8f\u7ade\u4e89\u2014\u2014\u5f02\u6b65\u5904\u7406\u7684\u5751<\/span><\/span><\/p>\n<p><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 12px;\">\u63a5\u53e3\u8fd4\u56de200 OK\u5e76\u4e0d\u610f\u5473\u7740\u6570\u636e\u5df2\u7ecf\u5904\u7406\u5b8c\u4e86\u3002\u5f02\u6b65\u65f6\u5e8f\u95ee<\/span><\/span><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 12px;\">\u9898<\/span><\/span><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 12px;\">\uff0c\u662f<\/span><\/span><span leaf=\"\" data-pm-slice=\"1 1 [&quot;para&quot;,{&quot;tagName&quot;:&quot;p&quot;,&quot;attributes&quot;:{&quot;style&quot;:&quot;margin: 14px 0px; padding: 0px; box-sizing: border-box; color: rgb(51, 51, 51); font-size: 15px; font-family: -apple-system, \\&quot;PingFang SC\\&quot;, \\&quot;Microsoft YaHei\\&quot;, \\&quot;Helvetica Neue\\&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;&quot;},&quot;namespaceURI&quot;:&quot;http:\/\/www.w3.org\/1999\/xhtml&quot;}]\"><span textstyle=\"\" style=\"font-size: 12px;\">Flaky<\/span><\/span><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 12px;\">\u7684<\/span><\/span><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 12px;\">\u91cd<\/span><\/span><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 12px;\">\u707e\u533a<\/span><\/span><\/p>\n<h2 style=\"margin: 42px 0px 18px;padding: 0px 0px 0px 14px;box-sizing: border-box;font-size: 21px;color: rgb(15, 52, 96);border-left: 5px solid rgb(79, 195, 247);line-height: 1.4;font-weight: 700;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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=\"\">4.1 \u771f\u5b9e\u6848\u4f8b\uff1a\u4e0b\u5355\u6210\u529f\uff0c\u5e93\u5b58\u5374\u6ca1\u6263<\/span><\/h2>\n<p style=\"margin: 14px 0px;padding: 0px;box-sizing: border-box;color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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=\"\">2025\u5e74\u505a\u652f\u4ed8\u6838\u5fc3\u7cfb\u7edf\u6539\u9020\u65f6\uff0c\u6709\u4e2a\u7528\u4f8b\u662f\uff1a\u63d0\u4ea4\u8ba2\u5355 \u2192 \u67e5\u8be2\u5e93\u5b58 \u2192 \u65ad\u8a00\u5e93\u5b58-1<\/span><\/p>\n<p style=\"margin: 14px 0px;padding: 0px;box-sizing: border-box;color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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: 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=\"\">\u4ee3\u7801\u903b\u8f91\u5f88\u6e05\u6670\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<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"apache\"><code><span leaf=\"\"><span class=\"code-snippet__comment\"># test_inventory.py \u2014 \u6709\u95ee\u9898\u7684\u7248\u672c<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__attribute\">def<\/span>&nbsp;test_order_deducts_inventory():<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__attribute\">init_stock<\/span>&nbsp;= get_stock(<span class=\"code-snippet__string\">\"SKU_2020\"<\/span>) &nbsp; &nbsp; &nbsp; &nbsp;# \u67e5\u8be2\u521d\u59cb\u5e93\u5b58:&nbsp;<span class=\"code-snippet__number\">100<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__attribute\">create_order<\/span>(<span class=\"code-snippet__string\">\"SKU_2020\"<\/span>, quantity=<span class=\"code-snippet__number\">1<\/span>) &nbsp; &nbsp; &nbsp;# \u521b\u5efa\u8ba2\u5355\uff0c\u63a5\u53e3\u8fd4\u56de<span class=\"code-snippet__number\">200<\/span>&nbsp;OK<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__attribute\">time<\/span>.sleep(<span class=\"code-snippet__number\">1<\/span>) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # \u7b49<span class=\"code-snippet__number\">1<\/span>\u79d2\uff08\u51ed\u611f\u89c9\u7b49\uff09<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__attribute\">final_stock<\/span>&nbsp;= get_stock(<span class=\"code-snippet__string\">\"SKU_2020\"<\/span>) &nbsp; &nbsp; &nbsp; # \u67e5\u8be2\u6700\u7ec8\u5e93\u5b58<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__attribute\">assert<\/span>&nbsp;final_stock == init_stock -&nbsp;<span class=\"code-snippet__number\">1<\/span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# \u671f\u671b:&nbsp;<span class=\"code-snippet__number\">99<\/span><\/span><\/code><\/pre>\n<\/section>\n<p style=\"margin: 14px 0px;padding: 0px;box-sizing: border-box;color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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;\" data-pm-slice=\"0 0 []\"><span leaf=\"\">\u8fd9\u6761\u7528\u4f8b\u5927\u698270%\u7684\u65f6\u95f4\u901a\u8fc7\uff0c30%\u7684\u65f6\u95f4\u5931\u8d25\u3002\u5931\u8d25\u7684\u65e5\u5fd7\u91cc\uff0c\u6700\u7ec8\u5e93\u5b58\u663e\u793a\u8fd8\u662f100\uff0c\u6ca1\u6709\u6263\u51cf<\/span><\/p>\n<p style=\"margin: 14px 0px;padding: 0px;box-sizing: border-box;color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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=\"\">\u6839\u56e0\u67e5\u4e86\u5f88\u4e45\uff0c\u6700\u540e\u53d1\u73b0\uff1a<\/span><strong style=\"margin: 0px;padding: 0px;box-sizing: border-box;\"><span leaf=\"\">\u5e93\u5b58\u6263\u51cf\u8d70\u7684\u662fMQ\u6d88\u606f\u961f\u5217<\/span><\/strong><span leaf=\"\">\uff08Kafka\uff09\uff0c\u4e0b\u5355\u63a5\u53e3\u8fd4\u56de200\u65f6\uff0c\u6d88\u606f\u53ea\u662f&#8221;\u53d1\u51fa\u53bb\u4e86&#8221;\uff0cKafka\u6d88\u8d39\u8005\u5f02\u6b65\u5904\u7406\u540e\u624d\u771f\u6b63\u6263\u51cf\u5e93\u5b58\u3002\u6b63\u5e38\u60c5\u51b5\u4e0b\u6d88\u8d39\u5ef6\u8fdf\u53ea\u67090.5~1.2\u79d2\uff0c\u4f46\u9ad8\u5cf0\u65f6\u6bb5\uff08\u4e0b\u53483~5\u70b9CI\u5e76\u53d1\u8dd1\u7684\u65f6\u5019\uff09\u4f1a\u5ef6\u8fdf\u52302~3\u79d2\uff0c\u56fa\u5b9a\u7b49\u5f851\u79d2\u5c31\u4e0d\u591f\u7528\u4e86<\/span><\/p>\n<p style=\"margin: 14px 0px;padding: 0px;box-sizing: border-box;color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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: 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=\"color: rgb(171, 25, 66);font-weight: bold;\">\u89e3\u51b3\u65b9\u6848\uff1a<\/span>\u4e0d\u7528\u56fa\u5b9a\u7b49\u5f85\uff0c\u7528\u8f6e\u8be2\u7b49\u5f85\u5e93\u5b58\u72b6\u6001\u771f\u6b63\u53d8\u5316<\/span><\/p>\n<h2 style=\"margin: 42px 0px 18px;padding: 0px 0px 0px 14px;box-sizing: border-box;font-size: 21px;color: rgb(15, 52, 96);border-left: 5px solid rgb(79, 195, 247);line-height: 1.4;font-weight: 700;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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=\"\">4.2 \u8f6e\u8be2\u7b49\u5f85\u6a21\u5f0f<\/span><\/h2>\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<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"python\"><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=\"\">\u5f02\u6b65\u8f6e\u8be2\u7b49\u5f85\u5de5\u5177 \u2014 \u5904\u7406MQ\/\u5f02\u6b65\u4efb\u52a1\u5b8c\u6210\u540e\u7684\u72b6\u6001\u68c0\u67e5<\/span><\/code><code><span leaf=\"\">\u652f\u4ed8\u6838\u5fc3\u7cfb\u7edf\u9879\u76ee\u5b9e\u8df5\u8bc1\u660e\uff1a\u5f15\u5165\u540e\u5e93\u5b58\u7528\u4f8b\u4ece70%\u7a33\u5b9a\u6027\u63d0\u5347\u81f399.8%<\/span><\/code><code><span leaf=\"\">\"\"\"<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;time<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">from<\/span>&nbsp;typing&nbsp;<span class=\"code-snippet__keyword\">import<\/span>&nbsp;<span class=\"code-snippet__type\">Callable<\/span>,&nbsp;<span class=\"code-snippet__type\">Optional<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">from<\/span>&nbsp;enum&nbsp;<span class=\"code-snippet__keyword\">import<\/span>&nbsp;Enum<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">from<\/span>&nbsp;dataclasses&nbsp;<span class=\"code-snippet__keyword\">import<\/span>&nbsp;dataclass<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">class<\/span>&nbsp;<span class=\"code-snippet__title\">AsyncStatus<\/span>(<span class=\"code-snippet__title\">Enum<\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; PENDING =&nbsp;<span class=\"code-snippet__string\">\"pending\"<\/span>&nbsp; &nbsp;<span class=\"code-snippet__comment\"># \u4efb\u52a1\u5904\u7406\u4e2d<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; SUCCESS =&nbsp;<span class=\"code-snippet__string\">\"success\"<\/span>&nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u4efb\u52a1\u5b8c\u6210<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; FAILED &nbsp;=&nbsp;<span class=\"code-snippet__string\">\"failed\"<\/span>&nbsp; &nbsp;<span class=\"code-snippet__comment\"># \u4efb\u52a1\u5931\u8d25<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">poll_until_done<\/span>(<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; check_fn:&nbsp;<span class=\"code-snippet__type\">Callable<\/span>[[], AsyncStatus],<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; timeout:&nbsp;<span class=\"code-snippet__built_in\">float<\/span>&nbsp;=&nbsp;<span class=\"code-snippet__number\">30.0<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; interval:&nbsp;<span class=\"code-snippet__built_in\">float<\/span>&nbsp;=&nbsp;<span class=\"code-snippet__number\">0.5<\/span>,<\/span><\/code><code><span leaf=\"\">) -&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; \u901a\u7528\u5f02\u6b65\u8f6e\u8be2\u51fd\u6570\u3002<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; Args:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; check_fn: \u72b6\u6001\u68c0\u67e5\u51fd\u6570\uff0c\u6bcf\u6b21\u8c03\u7528\u8fd4\u56de\u5f53\u524dAsyncStatus<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; timeout: \u6700\u5927\u7b49\u5f85\u79d2\u6570<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; interval: \u8f6e\u8be2\u95f4\u9694\u79d2\u6570<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; Returns:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; dict: \u5305\u542b success \/ elapsed \/ count \/ final_status<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \"\"\"<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; start = time.time()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; 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;<span class=\"code-snippet__literal\">True<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; elapsed = time.time() - start<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;elapsed &gt; timeout:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">raise<\/span>&nbsp;TimeoutError(<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">f\"\u8f6e\u8be2\u8d85\u65f6\uff1a\u7b49\u5f85<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{timeout}<\/span><\/span><span class=\"code-snippet__string\">s\u540e\u72b6\u6001\u4ecd\u4e3a<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{check_fn().value}<\/span><\/span><span class=\"code-snippet__string\">\uff0c\u8f6e\u8be2<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{count}<\/span><\/span><span class=\"code-snippet__string\">\u6b21\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; status = check_fn()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; count +=&nbsp;<span class=\"code-snippet__number\">1<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;status == AsyncStatus.SUCCESS:<\/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\">\"success\"<\/span>:&nbsp;<span class=\"code-snippet__literal\">True<\/span>,&nbsp;<span class=\"code-snippet__string\">\"elapsed\"<\/span>: time.time()-start,&nbsp;<span class=\"code-snippet__string\">\"count\"<\/span>: count}<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">elif<\/span>&nbsp;status == AsyncStatus.FAILED:<\/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\">\"success\"<\/span>:&nbsp;<span class=\"code-snippet__literal\">False<\/span>,&nbsp;<span class=\"code-snippet__string\">\"elapsed\"<\/span>: time.time()-start,&nbsp;<span class=\"code-snippet__string\">\"count\"<\/span>: count,&nbsp;<span class=\"code-snippet__string\">\"status\"<\/span>: status}<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; time.sleep(interval)<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># ===== \u4fee\u590d\u540e\u7684\u5e93\u5b58\u6d4b\u8bd5 =====<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">check_order_status<\/span>(<span class=\"code-snippet__params\">order_id:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">str<\/span><\/span>) -&gt; AsyncStatus:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"\u67e5\u8be2\u8ba2\u5355\u652f\u4ed8\u72b6\u6001\uff08\u5bf9\u5e94MQ\u6d88\u8d39\u5b8c\u6210\u540e\uff09\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; order = get_order(order_id)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;AsyncStatus(order[<span class=\"code-snippet__string\">\"status\"<\/span>]) &nbsp;<span class=\"code-snippet__comment\"># \"pending\" | \"paid\" | \"failed\"<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">test_order_deducts_inventory_fixed<\/span>():<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; init_stock = get_stock(<span class=\"code-snippet__string\">\"SKU_2020\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; order_id = create_order(<span class=\"code-snippet__string\">\"SKU_2020\"<\/span>, quantity=<span class=\"code-snippet__number\">1<\/span>) &nbsp;<span class=\"code-snippet__comment\"># \u8fd4\u56de200 OK<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u6b63\u786e\u505a\u6cd5\uff1a\u8f6e\u8be2\u7b49\u5f85\u8ba2\u5355\u72b6\u6001\u53d8\u4e3a\"\u5df2\u652f\u4ed8\"\uff08= MQ\u6d88\u8d39\u5b8c\u6210 = \u5e93\u5b58\u5df2\u6263\uff09<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; result = poll_until_done(<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">lambda<\/span>: check_order_status(order_id),<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; timeout=<span class=\"code-snippet__number\">30.0<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; interval=<span class=\"code-snippet__number\">1.0<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;result[<span class=\"code-snippet__string\">\"success\"<\/span>],&nbsp;<span class=\"code-snippet__string\">f\"\u8ba2\u5355\u652f\u4ed8\u8d85\u65f6\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; final_stock = get_stock(<span class=\"code-snippet__string\">\"SKU_2020\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;final_stock == init_stock -&nbsp;<span class=\"code-snippet__number\">1<\/span>,&nbsp;<span class=\"code-snippet__string\">f\"\u5e93\u5b58\u6263\u51cf\u5931\u8d25:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{init_stock}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;-&gt;&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{final_stock}<\/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\"\u2705 \u5e93\u5b58\u6263\u51cf\u6b63\u786e:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{init_stock}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;-&gt;&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{final_stock}<\/span><\/span><span class=\"code-snippet__string\">\uff0c\u8f6e\u8be2<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{result[<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'count'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">]}<\/span><\/span><span class=\"code-snippet__string\">\u6b21\uff0c\u8017\u65f6<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{result[<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'elapsed'<\/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\">s\"<\/span>)<\/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-ratio=\"0.4588235294117647\" data-s=\"300,640\" data-type=\"png\" data-w=\"1020\" type=\"block\" data-imgfileid=\"100000647\" data-aistatus=\"1\" src=\"https:\/\/mmbiz.qpic.cn\/mmbiz_png\/BWmfcibGhS1K87QafcNqv85lZDibcTPpQianY62hzPv83yL0tpicxYyjpFma3k9zVo7cSvz0PN6lPNPukKklrDljfWO5SmD4M06OukOaoVZOIA0\/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=\"margin: 14px 0px;padding: 0px;box-sizing: border-box;color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, sans-serif;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;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span style=\"color: rgb(111, 125, 150);font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, sans-serif;font-size: 13px;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=\"\">\u5f02\u6b65\u65f6\u5e8f\u7ade\u4e89\u793a\u610f\u56fe \u2014 \u9519\u8bef\u505a\u6cd5\u5728\u63a5\u53e3\u8fd4\u56de\u540e\u7acb\u5373\u65ad\u8a00\uff0c\u6b63\u786e\u505a\u6cd5\u662f\u8f6e\u8be2\u7b49\u5f85MQ\u6d88\u8d39\u5b8c\u6210<\/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 leaf=\"\"><span textstyle=\"\" style=\"font-size: 18px;color: rgb(171, 25, 66);font-weight: bold;\">\u7b2c\u4e94\u7ae0<\/span><span textstyle=\"\" style=\"font-size: 18px;color: rgb(2, 30, 170);font-weight: bold;\">&nbsp;\u00b7 \u5916\u90e8\u4f9d\u8d56\u4e0d\u7a33\u5b9a\u2014\u2014\u7f51\u7edc\/\u7b2c\u4e09\u65b9\/\u73af\u5883\u6ce2\u52a8<\/span><\/span><\/p>\n<p><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 12px;\">\u6709\u65f6<\/span><\/span><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 12px;\">\u5019<\/span><\/span><span leaf=\"\" data-pm-slice=\"1 1 [&quot;para&quot;,{&quot;tagName&quot;:&quot;p&quot;,&quot;attributes&quot;:{&quot;style&quot;:&quot;margin: 14px 0px; padding: 0px; box-sizing: border-box; color: rgb(51, 51, 51); font-size: 15px; font-family: -apple-system, \\&quot;PingFang SC\\&quot;, \\&quot;Microsoft YaHei\\&quot;, \\&quot;Helvetica Neue\\&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;&quot;},&quot;namespaceURI&quot;:&quot;http:\/\/www.w3.org\/1999\/xhtml&quot;}]\"><span textstyle=\"\" style=\"font-size: 12px;\">Flaky<\/span><\/span><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 12px;\">\u6839<\/span><\/span><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 12px;\">\u672c\u4e0d\u662f\u4f60\u7684\u95ee\u9898\uff0c\u662f\u5916\u9762\u7684\u4e16\u754c\u5728\u6ce2\u52a8<\/span><\/span><\/p>\n<h2 style=\"margin: 42px 0px 18px;padding: 0px 0px 0px 14px;box-sizing: border-box;font-size: 21px;color: rgb(15, 52, 96);border-left: 5px solid rgb(79, 195, 247);line-height: 1.4;font-weight: 700;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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=\"\">5.1 \u771f\u5b9e\u6848\u4f8b\uff1a\u7b2c\u4e09\u65b9\u77ed\u4fe1\u7f51\u5173\u51cc\u6668\u7ef4\u62a4\uff0c\u6301\u7eed\u7ea2\u82723\u5929<\/span><\/h2>\n<p style=\"margin: 14px 0px;padding: 0px;box-sizing: border-box;color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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=\"\">2024\u5e74\u505a\u4e92\u8054\u7f51\u4fdd\u9669\u9879\u76ee\uff0cCI\u914d\u7f6e\u4e86\u6bcf\u5929\u51cc\u66682\u70b9\u5b9a\u65f6\u6784\u5efa\u3002\u77ed\u4fe1\u9a8c\u8bc1\u7801\u7528\u4f8b\u8fde\u7eed3\u5929\u5931\u8d25\uff0c\u90fd\u662f\u8fd4\u56de503<\/span><\/p>\n<p style=\"margin: 14px 0px;padding: 0px;box-sizing: border-box;color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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=\"\">\u6392\u67e5\u8fc7\u7a0b\uff1a\u5f00\u53d1\u8bf4&#8221;\u4ee3\u7801\u6ca1\u95ee\u9898&#8221;\uff0c\u8fd0\u7ef4\u8bf4&#8221;\u670d\u52a1\u5668\u6ca1\u95ee\u9898&#8221;\uff0c\u6d4b\u8bd5\u8bf4&#8221;\u7528\u4f8b\u6ca1\u95ee\u9898&#8221;\u3002\u4e09\u4e2a\u4eba\u9762\u9762\u76f8\u89d1\u4e863\u5929\u3002\u6700\u540e\u53d1\u73b0\uff1a\u77ed\u4fe1\u670d\u52a1\u5546\u6bcf\u5929\u51cc\u66682:00~2:30\u6709\u7ef4\u62a4\u7a97\u53e3\uff0c\u63a5\u53e3\u4e0d\u53ef\u7528<\/span><\/p>\n<p style=\"margin: 14px 0px;padding: 0px;box-sizing: border-box;color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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: 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: rgb(255, 41, 65);font-weight: bold;\">\u6559\u8bad\uff1a<\/span><\/span><strong style=\"margin: 0px;padding: 0px;box-sizing: border-box;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(2, 30, 170);\">\u9047\u5230\u5916\u90e8\u4f9d\u8d56<\/span><\/span><span leaf=\"\" style=\"color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-weight: bold;margin: 0px;padding: 0px;box-sizing: border-box;\"><span textstyle=\"\" style=\"color: rgb(2, 30, 170);\">\u7c7b<\/span><\/span><span leaf=\"\" data-pm-slice=\"1 1 [&quot;para&quot;,{&quot;tagName&quot;:&quot;p&quot;,&quot;attributes&quot;:{&quot;style&quot;:&quot;margin: 14px 0px; padding: 0px; box-sizing: border-box; color: rgb(51, 51, 51); font-size: 15px; font-family: -apple-system, \\&quot;PingFang SC\\&quot;, \\&quot;Microsoft YaHei\\&quot;, \\&quot;Helvetica Neue\\&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;&quot;},&quot;namespaceURI&quot;:&quot;http:\/\/www.w3.org\/1999\/xhtml&quot;}]\" style=\"color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-weight: bold;margin: 0px;padding: 0px;box-sizing: border-box;\"><span textstyle=\"\" style=\"color: rgb(2, 30, 170);\">Fail<\/span><\/span><span leaf=\"\" style=\"color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-weight: bold;margin: 0px;padding: 0px;box-sizing: border-box;\"><span textstyle=\"\" style=\"color: rgb(2, 30, 170);\">\uff0c<\/span><\/span><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(2, 30, 170);\">\u5148\u67e5\u7b2c\u4e09\u65b9\u670d\u52a1\u72b6\u6001\u9875<\/span><\/span><\/strong><span leaf=\"\">\uff0c\u4e0d\u8981\u4ece\u81ea\u5df1\u7684\u4ee3\u7801\u67e5\u8d77<\/span><\/p>\n<h2 style=\"margin: 42px 0px 18px;padding: 0px 0px 0px 14px;box-sizing: border-box;font-size: 21px;color: rgb(15, 52, 96);border-left: 5px solid rgb(79, 195, 247);line-height: 1.4;font-weight: 700;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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=\"\">5.2 \u65b9\u6848\u4e00\uff1apytest-rerunfailures\u91cd\u8bd5\u7b56\u7565<\/span><\/h2>\n<p style=\"margin: 14px 0px;padding: 0px;box-sizing: border-box;color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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=\"\">\u5bf9\u4e8e\u5076\u53d1\u7684\u7f51\u7edc\u6296\u52a8\uff0c\u91cd\u8bd5\u662f\u6700\u7b80\u5355\u6709\u6548\u7684\u624b\u6bb5\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<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\"># pip install pytest-rerunfailures<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># ===== \u7528\u4f8b\u7ea7\u91cd\u8bd5\uff1a\u8c03\u7528\u7b2c\u4e09\u65b9API\u7684\u6d4b\u8bd5 =====<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__meta\">@pytest.mark.Fail(<\/span><span class=\"code-snippet__meta\"><span class=\"code-snippet__params\">reruns=<\/span><\/span><span class=\"code-snippet__meta\"><span class=\"code-snippet__params\"><span class=\"code-snippet__number\">3<\/span><\/span><\/span><span class=\"code-snippet__meta\"><span class=\"code-snippet__params\">, reruns_delay=<\/span><\/span><span class=\"code-snippet__meta\"><span class=\"code-snippet__params\"><span class=\"code-snippet__number\">2<\/span><\/span><\/span><span class=\"code-snippet__meta\">)<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">test_sms_api<\/span>():<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">import<\/span>&nbsp;requests<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; resp = requests.post(<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"https:\/\/api.sms.example.com\/send\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; json={<span class=\"code-snippet__string\">\"phone\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"+86-13800138000\"<\/span>,&nbsp;<span class=\"code-snippet__string\">\"msg\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"\u9a8c\u8bc1\u7801\uff1a123456\"<\/span>},<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; timeout=<span class=\"code-snippet__number\">10<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;resp.status_code ==&nbsp;<span class=\"code-snippet__number\">200<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;resp.json()[<span class=\"code-snippet__string\">\"code\"<\/span>] ==&nbsp;<span class=\"code-snippet__string\">\"success\"<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># ===== \u6761\u4ef6\u91cd\u8bd5\uff1a\u53ea\u5bf9\u7f51\u7edc\u9519\u8bef\u91cd\u8bd5\uff0c\u4e1a\u52a1\u9519\u8bef\u4e0d\u91cd\u8bd5 =====<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># \u547d\u4ee4\u884c\u4f7f\u7528\uff1apytest test_ext.py -v --reruns 3 --reruns-delay 1<\/span><\/span><\/code><\/pre>\n<\/section>\n<h2 style=\"margin: 42px 0px 18px;padding: 0px 0px 0px 14px;box-sizing: border-box;font-size: 21px;color: rgb(15, 52, 96);border-left: 5px solid rgb(79, 195, 247);line-height: 1.4;font-weight: 700;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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=\"\">5.3 \u65b9\u6848\u4e8c\uff1a\u6307\u6570\u9000\u907f\u91cd\u8bd5\u88c5\u9970\u5668<\/span><\/h2>\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<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"python\"><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=\"\">\u6307\u6570\u9000\u907f\u91cd\u8bd5\u88c5\u9970\u5668 \u2014 \u6bd4pytest-rerunfailures\u66f4\u7075\u6d3b<\/span><\/code><code><span leaf=\"\">\u7b2c1\u6b21\u5931\u8d25: \u7b491s | \u7b2c2\u6b21: \u7b492s | \u7b2c3\u6b21: \u7b494s | \u7b2c4\u6b21: \u7b498s ...<\/span><\/code><code><span leaf=\"\">\"\"\"<\/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;functools<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;logging<\/span><\/code><code><span leaf=\"\">logger = logging.getLogger(__name__)<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">retry_exponential<\/span>(<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; max_attempts:&nbsp;<span class=\"code-snippet__built_in\">int<\/span>&nbsp;=&nbsp;<span class=\"code-snippet__number\">4<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; base_delay:&nbsp;<span class=\"code-snippet__built_in\">float<\/span>&nbsp;=&nbsp;<span class=\"code-snippet__number\">1.0<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; max_delay:&nbsp;<span class=\"code-snippet__built_in\">float<\/span>&nbsp;=&nbsp;<span class=\"code-snippet__number\">30.0<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; exceptions = (<span class=\"code-snippet__params\">Exception,<\/span>),<\/span><\/code><code><span leaf=\"\">):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u6307\u6570\u9000\u907f\u91cd\u8bd5\u88c5\u9970\u5668\u3002<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; Args:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; max_attempts: \u6700\u5927\u5c1d\u8bd5\u6b21\u6570\uff08\u542b\u9996\u6b21\uff09<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; base_delay: \u57fa\u7840\u5ef6\u8fdf<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; max_delay: \u6700\u5927\u5ef6\u8fdf\u4e0a\u9650<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; exceptions: \u9700\u8981\u91cd\u8bd5\u7684\u5f02\u5e38\u7c7b\u578b<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \"\"\"<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">decorator<\/span>(<span class=\"code-snippet__params\">func<\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; @functools.wraps(func)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">wrapper<\/span>(<span class=\"code-snippet__params\">*args, **kwargs<\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">for<\/span>&nbsp;attempt&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;<span class=\"code-snippet__built_in\">range<\/span>(<span class=\"code-snippet__number\">1<\/span>, max_attempts +&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\">try<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; result = func(*args, **kwargs)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;attempt &gt;&nbsp;<span class=\"code-snippet__number\">1<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; logger.info(<span class=\"code-snippet__string\">f\"\u2705&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{func.__name__}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;\u7b2c<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{attempt}<\/span><\/span><span class=\"code-snippet__string\">\u6b21\u6210\u529f\"<\/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;result<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">except<\/span>&nbsp;exceptions&nbsp;<span class=\"code-snippet__keyword\">as<\/span>&nbsp;e:\\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;attempt == max_attempts:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; logger.error(<span class=\"code-snippet__string\">f\"\u274c&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{func.__name__}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;\u5168\u90e8<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{max_attempts}<\/span><\/span><span class=\"code-snippet__string\">\u6b21\u5c1d\u8bd5\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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">raise<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; delay =&nbsp;<span class=\"code-snippet__built_in\">min<\/span>(base_delay * (<span class=\"code-snippet__number\">2<\/span>&nbsp;** (attempt -&nbsp;<span class=\"code-snippet__number\">1<\/span>)), max_delay)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; logger.warning(<span class=\"code-snippet__string\">f\"\u26a0\ufe0f \u7b2c<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{attempt}<\/span><\/span><span class=\"code-snippet__string\">\u6b21\u5931\u8d25\uff0c<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{delay:<\/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\">s\u540e\u91cd\u8bd5:&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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; time.sleep(delay)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;wrapper<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;decorator<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># \u4f7f\u7528\u793a\u4f8b<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;random<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">unstable_api<\/span>():<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u6a21\u62df\uff1a30%\u6982\u7387\u8d85\u65f6\uff0c10%\u6982\u7387\u4e1a\u52a1\u9519\u8bef\uff0c60%\u6b63\u5e38<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; r = random.random()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;r &lt;&nbsp;<span class=\"code-snippet__number\">0.3<\/span>:&nbsp;<span class=\"code-snippet__keyword\">raise<\/span>&nbsp;TimeoutError(<span class=\"code-snippet__string\">\"\u8fde\u63a5\u8d85\u65f6\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;r &lt;&nbsp;<span class=\"code-snippet__number\">0.4<\/span>:&nbsp;<span class=\"code-snippet__keyword\">raise<\/span>&nbsp;ValueError(<span class=\"code-snippet__string\">\"\u4e1a\u52a1\u53c2\u6570\u9519\u8bef\uff08\u4e0d\u91cd\u8bd5\uff09\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;{<span class=\"code-snippet__string\">\"status\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"ok\"<\/span>}<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__meta\">@retry_exponential(<\/span><span class=\"code-snippet__meta\"><span class=\"code-snippet__params\">max_attempts=<\/span><\/span><span class=\"code-snippet__meta\"><span class=\"code-snippet__params\"><span class=\"code-snippet__number\">4<\/span><\/span><\/span><span class=\"code-snippet__meta\"><span class=\"code-snippet__params\">, base_delay=<\/span><\/span><span class=\"code-snippet__meta\"><span class=\"code-snippet__params\"><span class=\"code-snippet__number\">0.5<\/span><\/span><\/span><span class=\"code-snippet__meta\"><span class=\"code-snippet__params\">, max_delay=<\/span><\/span><span class=\"code-snippet__meta\"><span class=\"code-snippet__params\"><span class=\"code-snippet__number\">10.0<\/span><\/span><\/span><span class=\"code-snippet__meta\"><span class=\"code-snippet__params\">,<\/span><\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;exceptions=(<span class=\"code-snippet__params\">TimeoutError,<\/span>))<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">call_api<\/span>():<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># TimeoutError: \u6307\u6570\u9000\u907f\u91cd\u8bd5 | ValueError: \u76f4\u63a5\u629b\u51fa\u4e0d\u91cd\u8bd5<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;unstable_api()<\/span><\/code><\/pre>\n<\/section>\n<h2 style=\"margin: 42px 0px 18px;padding: 0px 0px 0px 14px;box-sizing: border-box;font-size: 21px;color: rgb(15, 52, 96);border-left: 5px solid rgb(79, 195, 247);line-height: 1.4;font-weight: 700;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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=\"\">5.4 \u65b9\u6848\u4e09\uff1a\u7194\u65ad\u964d\u7ea7<\/span><\/h2>\n<p style=\"margin: 14px 0px;padding: 0px;box-sizing: border-box;color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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=\"\">\u8fde\u7eedN\u6761\u7528\u4f8b\u5931\u8d25\u65f6\uff0c\u8bf4\u660e\u73af\u5883\u771f\u7684\u6709\u95ee\u9898\u4e86\uff0c\u7ee7\u7eed\u8dd1\u53ea\u4f1a\u6d88\u8017CI\u65f6\u95f4\u3002\u7194\u65ad\u964d\u7ea7\u81ea\u52a8\u8df3\u8fc7\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<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<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\"># -*- coding: utf-8 -*-<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__string\">\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">\u7194\u65ad\u5668 \u2014 \u8fde\u7eed\u73af\u5883\u5931\u8d25\u65f6\u81ea\u52a8\u8df3\u8fc7\u540e\u7eed\u7528\u4f8b<\/span><\/code><code><span leaf=\"\">\u4fdd\u9669\u6838\u5fc3\u7cfb\u7edf\u9879\u76ee\u4f7f\u7528\uff1a\u8fde\u7eed3\u6761external\u7528\u4f8b\u5931\u8d25\u5219\u7194\u65ad<\/span><\/code><code><span leaf=\"\">\"\"\"<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;pytest<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">from<\/span>&nbsp;typing&nbsp;<span class=\"code-snippet__keyword\">import<\/span>&nbsp;ClassVar<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">class<\/span>&nbsp;<span class=\"code-snippet__title\">CircuitBreaker<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; failure_count: ClassVar[<span class=\"code-snippet__built_in\">int<\/span>] =&nbsp;<span class=\"code-snippet__number\">0<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; is_open: ClassVar[<span class=\"code-snippet__built_in\">bool<\/span>] =&nbsp;<span class=\"code-snippet__literal\">False<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; threshold: ClassVar[<span class=\"code-snippet__built_in\">int<\/span>] =&nbsp;<span class=\"code-snippet__number\">3<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; @<span class=\"code-snippet__built_in\">classmethod<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">record_failure<\/span>(<span class=\"code-snippet__params\">cls<\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; cls.failure_count +=&nbsp;<span class=\"code-snippet__number\">1<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;cls.failure_count &gt;= cls.threshold:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cls.is_open =&nbsp;<span class=\"code-snippet__literal\">True<\/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\"\ud83d\udeab \u7194\u65ad\u6253\u5f00\uff01\u8fde\u7eed<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{cls.threshold}<\/span><\/span><span class=\"code-snippet__string\">\u6b21\u73af\u5883\u5931\u8d25\uff0c\u8df3\u8fc7\u540e\u7eed\u7528\u4f8b\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; @<span class=\"code-snippet__built_in\">classmethod<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">record_success<\/span>(<span class=\"code-snippet__params\">cls<\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; cls.failure_count =&nbsp;<span class=\"code-snippet__number\">0<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; cls.is_open =&nbsp;<span class=\"code-snippet__literal\">False<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; @<span class=\"code-snippet__built_in\">classmethod<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">skip_if_open<\/span>(<span class=\"code-snippet__params\">cls<\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;cls.is_open:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pytest.skip(<span class=\"code-snippet__string\">f\"\u7194\u65ad\u5df2\u6253\u5f00\uff08\u8fde\u7eed<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{cls.threshold}<\/span><\/span><span class=\"code-snippet__string\">\u6b21\u73af\u5883\u5931\u8d25\uff09\uff0c\u8df3\u8fc7\u6b64\u7528\u4f8b\"<\/span>)<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__meta\">@pytest.mark.external<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">test_sms_service<\/span>():<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; CircuitBreaker.record_success()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># ...\u6d4b\u8bd5\u903b\u8f91...<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># \u6548\u679c\uff1a\u8fde\u7eed3\u6761external\u5931\u8d25 \u2192 \u540e\u7eed\u7528\u4f8b\u81ea\u52a8\u8df3\u8fc7\uff0c\u4e0d\u6d88\u8017CI\u65f6\u95f4<\/span><\/span><\/code><\/pre>\n<\/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 leaf=\"\"><span textstyle=\"\" style=\"font-size: 18px;color: rgb(123, 12, 0);font-weight: bold;\">\u5b9e\u6218\u7ae0&nbsp;<\/span><span textstyle=\"\" style=\"font-size: 18px;color: rgb(2, 30, 170);font-weight: bold;\">\u00b7 \u5b9e\u6218\uff1a\u67d0\u91d1\u878d\u7cfb\u7edf\u767b\u5f55\u6a21<\/span><\/span><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 18px;color: rgb(2, 30, 170);font-weight: bold;\">\u5757<\/span><\/span><span leaf=\"\" data-pm-slice=\"1 1 [&quot;para&quot;,{&quot;tagName&quot;:&quot;p&quot;,&quot;attributes&quot;:{&quot;style&quot;:&quot;margin: 14px 0px; padding: 0px; box-sizing: border-box; color: rgb(51, 51, 51); font-size: 15px; font-family: -apple-system, \\&quot;PingFang SC\\&quot;, \\&quot;Microsoft YaHei\\&quot;, \\&quot;Helvetica Neue\\&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;&quot;},&quot;namespaceURI&quot;:&quot;http:\/\/www.w3.org\/1999\/xhtml&quot;}]\"><span textstyle=\"\" style=\"font-size: 18px;color: rgb(2, 30, 170);font-weight: bold;\">Flaky<\/span><\/span><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 18px;color: rgb(2, 30, 170);font-weight: bold;\">\u6392<\/span><\/span><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 18px;color: rgb(2, 30, 170);font-weight: bold;\">\u67e5\u5168\u8bb0\u5f55<\/span><\/span><\/p>\n<p><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 12px;\">\u5b8c\u6574\u7684\u6392\u67e5\u8fc7\u7a0b\uff1a\u95ee\u9898\u73b0\u8c61 \u2192 \u65e5\u5fd7\u5206\u6790 \u2192 \u6839\u56e0\u5b9a\u4f4d \u2192 \u4fee\u590d\u4ee3\u7801 \u2192 \u9a8c\u8bc1\u7ed3\u679c<\/span><\/span><\/p>\n<p data-pm-slice=\"0 0 []\" style=\"text-align: center;\"><span style=\"margin: 0px;padding: 0px;box-sizing: border-box;font-size: 18px;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(123, 12, 0);\">\ud83d\udd0d<\/span><\/span><\/span><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(123, 12, 0);\">\u95ee\u9898\u73b0\u8c61<\/span><\/span><\/p>\n<p style=\"margin: 10px 0px 14px;padding: 0px;box-sizing: border-box;color: rgb(85, 85, 85);font-size: 14px;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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: 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;\"><strong style=\"margin: 0px;padding: 0px;box-sizing: border-box;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;\">\u80cc\u666f\uff1a<\/span><\/span><\/strong><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;\">2025\u5e74Q2\uff0c\u67d0\u57ce\u5546\u884c\u6838\u5fc3\u7cfb\u7edf\u5347\u7ea7Python 3.10 + Selenium 4.x\u540e\uff0c\u767b\u5f55\u6a21\u57574\u6761\u7528\u4f8b\u5f00\u59cb\u5076\u53d1\u5931\u8d25<\/span><\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"576\">\n<p data-pm-slice=\"0 0 []\" style=\"text-align: left;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;color: rgb(136, 136, 136);\">\u3010CI\u65e5\u5fd7 &#8211; Jenkins Build&nbsp;<\/span><a class=\"wx_topic_link\" topic-id=\"mshnp06a-zfzkc5\" style=\"color: #576B95 !important;\" data-topic=\"1\" data-recommend=\"\"><span textstyle=\"\" style=\"font-size: 15px;color: rgb(136, 136, 136);\">#2847<\/span><\/a><span textstyle=\"\" style=\"font-size: 15px;color: rgb(136, 136, 136);\">\u3011FAILED test_login_password_visible \u2014 AssertionError: \u5bc6\u7801\u5b57\u6bb5\u4e0d\u53ef\u89c1<\/span><\/span><\/p>\n<p data-pm-slice=\"0 0 []\" style=\"text-align: left;\"><span leaf=\"\"><br  \/><\/span><\/p>\n<p style=\"text-align: left;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;color: rgb(136, 136, 136);\">\u3010CI\u65e5\u5fd7 &#8211; Jenkins Build&nbsp;<\/span><a class=\"wx_topic_link\" topic-id=\"mshnp06a-bbkbkk\" style=\"color: #576B95 !important;\" data-topic=\"1\" data-recommend=\"\"><span textstyle=\"\" style=\"font-size: 15px;color: rgb(136, 136, 136);\">#2849<\/span><\/a><span textstyle=\"\" style=\"font-size: 15px;color: rgb(136, 136, 136);\">\u3011PASSED (\u65e0\u6539\u52a8\uff0c\u7eff\u8272)<\/span><\/span><\/p>\n<p style=\"text-align: left;\"><span leaf=\"\"><br  \/><\/span><\/p>\n<p style=\"text-align: left;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;color: rgb(136, 136, 136);\">\u3010CI\u65e5\u5fd7 &#8211; Jenkins Build&nbsp;<\/span><a class=\"wx_topic_link\" topic-id=\"mshnp06b-9zzc8o\" style=\"color: #576B95 !important;\" data-topic=\"1\" data-recommend=\"\"><span textstyle=\"\" style=\"font-size: 15px;color: rgb(136, 136, 136);\">#2851<\/span><\/a><span textstyle=\"\" style=\"font-size: 15px;color: rgb(136, 136, 136);\">\u3011FAILED test_login_password_visible \u2014 TimeoutError: \u7b49\u5f85\u5bc6\u7801\u53ef\u89c1\u8d85\u65f6<\/span><\/span><\/p>\n<p style=\"text-align: left;\"><span leaf=\"\"><br  \/><\/span><\/p>\n<p style=\"text-align: left;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;color: rgb(136, 136, 136);\">\u3010CI\u65e5\u5fd7 &#8211; Jenkins Build&nbsp;<\/span><a class=\"wx_topic_link\" topic-id=\"mshnp06b-ujv7dw\" style=\"color: #576B95 !important;\" data-topic=\"1\" data-recommend=\"\"><span textstyle=\"\" style=\"font-size: 15px;color: rgb(136, 136, 136);\">#2853<\/span><\/a><span textstyle=\"\" style=\"font-size: 15px;color: rgb(136, 136, 136);\">\u3011PASSED (\u65e0\u6539\u52a8\uff0c\u7eff\u8272)<\/span><\/span><\/p>\n<p style=\"text-align: left;\"><span leaf=\"\"><br  \/><\/span><\/p>\n<p style=\"text-align: left;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;color: rgb(136, 136, 136);\">\u3010CI\u65e5\u5fd7 &#8211; Jenkins Build&nbsp;<\/span><a class=\"wx_topic_link\" topic-id=\"mshnp06b-bl4b08\" style=\"color: #576B95 !important;\" data-topic=\"1\" data-recommend=\"\"><span textstyle=\"\" style=\"font-size: 15px;color: rgb(136, 136, 136);\">#2854<\/span><\/a><span textstyle=\"\" style=\"font-size: 15px;color: rgb(136, 136, 136);\">\u3011FAILED test_login_password_visible \u2014 ElementNotInteractableException<\/span><\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"margin: 10px 0px 14px;padding: 0px;box-sizing: border-box;color: rgb(85, 85, 85);font-size: 14px;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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: 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;\"><strong style=\"margin: 0px;padding: 0px;box-sizing: border-box;color: rgb(85, 85, 85);font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, sans-serif;font-size: 14px;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, 251, 240);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\">\u5931\u8d25\u9891\u7387\uff1a<\/span><\/strong><span style=\"color: rgb(85, 85, 85);font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, sans-serif;font-size: 14px;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;background-color: rgb(255, 251, 240);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;\"><span leaf=\"\">4\u6761\u767b\u5f55\u7528\u4f8b\uff0c\u5728\u8fc7\u53bb14\u6b21CI\u6784\u5efa\u4e2d\uff0c\u5931\u8d25\u6b21\u6570\u5206\u522b\u4e3a\uff1a2\u6b21\u30010\u6b21\u30012\u6b21\u30011\u6b21\u30010\u6b21\u30013\u6b21\u2026\u2026\u5e73\u5747\u5931\u8d25\u7387\u7ea638%<\/span><\/span><\/p>\n<p data-pm-slice=\"0 0 []\" style=\"text-align: center;\"><span style=\"margin: 0px;padding: 0px;box-sizing: border-box;font-size: 18px;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(2, 30, 170);font-weight: bold;\">\ud83d\udd2c<\/span><\/span><\/span><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(2, 30, 170);font-weight: bold;\">\u6392\u67e5\u8fc7\u7a0b<\/span><\/span><\/p>\n<h4 style=\"margin: 20px 0px 10px;padding: 0px;box-sizing: border-box;font-size: 15px;color: rgb(44, 82, 130);font-weight: 600;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u6b65\u9aa41\uff1a\u9694\u79bb\u590d\u73b0<\/span><\/h4>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"php\"><code><span leaf=\"\"><span class=\"code-snippet__variable\">$ pytest<\/span>&nbsp;test_login.py::<span class=\"code-snippet__variable\">TestPasswordField<\/span>::<span class=\"code-snippet__variable\">test_login_password_visible<\/span>&nbsp;-v --count=<span class=\"code-snippet__number\">30<\/span><\/span><\/code><\/pre>\n<\/section>\n<p><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;\">\u7ed3\u679c\uff1a30\u6b21\u4e2d\u5931\u8d2512\u6b21\uff0c\u5931\u8d25\u738740%\uff0c\u6210\u529f\u590d\u73b0<\/span><\/span><\/p>\n<h4 style=\"margin: 20px 0px 10px;padding: 0px;box-sizing: border-box;font-size: 15px;color: rgb(44, 82, 130);font-weight: 600;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u6b65\u9aa42\uff1a\u9694\u79bb\u5176\u4ed6\u7528\u4f8b<\/span><\/h4>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"php\"><code><span leaf=\"\"><span class=\"code-snippet__variable\">$ pytest<\/span>&nbsp;test_login.py::<span class=\"code-snippet__variable\">TestPasswordField<\/span>::<span class=\"code-snippet__variable\">test_login_password_visible<\/span>&nbsp;-v -s<\/span><\/code><\/pre>\n<\/section>\n<p><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;\">\u7ed3\u679c\uff1a\u5355\u72ec\u8dd1\uff0c30\u6b21\u4e2d\u5931\u8d2514\u6b21\uff0c\u53cd\u800c\u66f4\u4e0d\u7a33\u5b9a\u4e86\uff08\u6000\u7591\u73af\u5883\u6c61\u67d3\uff09<\/span><\/span><\/p>\n<h4 style=\"margin: 20px 0px 10px;padding: 0px;box-sizing: border-box;font-size: 15px;color: rgb(44, 82, 130);font-weight: 600;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u6b65\u9aa43\uff1a\u52a0\u65e5\u5fd7 + \u622a\u56fe<\/span><\/h4>\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<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"python\"><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">test_login_password_visible<\/span>(<span class=\"code-snippet__params\">browser<\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; browser.get(<span class=\"code-snippet__string\">\"https:\/\/bank.example.com\/login\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; time.sleep(<span class=\"code-snippet__number\">1.5<\/span>) &nbsp;<span class=\"code-snippet__comment\"># \u65e7\u4ee3\u7801\uff1a\u56fa\u5b9a\u7b49\u5f85\uff0c\u7591\u4f3c\u95ee\u9898<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; pwd = browser.find_element(By.ID,&nbsp;<span class=\"code-snippet__string\">\"password\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u622a\u56fe\u4fdd\u5b58\uff0c\u65b9\u4fbf\u6392\u67e5<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; browser.save_screenshot(<span class=\"code-snippet__string\">f\"debug_pwd_<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{time.time()}<\/span><\/span><span class=\"code-snippet__string\">.png\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;pwd.is_displayed()<\/span><\/code><\/pre>\n<\/section>\n<p data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;\">\u3010\u622a\u56fe\u5206\u6790\u3011\u90e8\u5206\u622a\u56fe\u663e\u793a\uff1a\u5bc6\u7801\u5b57\u6bb5DOM\u5df2\u6e32\u67d3\uff0c\u4f46CSS opacity\u4ecd\u4e3a0\uff08\u52a8\u753b\u672a\u5b8c\u6210\uff09<\/span><\/span><\/p>\n<h4 style=\"margin: 20px 0px 10px;padding: 0px;box-sizing: border-box;font-size: 15px;color: rgb(44, 82, 130);font-weight: 600;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u6b65\u9aa44\uff1a\u6700\u5c0f\u5316\u590d\u73b0<\/span><\/h4>\n<p><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;\">\u5220\u9664\u6240\u6709\u5176\u4ed6\u6b65\u9aa4\uff0c\u53ea\u4fdd\u7559\uff1a\u6253\u5f00\u9875\u9762 \u2192 \u67e5\u5bc6\u7801\u5b57\u6bb5\u53ef\u89c1\u6027 \u2192 \u65ad\u8a00\u3002\u7ed3\u679c\uff1a\u5931\u8d25\u7387\u4ecd\u713640%<\/span><\/span><\/p>\n<p data-pm-slice=\"0 0 []\" style=\"text-align: center;\"><span style=\"margin: 0px;padding: 0px;box-sizing: border-box;font-size: 18px;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(64, 118, 0);font-weight: bold;\">\ud83c\udfaf<\/span><\/span><\/span><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(64, 118, 0);font-weight: bold;\">\u6839\u56e0\u5b9a\u4f4d<\/span><\/span><\/p>\n<p style=\"margin: 10px 0px 14px;padding: 0px;box-sizing: border-box;color: rgb(85, 85, 85);font-size: 14px;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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: 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;\"><span leaf=\"\">\u7ecf\u8fc7\u622a\u56fe\u5bf9\u6bd4\u5206\u6790\uff0c\u53d1\u73b0\uff1a<\/span><\/p>\n<ul style=\"margin: 8px 0px 14px 20px;padding: 0px;box-sizing: border-box;color: rgb(85, 85, 85);font-size: 14px;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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: 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;\" class=\"list-paddingleft-1\">\n<li style=\"margin: 0px 0px 8px;padding: 0px;box-sizing: border-box;line-height: 1.75;\">\n<section><span leaf=\"\">\u5931\u8d25\u7684\u622a\u56fe\u91cc\uff0c\u5bc6\u7801\u5b57\u6bb5opacity\u57280.0~0.4\u4e4b\u95f4\uff08CSS transition\u8fd8\u5728\u8dd1\uff09<\/span><\/section>\n<\/li>\n<li style=\"margin: 0px 0px 8px;padding: 0px;box-sizing: border-box;line-height: 1.75;\">\n<section><span leaf=\"\">\u6210\u529f\u7684\u622a\u56fe\u91cc\uff0c\u5bc6\u7801\u5b57\u6bb5opacity=1.0\uff08\u52a8\u753b\u5b8c\u6210\uff09<\/span><\/section>\n<\/li>\n<li style=\"margin: 0px 0px 8px;padding: 0px;box-sizing: border-box;line-height: 1.75;\">\n<section><span leaf=\"\">\u65e7\u4ee3\u7801\u7528\u4e86\u56fa\u5b9a\u7b49\u5f85<\/span><code style=\"margin: 0px;padding: 0px;box-sizing: border-box;\"><span leaf=\"\">time.sleep(1.5)<\/span><\/code><span leaf=\"\">\uff0c\u4f46CSS\u52a8\u753b\u5728CI\u673a\u5668\u4e0a\u8017\u65f61.2~2.1\u79d2\u4e0d\u7b49<\/span><\/section>\n<\/li>\n<li style=\"margin: 0px 0px 8px;padding: 0px;box-sizing: border-box;line-height: 1.75;\">\n<section><span leaf=\"\">\u672c\u5730\u673a\u5668\u6027\u80fd\u597d\uff0c\u52a8\u753b1.2\u79d2\u5185\u5b8c\u6210\uff1bCI\u673a\u5668\u5e76\u53d1\u65f6\uff0cCPU\u6253\u7d27\uff0c\u52a8\u753b\u5ef6\u8fdf\u52301.5\u79d2\u4ee5\u4e0a<\/span><\/section>\n<\/li>\n<\/ul>\n<blockquote style=\"margin: 14px 0px;padding: 14px 18px;box-sizing: border-box;background: rgb(240, 247, 255);border-left: 4px solid rgb(79, 195, 247);color: rgb(52, 73, 94);border-radius: 0px 6px 6px 0px;font-size: 14px;line-height: 1.75;font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&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: 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;\">\n<p><strong style=\"margin: 0px;padding: 0px;box-sizing: border-box;color: rgb(15, 52, 96);\"><span leaf=\"\">\u6839\u56e0\uff1a<\/span><\/strong><\/p>\n<section><span leaf=\"\">\u56fa\u5b9a\u7b49\u5f851.5\u79d2\uff0c\u9047\u4e0aCSS\u52a8\u753b1.2~2.1\u79d2\u7684\u4e0d\u7a33\u5b9a\u8017\u65f6\u3002\u5feb\u7684\u65f6\u5019\u901a\u8fc7\uff0c\u6162\u7684\u65f6\u5019<\/span><span leaf=\"\" data-pm-slice=\"1 1 [&quot;para&quot;,{&quot;tagName&quot;:&quot;p&quot;,&quot;attributes&quot;:{&quot;style&quot;:&quot;margin: 14px 0px; padding: 0px; box-sizing: border-box; color: rgb(51, 51, 51); font-size: 15px; font-family: -apple-system, \\&quot;PingFang SC\\&quot;, \\&quot;Microsoft YaHei\\&quot;, \\&quot;Helvetica Neue\\&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;&quot;},&quot;namespaceURI&quot;:&quot;http:\/\/www.w3.org\/1999\/xhtml&quot;}]\">Flaky<\/span><span leaf=\"\">\u3002\u8fd9\u8ddf\u4ee3\u7801\u8d28\u91cf\u65e0\u5173\uff0c\u8ddfCI\u673a\u5668\u8d1f\u8f7d\u6709\u5173<\/span><\/section>\n<\/blockquote>\n<p style=\"text-align: center;\"><span data-pm-slice=\"0 0 []\"><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=\"color: rgb(64, 118, 0);font-weight: bold;\">\ud83d\udd27<\/span><\/span><\/span><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=\"color: rgb(64, 118, 0);font-weight: bold;\">\u4fee\u590d\u4ee3\u7801<\/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<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"python\"><code><span leaf=\"\"><span class=\"code-snippet__comment\"># \u4fee\u590d\u524d\uff08\u65e7\u4ee3\u7801\uff09<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">test_login_password_visible<\/span>(<span class=\"code-snippet__params\">browser<\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; browser.get(<span class=\"code-snippet__string\">\"https:\/\/bank.example.com\/login\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; time.sleep(<span class=\"code-snippet__number\">1.5<\/span>) &nbsp;<span class=\"code-snippet__comment\"># \u274c \u56fa\u5b9a\u7b49\u5f85\uff0c\u4e0d\u7a33\u5b9a<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; pwd = browser.find_element(By.ID,&nbsp;<span class=\"code-snippet__string\">\"password\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;pwd.is_displayed()<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># \u4fee\u590d\u540e\uff08\u65b0\u4ee3\u7801\uff09<\/span><\/span><\/code><code><span leaf=\"\"><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=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">test_login_password_visible<\/span>(<span class=\"code-snippet__params\">browser<\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; browser.get(<span class=\"code-snippet__string\">\"https:\/\/bank.example.com\/login\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u2705 \u663e\u5f0f\u7b49\u5f85\uff1a\u7b49\u5bc6\u7801\u5b57\u6bb5opacity=1\uff08CSS\u52a8\u753b\u5b8c\u6210\uff09<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; pwd = WebDriverWait(browser,&nbsp;<span class=\"code-snippet__number\">10<\/span>).until(<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; EC.visibility_of_element_located((By.ID,&nbsp;<span class=\"code-snippet__string\">\"password\"<\/span>))<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;pwd.is_displayed()<\/span><\/code><\/pre>\n<\/section>\n<section style=\"text-align: center;\"><span data-pm-slice=\"0 0 []\"><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: 17px;color: rgb(123, 12, 0);font-weight: bold;\">\u2705<\/span><\/span><\/span><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: 17px;color: rgb(123, 12, 0);font-weight: bold;\">\u9a8c\u8bc1\u7ed3\u679c<\/span><\/span><\/section>\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"576\">\n<p data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;color: rgb(136, 136, 136);font-style: italic;\">$ pytest test_login.py::TestPasswordField -v &#8211;count=50<\/span><\/span><\/p>\n<p><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;color: rgb(61, 167, 66);font-weight: bold;\">\u4fee\u590d\u540e\uff1a<\/span><span textstyle=\"\" style=\"font-size: 15px;color: rgb(61, 167, 66);\">50\u6b21\u8fde\u7eed\u8fd0\u884c\uff0c50\u6b21\u901a\u8fc7\uff0c0\u6b21\u5931\u8d25<\/span><\/span><\/p>\n<p><span leaf=\"\"><br  \/><\/span><\/p>\n<p><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;color: rgb(136, 136, 136);font-style: italic;\">$ pytest test_login.py -v &#8211;count=20 # \u5168\u6a21\u5757\u7a33\u5b9a\u6027\u6d4b\u8bd5<\/span><\/span><\/p>\n<p><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;color: rgb(61, 167, 66);font-weight: bold;\">\u5168\u6a21\u575720\u6b21\u8fd0\u884c\uff1a<\/span><span textstyle=\"\" style=\"font-size: 15px;color: rgb(61, 167, 66);\">20\u6b21\u5168\u90e8\u7eff\u8272\u901a\u8fc7<\/span><\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<section style=\"text-align: center;\" nodeleaf=\"\">\n<figure class=\"wx-qr-wrap\"><img decoding=\"async\" class=\"rich_pages wxw-img\" data-ratio=\"0.337220602526725\" data-s=\"300,640\" data-type=\"png\" data-w=\"1029\" type=\"block\" data-imgfileid=\"100000648\" data-aistatus=\"1\" src=\"https:\/\/mmbiz.qpic.cn\/sz_mmbiz_png\/BWmfcibGhS1KoE98Iyu9m0hZmF0jmdc7kgnXrMKhKGmibqQO4APmkcTptvbzE1SMr7zcm6lVkOibiaKIZiapOMpo06X3bAIEyuiaMlcHvEOSic955E\/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(111, 125, 150);font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, sans-serif;font-size: 13px;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=\"\">Fail\u6392\u67e55\u6b65\u6cd5 \u2014 \u590d\u73b0\u2192\u9694\u79bb\u2192\u8bc1\u636e\u2192\u6700\u5c0f\u5316\u2192\u4fee\u590d\uff0c\u5faa\u5e8f\u6e10\u8fdb\u7cbe\u51c6\u5b9a\u4f4d\u6839\u56e0<\/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<p data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 18px;color: rgb(123, 12, 0);font-weight: bold;\">\u7b2c\u4e03\u7ae0<\/span><span textstyle=\"\" style=\"font-size: 18px;font-weight: bold;\">&nbsp;<\/span><span textstyle=\"\" style=\"font-size: 18px;color: rgb(2, 30, 170);font-weight: bold;\">\u00b7 \u9632\u60a3\u4e8e\u672a\u7136\u2014\u20145\u6761\u9884\u9632\u6e05\u5355<\/span><\/span><\/p>\n<p><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 12px;\">Fail\u4fee\u590d\u7684\u4f18\u89e3\uff0c\u662f\u8ba9\u5b83\u6839\u672c\u4e0d\u53d1\u751f\u3002\u4ee5\u4e0b5\u6761\u63aa\u65bd\u80fd\u8ba9\u4f60\u7684\u6d4b\u8bd5\u5957\u4ef6\u7a33\u5b9a\u4e00\u5927\u622a<\/span><\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"576\">\n<p data-pm-slice=\"2 2 []\" style=\"text-align: center;\"><span leaf=\"\">\u2705 \u6e05\u53551\uff1a\u7edf\u4e00\u7b49\u5f85\u7b56\u7565<\/span><\/p>\n<p style=\"margin: 14px 0px;padding: 0px;box-sizing: border-box;color: rgb(51, 51, 51);font-size: 15px;text-indent: 2em;\"><span leaf=\"\">\u7981\u6b62\u5728\u751f\u4ea7\u4ee3\u7801\u91cc\u4f7f\u7528<\/span><code style=\"margin: 0px;padding: 0px;box-sizing: border-box;\"><span leaf=\"\">time.sleep()<\/span><\/code><span leaf=\"\">\uff08\u8c03\u8bd5\u4e34\u65f6\u7528\u53ef\u4ee5\uff0c\u63d0\u4ea4\u524d\u5fc5\u987b\u5220\uff09\u3002\u6240\u6709\u4ea4\u4e92\u7edf\u4e00\u7528\u663e\u5f0f\u7b49\u5f85\u3002\u70b9\u51fb\u524d\u5fc5\u987b\u7528<\/span><code style=\"margin: 0px;padding: 0px;box-sizing: border-box;\"><span leaf=\"\">element_to_be_clickable<\/span><\/code><span leaf=\"\">\uff0c\u4e0d\u8981\u88f8\u8c03<\/span><code style=\"margin: 0px;padding: 0px;box-sizing: border-box;\"><span leaf=\"\">.click()<\/span><\/code><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"576\">\n<p data-pm-slice=\"2 2 []\" style=\"text-align: center;\"><span leaf=\"\">\u2705 \u6e05\u53552\uff1aFixture\u4f18\u5148\u539f\u5219<\/span><\/p>\n<p style=\"margin: 14px 0px;padding: 0px;box-sizing: border-box;color: rgb(51, 51, 51);font-size: 15px;text-indent: 2em;\"><span leaf=\"\">\u6bcf\u6761\u7528\u4f8b\u7684\u6570\u636e\u5fc5\u987b\u7531fixture\u521b\u5efa\uff0c\u7981\u6b62\u8de8\u7528\u4f8b\u5171\u4eab\u786c\u7f16\u7801\u6d4b\u8bd5\u6570\u636e\u3002\u5de5\u5382\u6a21\u5f0f\u662f\u4f18\u89e3\u2014\u2014\u6bcf\u6b21\u8c03\u7528<\/span><code style=\"margin: 0px;padding: 0px;box-sizing: border-box;\"><span leaf=\"\">fresh_user()<\/span><\/code><span leaf=\"\">\u90fd\u521b\u5efa\u5168\u65b0\u7684UUID\u7528\u6237\uff0c\u7528\u5b8c\u81ea\u52a8\u6e05\u7406<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"576\">\n<p data-pm-slice=\"2 2 []\" style=\"text-align: center;\"><span leaf=\"\">\u2705 \u6e05\u53553\uff1a\u6bcf\u6761\u7528\u4f8b\u540e\u6e05\u7406\u72b6\u6001<\/span><\/p>\n<p style=\"margin: 14px 0px;padding: 0px;box-sizing: border-box;color: rgb(51, 51, 51);font-size: 15px;text-indent: 2em;\"><span leaf=\"\">\u6d4b\u8bd5\u7ed3\u675f\u524d\u5fc5\u987b\u6e05\u7406\uff1aCookie\u3001LocalStorage\u3001SessionStorage\u3001\u7528\u4f8b\u521b\u5efa\u7684\u4e34\u65f6\u6570\u636e\u3002\u7528<\/span><code style=\"margin: 0px;padding: 0px;box-sizing: border-box;\"><span leaf=\"\">yield fixture<\/span><\/code><span leaf=\"\">\u81ea\u52a8\u6e05\u7406\u3002\u7528\u6df1\u5ea6\u6e05\u7406\u51fd\u6570\uff0c\u4e0d\u53ea\u662f\u8c03\u7528<\/span><code style=\"margin: 0px;padding: 0px;box-sizing: border-box;\"><span leaf=\"\">delete_all_cookies()<\/span><\/code><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"576\">\n<p data-pm-slice=\"2 2 []\" style=\"text-align: center;\"><span leaf=\"\">\u2705 \u6e05\u53554\uff1a\u5f02\u6b65\u64cd\u4f5c\u5fc5\u987b\u8f6e\u8be2\u7b49\u5f85<\/span><\/p>\n<p style=\"margin: 14px 0px;padding: 0px;box-sizing: border-box;color: rgb(51, 51, 51);font-size: 15px;\"><span leaf=\"\">\u4efb\u4f55\u6d89\u53ca\u5f02\u6b65\u4efb\u52a1\u7684\u65ad\u8a00\uff0c\u5728\u65ad\u8a00\u524d\u5fc5\u987b\u8f6e\u8be2\u7b49\u5f85\u72b6\u6001\u53d8\u4e3a\u5b8c\u6210\u3002\u7981\u6b62\u5728\u63a5\u53e3\u8fd4\u56de\u540e\u7acb\u5373\u65ad\u8a00\u3002<\/span><strong style=\"margin: 0px;padding: 0px;box-sizing: border-box;\"><span leaf=\"\">\u63a5\u53e3\u8fd4\u56de \u2260 \u6570\u636e\u5c31\u7eea\u3002<\/span><\/strong><span leaf=\"\">\u8bb0\u4f4f\u8fd9\u4e2a\u53e3\u8bc0<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"576\">\n<p data-pm-slice=\"2 2 []\" style=\"text-align: center;\"><span leaf=\"\">\u2705 \u6e05\u53555\uff1aCI\u8bbe\u7f6eFlaky\u544a\u8b66\u9608\u503c<\/span><\/p>\n<p style=\"margin: 14px 0px;padding: 0px;box-sizing: border-box;color: rgb(51, 51, 51);font-size: 15px;\"><span leaf=\"\">CI\u914d\u7f6e\u544a\u8b66\uff1a\u5f53Flaky\u7528\u4f8b\u8d85\u8fc7N\u6761\u65f6\u81ea\u52a8\u901a\u77e5\u3002\u907f\u514d\u6d4b\u8bd5\u5957\u4ef6\u5e26\u7740Flaky\u8dd1\u4e86\u597d\u51e0\u5468\u6ca1\u4eba\u7ba1\uff0c\u9020\u6210&#8221;\u72fc\u6765\u4e86&#8221;\u6548\u5e94\u2014\u2014\u771f\u6b63\u7684\u95ee\u9898\u88ab\u5ffd\u89c6<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><svg viewbox=\"0 0 760 300\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"background:#f8faff;\"><text x=\"380\" y=\"22\" text-anchor=\"middle\" fill=\"#0f3460\" font-size=\"14\" font-weight=\"700\"><tspan leaf=\"\">5\u5927\u6839\u56e0 \u2192 \u4fee\u590d\u65b9\u6848\u5bf9\u7167\u8868\uff08\u901f\u67e5\u7248\uff09<\/tspan><\/text><rect x=\"20\" y=\"38\" width=\"200\" height=\"28\" rx=\"4\" fill=\"#16213e\"><\/rect><text x=\"120\" y=\"56\" text-anchor=\"middle\" fill=\"#fff\" font-size=\"11\" font-weight=\"700\"><tspan leaf=\"\">Flaky\u6839\u56e0<\/tspan><\/text><rect x=\"220\" y=\"38\" width=\"200\" height=\"28\" rx=\"4\" fill=\"#16213e\"><\/rect><text x=\"320\" y=\"56\" text-anchor=\"middle\" fill=\"#fff\" font-size=\"11\" font-weight=\"700\"><tspan leaf=\"\">\u4fee\u590d\u5de5\u5177<\/tspan><\/text><rect x=\"420\" y=\"38\" width=\"320\" height=\"28\" rx=\"4\" fill=\"#16213e\"><\/rect><text x=\"580\" y=\"56\" text-anchor=\"middle\" fill=\"#fff\" font-size=\"11\" font-weight=\"700\"><tspan leaf=\"\">\u4fee\u590d\u6548\u679c\uff08\u5b9e\u6d4b\u6570\u636e\uff09<\/tspan><\/text><rect x=\"20\" y=\"68\" width=\"200\" height=\"38\" rx=\"4\" fill=\"#f0f7ff\"><\/rect><text x=\"120\" y=\"91\" text-anchor=\"middle\" fill=\"#0f3460\" font-size=\"11\" font-weight=\"600\"><tspan leaf=\"\">\u7b49\u5f85\u673a\u5236\u4e0d\u5f53<\/tspan><\/text><rect x=\"220\" y=\"68\" width=\"200\" height=\"38\" rx=\"4\" fill=\"#f0f7ff\"><\/rect><text x=\"320\" y=\"83\" text-anchor=\"middle\" fill=\"#0f3460\" font-size=\"10\"><tspan leaf=\"\">WebDriverWait<\/tspan><\/text><text x=\"320\" y=\"96\" text-anchor=\"middle\" fill=\"#6f7d96\" font-size=\"9\"><tspan leaf=\"\">element_to_be_clickable<\/tspan><\/text><rect x=\"420\" y=\"68\" width=\"320\" height=\"38\" rx=\"4\" fill=\"#f0f7ff\"><\/rect><text x=\"580\" y=\"91\" text-anchor=\"middle\" fill=\"#27ae60\" font-size=\"10\"><tspan leaf=\"\">\u57ce\u5546\u884c\u9879\u76ee\uff1a73%\u219299.2%<\/tspan><\/text><rect x=\"20\" y=\"108\" width=\"200\" height=\"38\" rx=\"4\" fill=\"#fff8ef\"><\/rect><text x=\"120\" y=\"131\" text-anchor=\"middle\" fill=\"#b8600a\" font-size=\"11\" font-weight=\"600\"><tspan leaf=\"\">\u6570\u636e\u4f9d\u8d56<\/tspan><\/text><rect x=\"220\" y=\"108\" width=\"200\" height=\"38\" rx=\"4\" fill=\"#fff8ef\"><\/rect><text x=\"320\" y=\"123\" text-anchor=\"middle\" fill=\"#b8600a\" font-size=\"10\"><tspan leaf=\"\">\u5de5\u5382Fixture<\/tspan><\/text><text x=\"320\" y=\"136\" text-anchor=\"middle\" fill=\"#8a6000\" font-size=\"9\"><tspan leaf=\"\">pytest yield teardown<\/tspan><\/text><rect x=\"420\" y=\"108\" width=\"320\" height=\"38\" rx=\"4\" fill=\"#fff8ef\"><\/rect><text x=\"580\" y=\"131\" text-anchor=\"middle\" fill=\"#27ae60\" font-size=\"10\"><tspan leaf=\"\">\u7535\u5546\u9879\u76ee\uff1a\u987a\u5e8f\u4f9d\u8d56\u21920%<\/tspan><\/text><rect x=\"20\" y=\"148\" width=\"200\" height=\"38\" rx=\"4\" fill=\"#f0fff4\"><\/rect><text x=\"120\" y=\"171\" text-anchor=\"middle\" fill=\"#27ae60\" font-size=\"11\" font-weight=\"600\"><tspan leaf=\"\">\u73af\u5883\u72b6\u6001\u6b8b\u7559<\/tspan><\/text><rect x=\"220\" y=\"148\" width=\"200\" height=\"38\" rx=\"4\" fill=\"#f0fff4\"><\/rect><text x=\"320\" y=\"163\" text-anchor=\"middle\" fill=\"#27ae60\" font-size=\"10\"><tspan leaf=\"\">JS\u6df1\u5ea6\u6e05\u7406<\/tspan><\/text><text x=\"320\" y=\"176\" text-anchor=\"middle\" fill=\"#6f7d96\" font-size=\"9\"><tspan leaf=\"\">localStorage\/sessionStorage<\/tspan><\/text><rect x=\"420\" y=\"148\" width=\"320\" height=\"38\" rx=\"4\" fill=\"#f0fff4\"><\/rect><text x=\"580\" y=\"171\" text-anchor=\"middle\" fill=\"#27ae60\" font-size=\"10\"><tspan leaf=\"\">\u4fdd\u9669\u7cfb\u7edf\uff1a4.3\u6761\/\u5468\u21920.2\u6761<\/tspan><\/text><rect x=\"20\" y=\"188\" width=\"200\" height=\"38\" rx=\"4\" fill=\"#f5f0ff\"><\/rect><text x=\"120\" y=\"211\" text-anchor=\"middle\" fill=\"#7d3c98\" font-size=\"11\" font-weight=\"600\"><tspan leaf=\"\">\u5f02\u6b65\u65f6\u5e8f\u7ade\u4e89<\/tspan><\/text><rect x=\"220\" y=\"188\" width=\"200\" height=\"38\" rx=\"4\" fill=\"#f5f0ff\"><\/rect><text x=\"320\" y=\"203\" text-anchor=\"middle\" fill=\"#7d3c98\" font-size=\"10\"><tspan leaf=\"\">poll_until_done<\/tspan><\/text><text x=\"320\" y=\"216\" text-anchor=\"middle\" fill=\"#6f7d96\" font-size=\"9\"><tspan leaf=\"\">\u5f02\u6b65\u8f6e\u8be2\u7b49\u5f85<\/tspan><\/text><rect x=\"420\" y=\"188\" width=\"320\" height=\"38\" rx=\"4\" fill=\"#f5f0ff\"><\/rect><text x=\"580\" y=\"211\" text-anchor=\"middle\" fill=\"#27ae60\" font-size=\"10\"><tspan leaf=\"\">\u652f\u4ed8\u6838\u5fc3\uff1a70%\u219299.8%<\/tspan><\/text><rect x=\"20\" y=\"228\" width=\"200\" height=\"38\" rx=\"4\" fill=\"#fff5f5\"><\/rect><text x=\"120\" y=\"251\" text-anchor=\"middle\" fill=\"#c0392b\" font-size=\"11\" font-weight=\"600\"><tspan leaf=\"\">\u5916\u90e8\u4f9d\u8d56\u6ce2\u52a8<\/tspan><\/text><rect x=\"220\" y=\"228\" width=\"200\" height=\"38\" rx=\"4\" fill=\"#fff5f5\"><\/rect><text x=\"320\" y=\"243\" text-anchor=\"middle\" fill=\"#c0392b\" font-size=\"10\"><tspan leaf=\"\">\u91cd\u8bd5+\u7194\u65ad<\/tspan><\/text><text x=\"320\" y=\"256\" text-anchor=\"middle\" fill=\"#6f7d96\" font-size=\"9\"><tspan leaf=\"\">rerunfailures+\u7194\u65ad\u5668<\/tspan><\/text><rect x=\"420\" y=\"228\" width=\"320\" height=\"38\" rx=\"4\" fill=\"#fff5f5\"><\/rect><text x=\"580\" y=\"251\" text-anchor=\"middle\" fill=\"#27ae60\" font-size=\"10\"><tspan leaf=\"\">\u77ed\u4fe1\u7f51\u5173\uff1a\u51cc\u6668\u7ef4\u62a4\u2192\u81ea\u52a8\u8bc6\u522b\u8df3\u8fc7<\/tspan><\/text><text x=\"380\" y=\"285\" text-anchor=\"middle\" fill=\"#9fb3cc\" font-size=\"10\"><tspan leaf=\"\">\u6240\u6709\u5b9e\u6d4b\u6570\u636e\u6765\u81ea\u771f\u5b9e\u9879\u76ee\uff1a\u57ce\u5546\u884c\u6838\u5fc3\u7cfb\u7edf\uff082019\uff09\u3001\u7535\u5546\u7cfb\u7edf\uff082021\uff09\u3001\u4fdd\u9669\u6838\u5fc3\u7cfb\u7edf\uff082022\uff09\u3001\u652f\u4ed8\u6838\u5fc3\u7cfb\u7edf\uff082020\uff09<\/tspan><\/text><\/svg><\/p>\n<p style=\"margin: 8px 0px 14px;padding: 0px;box-sizing: border-box;color: rgb(111, 125, 150);font-size: 13px;text-align: center;\"><span leaf=\"\">5\u5927\u6839\u56e0\u4fee\u590d\u65b9\u6848\u901f\u67e5\u8868 \u2014 \u5bf9\u53f7\u5165\u5ea7\uff0c\u5feb\u901f\u4fee\u590d<\/span><\/p>\n<section class=\"mp_vote_iframe_wrp\" nodeleaf=\"\"><mp-common-vote class=\"js_editor_vote_card js_uneditable custom_select_card mp_vote_iframe\" data-pluginname=\"mpvote\" data-supervoteid=\"620209905\" data-expiretime=\"0\" data-votesubject=\"[{&quot;type&quot;:2,&quot;title&quot;:&quot;\u4f60\u9047\u5230\u8fc7\u7684Flaky\u662f\u54ea\u4e00\u79cd\uff1f&quot;,&quot;options&quot;:[{&quot;name&quot;:&quot;\u7b49\u5f85\u673a\u5236\u4e0d\u5f53\uff08\u5143\u7d20\u51fa\u73b0\u2260\u53ef\u70b9\u51fb\uff09&quot;,&quot;url&quot;:&quot;&quot;,&quot;cnt&quot;:0},{&quot;name&quot;:&quot;\u6d4b\u8bd5\u6570\u636e\u4f9d\u8d56\uff08\u7528\u4f8b\u95f4\u76f8\u4e92\u5f71\u54cd\uff09&quot;,&quot;url&quot;:&quot;&quot;,&quot;cnt&quot;:0},{&quot;name&quot;:&quot;\u73af\u5883\u72b6\u6001\u6b8b\u7559\uff08Cookie\/Cache\u6c61\u67d3\uff09&quot;,&quot;url&quot;:&quot;&quot;,&quot;cnt&quot;:0},{&quot;name&quot;:&quot;\u5f02\u6b65\u64cd\u4f5c\u65f6\u5e8f\u95ee\u9898\uff08\u6570\u636e\u8fd8\u6ca1\u597d\u5c31\u65ad\u8a00\uff09&quot;,&quot;url&quot;:&quot;&quot;,&quot;cnt&quot;:0},{&quot;name&quot;:&quot;\u7b2c\u4e09\u65b9\u4f9d\u8d56\u4e0d\u7a33\u5b9a\uff08\u7f51\u7edc\/API\u6296\u52a8\uff09&quot;,&quot;url&quot;:&quot;&quot;,&quot;cnt&quot;:0},{&quot;name&quot;:&quot;\u5176\u4ed6&quot;,&quot;url&quot;:&quot;&quot;,&quot;cnt&quot;:0}],&quot;total_cnt&quot;:0}]\" data-delflag=\"0\" data-fail=\"0\"><\/mp-common-vote><\/section>\n<section style=\"text-align: left;\"><span style=\"color: rgb(111, 125, 150);font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, sans-serif;font-size: 13px;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=\"\"><br  \/><\/span><\/span><\/section>\n<section style=\"text-align: left;\"><span style=\"color: rgb(111, 125, 150);font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, sans-serif;font-size: 13px;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=\"\"><br  \/><\/span><\/span><\/section>\n<section style=\"text-align: left;\"><span style=\"color: rgb(111, 125, 150);font-family: -apple-system, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, sans-serif;font-size: 13px;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=\"\"><br  \/><\/span><\/span><\/section>\n<p style=\"display: none;\"><mp-style-type data-value=\"3\"><\/mp-style-type><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5f15\u8a00\uff1a\u90a3\u4e2a\u8ba9\u6211\u5931\u7720\u7684\u5468\u4e94\u665a\u4e0a \u4e00\u4e2a\u5468\u672b\u7684\u665a\u4e0a\uff0c\u6211\u8bb0\u5f97\u5f88\u6e05\u695a\u2014\u2014\u5f53\u65f6\u5728\u7ed9\u4e00\u5bb6\u57ce\u5546\u884c\u505a\u6d4b\u8bd5\u6846\u67b6\u5347\u7ea7\uff0c\u4e0a\u7ebf\u524d\u591c\uff0c\u6240\u6709 [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":94,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-95","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-auto-tools"],"_links":{"self":[{"href":"https:\/\/www.deartester.com\/index.php\/wp-json\/wp\/v2\/posts\/95","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=95"}],"version-history":[{"count":1,"href":"https:\/\/www.deartester.com\/index.php\/wp-json\/wp\/v2\/posts\/95\/revisions"}],"predecessor-version":[{"id":199,"href":"https:\/\/www.deartester.com\/index.php\/wp-json\/wp\/v2\/posts\/95\/revisions\/199"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.deartester.com\/index.php\/wp-json\/wp\/v2\/media\/94"}],"wp:attachment":[{"href":"https:\/\/www.deartester.com\/index.php\/wp-json\/wp\/v2\/media?parent=95"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.deartester.com\/index.php\/wp-json\/wp\/v2\/categories?post=95"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.deartester.com\/index.php\/wp-json\/wp\/v2\/tags?post=95"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}