{"id":238,"date":"2022-05-06T05:37:34","date_gmt":"2022-05-06T05:37:34","guid":{"rendered":"http:\/\/fanaticboy.com\/?p=238"},"modified":"2022-05-06T05:39:23","modified_gmt":"2022-05-06T05:39:23","slug":"238","status":"publish","type":"post","link":"https:\/\/fanaticboy.com\/?p=238","title":{"rendered":"web\u81ea\u52a8\u5316\u4e4bseleniumwebdriver\u5de5\u5177\u7684\u4f7f\u7528\uff08\u4e00\uff09"},"content":{"rendered":"\n<p>\u200b<\/p>\n\n\n\n<p>\u4e00\u3001\u9700\u8981\u7684\u5de5\u5177python\uff0cpycharm\uff0c\u8c37\u6b4c\u6d4f\u89c8\u5668<\/p>\n\n\n\n<p>\u8fd9\u4e09\u4e2a\u7684\u4e0b\u8f7d\u5730\u5740\u53ef\u4ee5\u67e5\u770b<a href=\"http:\/\/fanaticboy.com\/?p=138\" target=\"_blank\" rel=\"noreferrer noopener\">\u5e38\u7528\u7f51\u7ad9\u94fe\u63a5 \u2013 \u4f60\u7684BUG\u6211\u505a\u4e3b<\/a>\u6765\u8fdb\u884c\u4e0b\u8f7d<\/p>\n\n\n\n<p>\u4e8c\u3001selenium\u7684\u5b89\u88c5\uff0c\u4f7f\u7528\u5982\u4e0b\u547d\u4ee4<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pip install selenium<\/code><\/pre>\n\n\n\n<p><img loading=\"lazy\" decoding=\"async\" height=\"15\" src=\"blob:http:\/\/fanaticboy.com\/1209c876-3c75-4174-b561-e659a26d2d9c\" width=\"15\"><\/p>\n\n\n\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"493\" src=\"https:\/\/img-blog.csdnimg.cn\/f0011049adb34a3bb143041073aa085b.png\" width=\"1200\"><img loading=\"lazy\" decoding=\"async\" height=\"15\" src=\"blob:http:\/\/fanaticboy.com\/c08c9cb5-928a-4f82-8f1f-936a97b576c1\" width=\"15\">\u200b<\/p>\n\n\n\n<p>selenium\u7684\u5b98\u65b9\u6587\u6863\u5730\u5740\uff1a<a href=\"http:\/\/selenium-python-zh.readthedocs.io\/en\/latest\/index.html\" target=\"_blank\" rel=\"noreferrer noopener\">Selenium with Python\u4e2d\u6587\u7ffb\u8bd1\u6587\u6863 \u2014 Selenium-Python\u4e2d\u6587\u6587\u6863 2 documentation<\/a><\/p>\n\n\n\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"859\" src=\"https:\/\/img-blog.csdnimg.cn\/5a1ccd50bbfc450299cb5ab0887a1ca7.png\" width=\"1200\"><img loading=\"lazy\" decoding=\"async\" height=\"15\" src=\"blob:http:\/\/fanaticboy.com\/a41b2ddf-7a54-437d-8ebd-bc960f5cc605\" width=\"15\">\u200b<\/p>\n\n\n\n<p>selenium\u7684\u5b98\u7f51\u5730\u5740\uff1a<a href=\"https:\/\/www.selenium.dev\/\" target=\"_blank\" rel=\"noreferrer noopener\">Selenium<\/a><\/p>\n\n\n\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"589\" src=\"https:\/\/img-blog.csdnimg.cn\/c16de59dfcc34a80a0d016bf0f880061.png\" width=\"1200\"><img loading=\"lazy\" decoding=\"async\" height=\"15\" src=\"blob:http:\/\/fanaticboy.com\/d3d3638a-7887-4ea1-9495-9f36ca565dae\" width=\"15\">\u200b<\/p>\n\n\n\n<p>\u5927\u5bb6\u5982\u679c\u60f3\u6df1\u5165\u4e86\u89e3\u7684\u8bdd\u53ef\u4ee5\u8bbf\u95ee\u4e0a\u9762\u4e24\u4e2a\u7f51\u7ad9\u8fdb\u884c\u6df1\u5165\u7684\u5b66\u4e60\uff0c\u5982\u679c\u4f60\u6709\u4e86\u4e00\u5b9a\u7684\u4e86\u89e3\uff0c\u90a3\u4e48\u76f4\u63a5\u53ef\u4ee5\u8ddf\u7740\u6211\u7684\u6b65\u9aa4\u8fdb\u884c\u51c6\u5907\u5de5\u4f5c<\/p>\n\n\n\n<p>\u4e09\u3001chromedriver\u7684\u9a71\u52a8\u4e0b\u8f7d<\/p>\n\n\n\n<p>\u7f51\u5740\u662f\uff1a<a href=\"http:\/\/chromedriver.storage.googleapis.com\/index.html\" target=\"_blank\" rel=\"noreferrer noopener\">chromedriver.storage.googlea<\/a><a href=\"http:\/\/chromedriver.storage.googleapis.com\/index.html\">pis.com\/index.html<\/a><\/p>\n\n\n\n<p>\u7136\u540e\u627e\u5230\u4e0e\u81ea\u5df1\u8c37\u6b4c\u6d4f\u89c8\u5668\u7248\u672c\u76f8\u63a5\u8fd1\u7684\u7248\u672c\u4e0b\u8f7d\u5c31\u53ef\u4ee5\u4e86\uff0c\u7136\u540e\u89e3\u538b\uff0c\u7136\u540e\u653e\u5230\u4f60\u4e0b\u8f7d\u7684python\u7684\u5b89\u88c5\u76ee\u5f55\u91cc\u5c31\u53ef\u4ee5\u4e86<\/p>\n\n\n\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"805\" src=\"https:\/\/img-blog.csdnimg.cn\/ccf24ebbfee24ca181a928881bfdc359.png\" width=\"1167\"><img loading=\"lazy\" decoding=\"async\" height=\"15\" src=\"blob:http:\/\/fanaticboy.com\/fb7c640c-c59e-4a19-a469-fc2de1106450\" width=\"15\">\u200b<\/p>\n\n\n\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"656\" src=\"https:\/\/img-blog.csdnimg.cn\/430564fc6af1490eb865061589e76c57.png\" width=\"1014\"><img loading=\"lazy\" decoding=\"async\" height=\"15\" src=\"blob:http:\/\/fanaticboy.com\/a221ebb1-55e2-4acf-9419-04e5cd138738\" width=\"15\">\u200b<\/p>\n\n\n\n<p>&nbsp;\u56db\u3001\u51c6\u5907\u597d\u6d4b\u8bd5\u7684\u7f51\u7ad9\uff0c\u8fd9\u8fb9\u5462\u4ee5\u767e\u5ea6\u4e3a\u4f8b\uff0c\u4f7f\u7528selenium\u8fdb\u884c\u7b80\u5355\u7684\u6d4b\u8bd5<\/p>\n\n\n\n<p>\uff081\uff09\u6253\u5f00pycharm\uff0c\u521b\u5efa\u4e00\u4e2a\u6587\u4ef6baidutest.py<\/p>\n\n\n\n<p>\uff082\uff09\u5c06\u4ee5\u4e0b\u4ee3\u7801\u5199\u5165\u5176\u4e2d<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># \u5bfc\u5165webdriver\nfrom selenium import webdriver\n\n# \u5bfc\u5165sleep\nfrom time import sleep\n\n# \u521b\u5efa\u4e00\u4e2a\u8c37\u6b4c\u6d4f\u89c8\u5668\u5bf9\u8c61\u5b9e\u4f8b\ndriver = webdriver.Chrome()\n# \u8bbf\u95ee\u767e\u5ea6\u7f51\u7ad9\ndriver.get(\"https:\/\/www.baidu.com\")\n\n# \u505c\u75595\u79d2\nsleep(5)\n# \u63a8\u51fa\u6d4f\u89c8\u5668\ndriver.quit()<\/code><\/pre>\n\n\n\n<p><img loading=\"lazy\" decoding=\"async\" height=\"15\" src=\"blob:http:\/\/fanaticboy.com\/ff631623-13a7-4bea-8f4e-a9502d5ce253\" width=\"15\"><\/p>\n\n\n\n<p>\uff083\uff09\u8fd0\u884c\u6b64\u4ee3\u7801<\/p>\n\n\n\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"811\" src=\"https:\/\/img-blog.csdnimg.cn\/c0b7671c0f48464a8a2d6590f9b0a74e.png\" width=\"1200\"><img loading=\"lazy\" decoding=\"async\" height=\"15\" src=\"blob:http:\/\/fanaticboy.com\/2aa14b63-801b-4e14-afa4-2a27bde3c6db\" width=\"15\">\u200b<\/p>\n\n\n\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"953\" src=\"https:\/\/img-blog.csdnimg.cn\/6cb6ee6936604c3d993fc6162e6b663f.png\" width=\"1200\"><img loading=\"lazy\" decoding=\"async\" height=\"15\" src=\"blob:http:\/\/fanaticboy.com\/64cf997e-a73a-49cf-8d69-c1bbb5f83ecf\" width=\"15\">\u200b<\/p>\n\n\n\n<p>\u5982\u4e0a\u56fe\u6240\u793a\uff0c\u51fa\u73b0\u767e\u5ea6\u754c\u9762\uff0c\u5e76\u57285\u79d2\u540e\u9000\u51fa\uff0c\u8bf4\u660e\u54b1\u4eec\u7684\u57fa\u672c\u64cd\u4f5c\u6ca1\u6709\u95ee\u9898\uff0c\u63a5\u4e0b\u6765\u53ef\u4ee5\u5229\u7528selenium\u8fdb\u884c\u81ea\u52a8\u5316\u7684\u5e94\u7528\u4e86\uff0c&nbsp;\u8fd9\u4e9b\u90fd\u662f\u6700\u57fa\u7840\u989d\u7684\u5185\u5bb9\u4e86\uff0c\u5982\u679c\u60f3\u8fdb\u4e00\u6b65\u4e86\u89e3\uff0c\u8bf7\u770b\u4e0b\u4e00\u7bc7\u5185\u5bb9 \u200b<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u200b \u4e00\u3001\u9700\u8981\u7684\u5de5\u5177python\uff0cpycharm\uff0c\u8c37\u6b4c\u6d4f\u89c8\u5668 \u8fd9\u4e09\u4e2a\u7684\u4e0b\u8f7d\u5730\u5740\u53ef\u4ee5\u67e5\u770b\u5e38\u7528\u7f51\u7ad9\u94fe\u63a5 \u2013 \u4f60\u7684BU &#8230; <a title=\"web\u81ea\u52a8\u5316\u4e4bseleniumwebdriver\u5de5\u5177\u7684\u4f7f\u7528\uff08\u4e00\uff09\" class=\"read-more\" href=\"https:\/\/fanaticboy.com\/?p=238\" aria-label=\"\u9605\u8bfb web\u81ea\u52a8\u5316\u4e4bseleniumwebdriver\u5de5\u5177\u7684\u4f7f\u7528\uff08\u4e00\uff09\">\u9605\u8bfb\u66f4\u591a<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15,23],"tags":[],"class_list":["post-238","post","type-post","status-publish","format-standard","hentry","category-python","category-web"],"_links":{"self":[{"href":"https:\/\/fanaticboy.com\/index.php?rest_route=\/wp\/v2\/posts\/238","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fanaticboy.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fanaticboy.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fanaticboy.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fanaticboy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=238"}],"version-history":[{"count":3,"href":"https:\/\/fanaticboy.com\/index.php?rest_route=\/wp\/v2\/posts\/238\/revisions"}],"predecessor-version":[{"id":241,"href":"https:\/\/fanaticboy.com\/index.php?rest_route=\/wp\/v2\/posts\/238\/revisions\/241"}],"wp:attachment":[{"href":"https:\/\/fanaticboy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=238"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fanaticboy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=238"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fanaticboy.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=238"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}