{"id":205338,"date":"2025-05-29T14:50:35","date_gmt":"2025-05-29T06:50:35","guid":{"rendered":"https:\/\/server.hk\/cnblog\/205338\/"},"modified":"2025-05-29T14:50:35","modified_gmt":"2025-05-29T06:50:35","slug":"python-selenium%e5%a4%9a%e7%ba%bf%e7%a8%8b%e7%88%ac%e8%99%ab%e6%8a%a5%e9%94%99%ef%bc%9a%e5%a6%82%e4%bd%95%e9%81%bf%e5%85%8d%e7%ab%af%e5%8f%a3%e5%86%b2%e7%aa%81%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/205338\/","title":{"rendered":"Python Selenium\u591a\u7ebf\u7a0b\u722c\u866b\u62a5\u9519\uff1a\u5982\u4f55\u907f\u514d\u7aef\u53e3\u51b2\u7a81\uff1f"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>Python Selenium\u591a\u7ebf\u7a0b\u722c\u866b\u62a5\u9519\uff1a\u5982\u4f55\u907f\u514d\u7aef\u53e3\u51b2\u7a81\uff1f<\/h1>\n<p>\u6587\u7ae0\u5c0f\u767d\u4e00\u679a\uff0c\u6b63\u5728\u4e0d\u65ad\u5b66\u4e60\u79ef\u7d2f\u77e5\u8bc6\uff0c\u73b0\u5c06\u5b66\u4e60\u5230\u7684\u77e5\u8bc6\u8bb0\u5f55\u4e00\u4e0b\uff0c\u4e5f\u662f\u5c06\u6211\u7684\u6240\u5f97\u5206\u4eab\u7ed9\u5927\u5bb6\uff01\u800c\u4eca\u5929\u8fd9\u7bc7\u6587\u7ae0\u300aPython Selenium\u591a\u7ebf\u7a0b\u722c\u866b\u62a5\u9519\uff1a\u5982\u4f55\u907f\u514d\u7aef\u53e3\u51b2\u7a81\uff1f\u300b\u5e26\u5927\u5bb6\u6765\u4e86\u89e3\u4e00\u4e0b##content_title##\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u7684\u77e5\u8bc6\u79ef\u7d2f\u6709\u6240\u5e2e\u52a9\uff0c\u4ece\u800c\u5f25\u8865\u81ea\u5df1\u7684\u4e0d\u8db3\uff0c\u52a9\u529b\u5b9e\u6218\u5f00\u53d1\uff01<\/p>\n<p><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241129\/1732859327674955bfa1dcf.jpg\" class=\"aligncenter\"><\/p>\n<p><strong>python selenium\u7f51\u9875\u722c\u866b\u591a\u7ebf\u7a0b\u5e76\u53d1\u6267\u884c\u5076\u5c14\u4f1a\u62a5\u9519\u7684\u539f\u56e0<\/strong><\/p>\n<p>\u5728\u4f7f\u7528\u591a\u7ebf\u7a0b\u5e76\u53d1\u6267\u884cpython selenium\u7f51\u9875\u722c\u866b\u65f6\uff0c\u6709\u65f6\u4f1a\u51fa\u73b0\u9519\u8bef\u3002\u8fd9\u79cd\u9519\u8bef\u901a\u5e38\u4e0e\u4f7f\u7528\u540c\u4e00\u7aef\u53e3\u7684 <strong>&#8216;&#8211;remote-debugging-port=9225&#8217;&#8211;<\/strong> \u53c2\u6570\u6709\u5173\u3002<\/p>\n<p>\u5f53\u591a\u4e2awebdriver\u5b9e\u4f8b\u540c\u65f6\u4f7f\u7528\u540c\u4e00\u4e2a\u7aef\u53e3\u65f6\uff0c\u53ef\u80fd\u4f1a\u5bfc\u81f4\u51b2\u7a81\u3002\u89e3\u51b3\u6b64\u95ee\u9898\u7684\u529e\u6cd5\u662f\u4e3a\u4e0d\u540c\u7684\u5b9e\u4f8b\u4f7f\u7528\u4e0d\u540c\u7684\u7aef\u53e3\u3002\u53ef\u4ee5\u901a\u8fc7\u5c06\u7aef\u53e3\u4f5c\u4e3a\u53c2\u6570\u4f20\u5165 <strong>&#8216;&#8211;remote-debugging-port&#8217;&#8211;<\/strong> \u53c2\u6570\u6765\u5b9e\u73b0\u3002<\/p>\n<p>\u4ee5\u4e0b\u662f\u5982\u4f55\u4fee\u6539\u4ee3\u7801\u4ee5\u4f7f\u7528\u4e0d\u540c\u7684\u7aef\u53e3\uff1a<\/p>\n<pre>def test(port):\n    webdriver_options.add_argument(\"--remote-debugging-port=\" + port)\n    # ...<\/pre>\n<p>\u5728\u4e3b\u51fd\u6570\u4e2d\uff0c\u53ef\u4ee5\u4e3a\u6bcf\u4e2a\u7ebf\u7a0b\u6307\u5b9a\u4e0d\u540c\u7684\u7aef\u53e3\uff1a<\/p>\n<pre>if __name__ == '__main__':\n    t1 = threading.Thread(target=test, args=(\"9225\",))\n    t2 = threading.Thread(target=test, args=(\"9226\",))\n    t3 = threading.Thread(target=test, args=(\"9227\",))<\/pre>\n<p>\u8fd9\u6837\uff0c\u6bcf\u4e2a\u7ebf\u7a0b\u5c06\u4f7f\u7528\u4e0d\u540c\u7684\u7aef\u53e3\u8fd0\u884c webdriver\uff0c\u4ece\u800c\u907f\u514d\u51b2\u7a81\u5e76\u63d0\u9ad8\u5e76\u53d1\u6267\u884c\u7684\u7a33\u5b9a\u6027\u3002<\/p>\n<p>\u6587\u4e2d\u5173\u4e8e\u7684\u77e5\u8bc6\u4ecb\u7ecd\uff0c\u5e0c\u671b\u5bf9\u4f60\u7684\u5b66\u4e60\u6709\u6240\u5e2e\u52a9\uff01\u82e5\u662f\u53d7\u76ca\u532a\u6d45\uff0c\u90a3\u5c31\u52a8\u52a8\u9f20\u6807\u6536\u85cf\u8fd9\u7bc7\u300aPython Selenium\u591a\u7ebf\u7a0b\u722c\u866b\u62a5\u9519\uff1a\u5982\u4f55\u907f\u514d\u7aef\u53e3\u51b2\u7a81\uff1f\u300b\u6587\u7ae0\u5427\uff0c\u4e5f\u53ef\u5173\u6ce8\u516c\u4f17\u53f7\u4e86\u89e3\u76f8\u5173\u6280\u672f\u6587\u7ae0\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Python Selenium\u591a&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4925],"tags":[],"class_list":["post-205338","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/205338","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=205338"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/205338\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=205338"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=205338"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=205338"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}