{"id":53218,"date":"2024-12-03T12:04:32","date_gmt":"2024-12-03T04:04:32","guid":{"rendered":"https:\/\/fwq.ai\/blog\/53218\/"},"modified":"2024-12-03T12:04:32","modified_gmt":"2024-12-03T04:04:32","slug":"%e4%ba%86%e8%a7%a3-playwright%ef%bc%9a%e8%87%aa%e5%8a%a8%e5%8c%96-web-%e6%b5%8b%e8%af%95%e7%9a%84%e6%9c%aa%e6%9d%a5","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/53218\/","title":{"rendered":"\u4e86\u89e3 Playwright\uff1a\u81ea\u52a8\u5316 Web \u6d4b\u8bd5\u7684\u672a\u6765"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>\u4e86\u89e3 Playwright\uff1a\u81ea\u52a8\u5316 Web \u6d4b\u8bd5\u7684\u672a\u6765<\/h1>\n<p><span style=\"cursor: pointer\"><i><\/i>\u6536\u85cf<\/span>    <\/p>\n<p>\u5728IT\u884c\u4e1a\u8fd9\u4e2a\u53d1\u5c55\u66f4\u65b0\u901f\u5ea6\u5f88\u5feb\u7684\u884c\u4e1a\uff0c\u53ea\u6709\u4e0d\u505c\u6b62\u7684\u5b66\u4e60\uff0c\u624d\u4e0d\u4f1a\u88ab\u884c\u4e1a\u6240\u6dd8\u6c70\u3002\u5982\u679c\u4f60\u662f\u6587\u7ae0\u5b66\u4e60\u8005\uff0c\u90a3\u4e48\u672c\u6587\u300a\u4e86\u89e3 Playwright\uff1a\u81ea\u52a8\u5316 Web \u6d4b\u8bd5\u7684\u672a\u6765\u300b\u5c31\u5f88\u9002\u5408\u4f60\uff01\u672c\u7bc7\u5185\u5bb9\u4e3b\u8981\u5305\u62ec##content_title##\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u7684\u77e5\u8bc6\u79ef\u7d2f\u6709\u6240\u5e2e\u52a9\uff0c\u52a9\u529b\u5b9e\u6218\u5f00\u53d1\uff01<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241128\/17327601726747d26c9f208.jpg\" class=\"aligncenter\" title=\"\u4e86\u89e3 Playwright\uff1a\u81ea\u52a8\u5316 Web \u6d4b\u8bd5\u7684\u672a\u6765\u63d2\u56fe\" alt=\"\u4e86\u89e3 Playwright\uff1a\u81ea\u52a8\u5316 Web \u6d4b\u8bd5\u7684\u672a\u6765\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5267\u4f5c\u5bb6\u7684\u5b9a\u4e49<\/strong><\/p>\n<p>Playwright \u662f\u4e00\u4e2a\u73b0\u4ee3\u7684\u5f00\u6e90\u6d4b\u8bd5\u6846\u67b6\uff0c\u4f7f\u5f00\u53d1\u4eba\u5458\u80fd\u591f\u4ee5\u901f\u5ea6\u3001\u53ef\u9760\u6027\u548c\u8de8\u6d4f\u89c8\u5668\u652f\u6301\u81ea\u52a8\u6267\u884c Web \u5e94\u7528\u7a0b\u5e8f\u7684\u7aef\u5230\u7aef\u6d4b\u8bd5\u3002\u5b83\u7531 Microsoft \u6784\u5efa\uff0c\u89e3\u51b3\u4e86\u4f20\u7edf\u6d4b\u8bd5\u5de5\u5177\u9762\u4e34\u7684\u8bb8\u591a\u6311\u6218\uff0c\u4e3a\u73b0\u4ee3 Web \u5e94\u7528\u7a0b\u5e8f\u63d0\u4f9b\u65e0\u7f1d\u81ea\u52a8\u5316\u3002<\/p>\n<p><strong>\u4ec0\u4e48\u662f\u5267\u4f5c\u5bb6\uff1f<\/strong><\/p>\n<p>Playwright \u662f\u4e00\u4e2a Node.js \u5e93\uff0c\u65e8\u5728\u81ea\u52a8\u5316\u6d4f\u89c8\u5668\u4ea4\u4e92\uff0c\u4e3a Web \u5e94\u7528\u7a0b\u5e8f\u6d4b\u8bd5\u63d0\u4f9b\u5f3a\u5927\u7684\u89e3\u51b3\u65b9\u6848\u3002\u4e0e\u4e13\u6ce8\u4e8e\u5355\u6d4f\u89c8\u5668\u81ea\u52a8\u5316\u7684\u65e7\u5de5\u5177\u4e0d\u540c\uff0cPlaywright \u652f\u6301\u591a\u79cd\u6d4f\u89c8\u5668\uff0c\u5305\u62ec Chromium\u3001Firefox \u548c WebKit\uff0c\u786e\u4fdd\u6d4b\u8bd5\u8986\u76d6\u4e0d\u540c\u7684\u7528\u6237\u73af\u5883\u3002\u5b83\u5904\u7406\u52a8\u6001\u7f51\u9875\u5185\u5bb9\u548c\u7528\u6237\u4ea4\u4e92\u7684\u80fd\u529b\u4f7f\u5176\u6210\u4e3a\u5f00\u53d1\u4eba\u5458\u7684\u51fa\u8272\u9009\u62e9\u3002<\/p>\n<p><strong>\u5267\u4f5c\u5bb6\u7684\u4e3b\u8981\u7279\u70b9<\/strong><\/p>\n<p>Playwright \u5177\u6709\u6ee1\u8db3\u73b0\u4ee3 Web \u5e94\u7528\u7a0b\u5e8f\u9700\u6c42\u7684\u529f\u80fd\uff1a<\/p>\n<ul>\n<li> <strong>\u8de8\u6d4f\u89c8\u5668\u6d4b\u8bd5<\/strong>\uff1a\u652f\u6301 Chromium\uff08Google Chrome\u3001Microsoft Edge\uff09\u3001Firefox \u548c WebKit\uff08Safari\uff09\uff0c\u5b9e\u73b0\u8de8\u591a\u4e2a\u6d4f\u89c8\u5668\u7684\u4e00\u81f4\u6d4b\u8bd5\u3002<\/li>\n<li> <strong>\u65e0\u5934\u548c\u6709\u5934\u6a21\u5f0f<\/strong>\uff1a\u5728\u65e0\u5934\u6a21\u5f0f\u4e0b\u8fd0\u884c\u6d4b\u8bd5\u4ee5\u63d0\u9ad8\u901f\u5ea6\uff0c\u6216\u5728\u6709\u5934\u6a21\u5f0f\u4e0b\u8fd0\u884c\u6d4b\u8bd5\u4ee5\u8fdb\u884c\u8c03\u8bd5\u3002<\/li>\n<li> <strong>\u81ea\u52a8\u7b49\u5f85<\/strong>\uff1a\u5267\u4f5c\u5bb6\u7b49\u5f85\u5143\u7d20\u52a0\u8f7d\u6216\u8fbe\u5230\u7279\u5b9a\u72b6\u6001\uff0c\u51cf\u5c11\u6d4b\u8bd5\u4e2d\u7684\u4e0d\u7a33\u5b9a\u3002<\/li>\n<li> <strong>\u5e76\u884c\u6d4b\u8bd5\u6267\u884c<\/strong>\uff1a\u901a\u8fc7\u540c\u65f6\u8fd0\u884c\u591a\u4e2a\u6d4b\u8bd5\u7528\u4f8b\u6765\u52a0\u5feb\u6d4b\u8bd5\u901f\u5ea6\u3002<\/li>\n<\/ul>\n<p><strong>\u5267\u4f5c\u5bb6\u662f\u5982\u4f55\u5de5\u4f5c\u7684\uff1f<\/strong><\/p>\n<p>Playwright \u4f7f\u7528 WebSocket \u8fde\u63a5\u4e0e\u6d4f\u89c8\u5668\u5f15\u64ce\u8fdb\u884c\u901a\u4fe1\uff0c\u4e3a\u5f00\u53d1\u4eba\u5458\u63d0\u4f9b\u5bf9\u6d4f\u89c8\u5668\u64cd\u4f5c\u7684\u7cbe\u786e\u63a7\u5236\u3002\u5b83\u521b\u5efa\u6a21\u62df\u5355\u4e2a\u7528\u6237\u7684\u9694\u79bb\u6d4f\u89c8\u5668\u4e0a\u4e0b\u6587\uff0c\u4f7f\u5176\u6210\u4e3a\u5e76\u53d1\u6d4b\u8bd5\u7684\u7406\u60f3\u9009\u62e9\u3002\u5f00\u53d1\u4eba\u5458\u53ef\u4ee5\u4f7f\u7528\u9009\u62e9\u5668\u4e0e\u7f51\u9875\u4ea4\u4e92\u5e76\u6267\u884c\u5355\u51fb\u3001\u952e\u5165\u6216\u5bfc\u822a\u7b49\u64cd\u4f5c\u3002<\/p>\n<p><strong>\u4e3a\u4ec0\u4e48\u9009\u62e9\u5267\u4f5c\u5bb6\uff1f<\/strong><\/p>\n<p>Playwright \u56e0\u5176\u8f7b\u677e\u5904\u7406\u73b0\u4ee3 Web \u590d\u6742\u6027\u7684\u80fd\u529b\u800c\u8131\u9896\u800c\u51fa\uff0c\u63d0\u4f9b\u5bf9\u6d4b\u8bd5\u73af\u5883\u65e0\u4e0e\u4f26\u6bd4\u7684\u63a7\u5236\u3002<\/p>\n<p><strong>\u4e0e\u5176\u4ed6\u5de5\u5177\u7684\u6bd4\u8f83<\/strong><\/p>\n<ul>\n<li> <strong>Selenium<\/strong>\uff1a\u867d\u7136 Selenium \u957f\u671f\u4ee5\u6765\u4e00\u76f4\u53d7\u5230\u4eba\u4eec\u7684\u559c\u7231\uff0c\u4f46 Playwright \u63d0\u4f9b\u4e86\u66f4\u5feb\u7684\u6267\u884c\u901f\u5ea6\u548c\u66f4\u597d\u7684\u52a8\u6001\u5185\u5bb9\u5904\u7406\u3002<\/li>\n<li> <strong>Cypress<\/strong>\uff1a\u4e0e Cypress \u4e0d\u540c\uff0cPlaywright \u9ed8\u8ba4\u652f\u6301\u591a\u4e2a\u6d4f\u89c8\u5668\u548c\u65e0\u5934\u6267\u884c\u3002<\/li>\n<\/ul>\n<p><strong>\u9ad8\u7ea7\u529f\u80fd<\/strong><\/p>\n<p>Playwright \u64c5\u957f\u7f51\u7edc\u6a21\u62df\u548c\u8ddf\u8e2a\u7b49\u529f\u80fd\uff0c\u4f7f\u5f00\u53d1\u4eba\u5458\u80fd\u591f\u6a21\u62df\u7f51\u7edc\u6761\u4ef6\u5e76\u5206\u6790\u6d4b\u8bd5\u884c\u4e3a\u3002<\/p>\n<p><strong>\u5267\u4f5c\u5bb6\u7684\u5e38\u89c1\u7528\u4f8b<\/strong><\/p>\n<p>Playwright \u53ef\u6ee1\u8db3\u5404\u79cd\u6d4b\u8bd5\u573a\u666f\uff0c\u5305\u62ec\uff1a<\/p>\n<ul>\n<li> <strong>\u7aef\u5230\u7aef\u6d4b\u8bd5<\/strong>\uff1a\u9a8c\u8bc1\u4ece\u767b\u5f55\u5230\u7ed3\u5e10\u7684\u6574\u4e2a\u7528\u6237\u65c5\u7a0b\u3002<\/li>\n<li> <strong>\u8de8\u6d4f\u89c8\u5668\u517c\u5bb9\u6027<\/strong>\uff1a\u786e\u4fdd\u60a8\u7684\u5e94\u7528\u7a0b\u5e8f\u5728\u4e0d\u540c\u6d4f\u89c8\u5668\u4e2d\u8868\u73b0\u4e00\u81f4\u3002<\/li>\n<li> <strong>\u8f85\u52a9\u529f\u80fd\u6d4b\u8bd5<\/strong>\uff1a\u9a8c\u8bc1\u60a8\u7684\u5e94\u7528\u7a0b\u5e8f\u662f\u5426\u7b26\u5408\u8f85\u52a9\u529f\u80fd\u6807\u51c6\uff0c\u4f8b\u5982 WCAG\u3002<\/li>\n<\/ul>\n<p><strong>\u5267\u4f5c\u5bb6\u5165\u95e8<\/strong><\/p>\n<p>\u8bbe\u7f6e Playwright \u975e\u5e38\u7b80\u5355\uff0c\u53ea\u9700\u8981\u6700\u4f4e\u9650\u5ea6\u7684\u5148\u51b3\u6761\u4ef6\uff1a<\/p>\n<ol>\n<li> <strong>\u5b89\u88c5<\/strong>\uff1a\u901a\u8fc7 npm \u5b89\u88c5 Playwright\uff1a<\/li>\n<\/ol>\n<p>\u72c2\u6b22<\/p>\n<p>\u590d\u5236\u4ee3\u7801<\/p>\n<p>npm \u5b89\u88c5\u5267\u4f5c\u5bb6<\/p>\n<ol>\n<li> <strong>\u57fa\u672c\u6d4b\u8bd5\u811a\u672c<\/strong>\uff1a\u521b\u5efa\u4e00\u4e2a\u7b80\u5355\u7684\u6d4b\u8bd5\u6765\u6253\u5f00\u6d4f\u89c8\u5668\u5e76\u5bfc\u822a\u5230\u7f51\u7ad9\uff1a<\/li>\n<\/ol>\n<p>javascript<\/p>\n<p>\u590d\u5236\u4ee3\u7801<\/p>\n<p>const { chromium } = require(&#8216;playwright&#8217;);<\/p>\n<p>(async () =&gt; {<\/p>\n<p>&nbsp; const browser = wait chromium.launch();<\/p>\n<p>&nbsp; const page = wait browser.newPage();<\/p>\n<p>&nbsp;\u7b49\u5f85 page.goto(&#8216;https:\/\/example.com&#8217;);<\/p>\n<p>&nbsp; console.log(await page.title());<\/p>\n<p>&nbsp;\u7b49\u5f85 browser.close();<\/p>\n<p>})();<\/p>\n<ol>\n<li> <strong>\u8fd0\u884c\u6d4b\u8bd5<\/strong>\uff1a\u6267\u884c\u811a\u672c\u4ee5\u9a8c\u8bc1\u5176\u529f\u80fd\u3002<\/li>\n<\/ol>\n<p><strong>Playwright \u4e0e\u5176\u4ed6\u6d4b\u8bd5\u6846\u67b6<\/strong><\/p>\n<p>\u4e0e\u4f20\u7edf\u5de5\u5177\u76f8\u6bd4\uff0cPlaywright \u5177\u6709\u72ec\u7279\u7684\u4f18\u52bf\uff1a<\/p>\n<ul>\n<li> <strong>\u901f\u5ea6<\/strong>\uff1a\u5176\u4f18\u5316\u7684\u5f15\u64ce\u51cf\u5c11\u4e86\u6d4b\u8bd5\u6267\u884c\u65f6\u95f4\u3002<\/li>\n<li> <strong>\u52a8\u6001\u5185\u5bb9\u5904\u7406<\/strong>\uff1aPlaywright \u64c5\u957f\u5904\u7406\u5355\u9875\u5e94\u7528\u7a0b\u5e8f\u548c\u5b9e\u65f6\u66f4\u65b0\u3002<\/li>\n<li> <strong>\u96c6\u6210<\/strong>\uff1a\u4e0e CI\/CD \u7ba1\u9053\u65e0\u7f1d\u96c6\u6210\uff0c\u4ee5\u5b9e\u73b0\u81ea\u52a8\u5316\u6d4b\u8bd5\u5de5\u4f5c\u6d41\u7a0b\u3002<\/li>\n<\/ul>\n<p><strong>\u5267\u4f5c\u5bb6\u7684\u6311\u6218\u4e0e\u5c40\u9650\u6027<\/strong><\/p>\n<p>\u867d\u7136 Playwright \u5f88\u5f3a\u5927\uff0c\u4f46\u5b83\u4e5f\u6709\u4e00\u5b9a\u7684\u6311\u6218\uff1a<\/p>\n<ul>\n<li> <strong>\u8d44\u6e90\u5bc6\u96c6\u578b<\/strong>\uff1a\u5728\u591a\u4e2a\u6d4f\u89c8\u5668\u4e0a\u8fd0\u884c\u6d4b\u8bd5\u53ef\u80fd\u9700\u8981\u5927\u91cf\u7684\u7cfb\u7edf\u8d44\u6e90\u3002<\/li>\n<li> <strong>\u5b66\u4e60\u66f2\u7ebf<\/strong>\uff1a\u521d\u5b66\u8005\u53ef\u80fd\u9700\u8981\u65f6\u95f4\u6765\u4e86\u89e3\u5176 API \u548c\u9ad8\u7ea7\u529f\u80fd\u3002<\/li>\n<li> <strong>\u6709\u9650\u7684\u975e Web \u6d4b\u8bd5<\/strong>\uff1a\u4e0e\u67d0\u4e9b\u6846\u67b6\u4e0d\u540c\uff0cPlaywright \u4ec5\u4e13\u6ce8\u4e8e Web \u81ea\u52a8\u5316\u3002<\/li>\n<\/ul>\n<p><strong>\u7ed3\u8bba\uff1a\u5267\u4f5c\u5bb6\u7684\u672a\u6765<\/strong><\/p>\n<p>Playwright \u4ee3\u8868\u4e86\u81ea\u52a8\u5316\u6d4b\u8bd5\u6846\u67b6\u7684\u91cd\u5927\u8fdb\u6b65\uff0c\u4e3a\u73b0\u4ee3 Web \u5e94\u7528\u7a0b\u5e8f\u63d0\u4f9b\u4e86\u5168\u9762\u7684\u89e3\u51b3\u65b9\u6848\u3002\u5176\u5f3a\u5927\u7684\u529f\u80fd\u3001\u8de8\u6d4f\u89c8\u5668\u652f\u6301\u4ee5\u53ca\u5bf9\u53ef\u9760\u6027\u7684\u5173\u6ce8\u4f7f\u5176\u6210\u4e3a\u5f00\u53d1\u4eba\u5458\u7684\u6700\u7231\u3002\u968f\u7740 Web \u5e94\u7528\u7a0b\u5e8f\u53d8\u5f97\u8d8a\u6765\u8d8a\u590d\u6742\uff0c\u50cf Playwright \u8fd9\u6837\u7684\u5de5\u5177\u5bf9\u4e8e\u786e\u4fdd\u8d28\u91cf\u548c\u4e00\u81f4\u6027\u81f3\u5173\u91cd\u8981\u3002<\/p>\n<p>\u91c7\u7528 Playwright \u6765\u6539\u53d8\u60a8\u7684\u6d4b\u8bd5\u6d41\u7a0b\u5e76\u63d0\u4f9b\u65e0\u7f1d\u7684\u7528\u6237\u4f53\u9a8c\u3002\u65e0\u8bba\u60a8\u662f\u7ecf\u9a8c\u4e30\u5bcc\u7684 QA \u4e13\u4e1a\u4eba\u58eb\u8fd8\u662f\u5f00\u53d1\u4eba\u5458\uff0cPlaywright \u7684\u529f\u80fd\u65e0\u7591\u90fd\u4f1a\u63d0\u5347\u60a8\u7684\u6d4b\u8bd5\u7b56\u7565\u3002<\/p>\n<p>\u4eca\u5929\u5173\u4e8e\u300a\u4e86\u89e3 Playwright\uff1a\u81ea\u52a8\u5316 Web \u6d4b\u8bd5\u7684\u672a\u6765\u300b\u7684\u5185\u5bb9\u5c31\u4ecb\u7ecd\u5230\u8fd9\u91cc\u4e86\uff0c\u662f\u4e0d\u662f\u5b66\u8d77\u6765\u4e00\u76ee\u4e86\u7136\uff01\u60f3\u8981\u4e86\u89e3\u66f4\u591a\u5173\u4e8e\u7684\u5185\u5bb9\u8bf7\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\uff01<\/p>\n<p>      \u7248\u672c\u58f0\u660e \u672c\u6587\u8f6c\u8f7d\u4e8e\uff1adev.to \u5982\u6709\u4fb5\u72af\uff0c\u8bf7\u8054\u7cfb\u5220\u9664    <\/p>\n<dl>\n<dt><\/dt>\n<dd>\n   \u91cd\u8981\u7684 CSS \u8d44\u6e90\n <\/dd>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>\u4e86\u89e3 Playwright\uff1a\u81ea\u52a8\u5316 Web \u6d4b\u8bd5\u7684\u672a\u6765 \u6536\u85cf \u5728IT\u884c\u4e1a\u8fd9\u4e2a\u53d1\u5c55\u66f4\u65b0\u901f\u5ea6\u5f88\u5feb\u7684\u884c\u4e1a\uff0c\u53ea\u6709\u4e0d\u505c\u6b62\u7684\u5b66\u4e60\uff0c\u624d\u4e0d\u4f1a\u88ab\u884c\u4e1a\u6240\u6dd8\u6c70\u3002\u5982\u679c\u4f60\u662f\u6587\u7ae0\u5b66\u4e60\u8005\uff0c\u90a3\u4e48\u672c\u6587\u300a\u4e86\u89e3 Playwright\uff1a\u81ea\u52a8\u5316 Web \u6d4b\u8bd5\u7684\u672a\u6765\u300b\u5c31\u5f88\u9002\u5408\u4f60\uff01\u672c\u7bc7\u5185\u5bb9\u4e3b\u8981\u5305\u62ec##content_title##\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u7684\u77e5\u8bc6\u79ef\u7d2f\u6709\u6240\u5e2e\u52a9\uff0c\u52a9\u529b\u5b9e\u6218\u5f00\u53d1\uff01 \u5267\u4f5c\u5bb6\u7684\u5b9a\u4e49 Playwright \u662f\u4e00\u4e2a\u73b0\u4ee3\u7684\u5f00\u6e90\u6d4b\u8bd5\u6846\u67b6\uff0c\u4f7f\u5f00\u53d1\u4eba\u5458\u80fd\u591f\u4ee5\u901f\u5ea6\u3001\u53ef\u9760\u6027\u548c\u8de8\u6d4f\u89c8\u5668\u652f\u6301\u81ea\u52a8\u6267\u884c Web \u5e94\u7528\u7a0b\u5e8f\u7684\u7aef\u5230\u7aef\u6d4b\u8bd5\u3002\u5b83\u7531 Microsoft \u6784\u5efa\uff0c\u89e3\u51b3\u4e86\u4f20\u7edf\u6d4b\u8bd5\u5de5\u5177\u9762\u4e34\u7684\u8bb8\u591a\u6311\u6218\uff0c\u4e3a\u73b0\u4ee3 Web \u5e94\u7528\u7a0b\u5e8f\u63d0\u4f9b\u65e0\u7f1d\u81ea\u52a8\u5316\u3002 \u4ec0\u4e48\u662f\u5267\u4f5c\u5bb6\uff1f Playwright \u662f\u4e00\u4e2a Node.js \u5e93\uff0c\u65e8\u5728\u81ea\u52a8\u5316\u6d4f\u89c8\u5668\u4ea4\u4e92\uff0c\u4e3a Web \u5e94\u7528\u7a0b\u5e8f\u6d4b\u8bd5\u63d0\u4f9b\u5f3a\u5927\u7684\u89e3\u51b3\u65b9\u6848\u3002\u4e0e\u4e13\u6ce8\u4e8e\u5355\u6d4f\u89c8\u5668\u81ea\u52a8\u5316\u7684\u65e7\u5de5\u5177\u4e0d\u540c\uff0cPlaywright \u652f\u6301\u591a\u79cd\u6d4f\u89c8\u5668\uff0c\u5305\u62ec Chromium\u3001Firefox \u548c WebKit\uff0c\u786e\u4fdd\u6d4b\u8bd5\u8986\u76d6\u4e0d\u540c\u7684\u7528\u6237\u73af\u5883\u3002\u5b83\u5904\u7406\u52a8\u6001\u7f51\u9875\u5185\u5bb9\u548c\u7528\u6237\u4ea4\u4e92\u7684\u80fd\u529b\u4f7f\u5176\u6210\u4e3a\u5f00\u53d1\u4eba\u5458\u7684\u51fa\u8272\u9009\u62e9\u3002 \u5267\u4f5c\u5bb6\u7684\u4e3b\u8981\u7279\u70b9 Playwright \u5177\u6709\u6ee1\u8db3\u73b0\u4ee3 Web \u5e94\u7528\u7a0b\u5e8f\u9700\u6c42\u7684\u529f\u80fd\uff1a \u8de8\u6d4f\u89c8\u5668\u6d4b\u8bd5\uff1a\u652f\u6301 Chromium\uff08Google Chrome\u3001Microsoft Edge\uff09\u3001Firefox \u548c WebKit\uff08Safari\uff09\uff0c\u5b9e\u73b0\u8de8\u591a\u4e2a\u6d4f\u89c8\u5668\u7684\u4e00\u81f4\u6d4b\u8bd5\u3002 \u65e0\u5934\u548c\u6709\u5934\u6a21\u5f0f\uff1a\u5728\u65e0\u5934\u6a21\u5f0f\u4e0b\u8fd0\u884c\u6d4b\u8bd5\u4ee5\u63d0\u9ad8\u901f\u5ea6\uff0c\u6216\u5728\u6709\u5934\u6a21\u5f0f\u4e0b\u8fd0\u884c\u6d4b\u8bd5\u4ee5\u8fdb\u884c\u8c03\u8bd5\u3002 \u81ea\u52a8\u7b49\u5f85\uff1a\u5267\u4f5c\u5bb6\u7b49\u5f85\u5143\u7d20\u52a0\u8f7d\u6216\u8fbe\u5230\u7279\u5b9a\u72b6\u6001\uff0c\u51cf\u5c11\u6d4b\u8bd5\u4e2d\u7684\u4e0d\u7a33\u5b9a\u3002 \u5e76\u884c\u6d4b\u8bd5\u6267\u884c\uff1a\u901a\u8fc7\u540c\u65f6\u8fd0\u884c\u591a\u4e2a\u6d4b\u8bd5\u7528\u4f8b\u6765\u52a0\u5feb\u6d4b\u8bd5\u901f\u5ea6\u3002 \u5267\u4f5c\u5bb6\u662f\u5982\u4f55\u5de5\u4f5c\u7684\uff1f Playwright \u4f7f\u7528 WebSocket \u8fde\u63a5\u4e0e\u6d4f\u89c8\u5668\u5f15\u64ce\u8fdb\u884c\u901a\u4fe1\uff0c\u4e3a\u5f00\u53d1\u4eba\u5458\u63d0\u4f9b\u5bf9\u6d4f\u89c8\u5668\u64cd\u4f5c\u7684\u7cbe\u786e\u63a7\u5236\u3002\u5b83\u521b\u5efa\u6a21\u62df\u5355\u4e2a\u7528\u6237\u7684\u9694\u79bb\u6d4f\u89c8\u5668\u4e0a\u4e0b\u6587\uff0c\u4f7f\u5176\u6210\u4e3a\u5e76\u53d1\u6d4b\u8bd5\u7684\u7406\u60f3\u9009\u62e9\u3002\u5f00\u53d1\u4eba\u5458\u53ef\u4ee5\u4f7f\u7528\u9009\u62e9\u5668\u4e0e\u7f51\u9875\u4ea4\u4e92\u5e76\u6267\u884c\u5355\u51fb\u3001\u952e\u5165\u6216\u5bfc\u822a\u7b49\u64cd\u4f5c\u3002 \u4e3a\u4ec0\u4e48\u9009\u62e9\u5267\u4f5c\u5bb6\uff1f Playwright \u56e0\u5176\u8f7b\u677e\u5904\u7406\u73b0\u4ee3 Web \u590d\u6742\u6027\u7684\u80fd\u529b\u800c\u8131\u9896\u800c\u51fa\uff0c\u63d0\u4f9b\u5bf9\u6d4b\u8bd5\u73af\u5883\u65e0\u4e0e\u4f26\u6bd4\u7684\u63a7\u5236\u3002 \u4e0e\u5176\u4ed6\u5de5\u5177\u7684\u6bd4\u8f83 Selenium\uff1a\u867d\u7136 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-53218","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/53218","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=53218"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/53218\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=53218"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=53218"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=53218"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}