{"id":923144,"date":"2024-06-09T13:52:35","date_gmt":"2024-06-09T13:52:35","guid":{"rendered":"https:\/\/proxyelite.info\/?p=923144"},"modified":"2024-05-27T13:58:05","modified_gmt":"2024-05-27T13:58:05","slug":"can-python-and-selenium-defeat-all-captchas-with-a-chrome-extension","status":"publish","type":"post","link":"https:\/\/proxyelite.info\/cn\/can-python-and-selenium-defeat-all-captchas-with-a-chrome-extension\/","title":{"rendered":"Python \u548c Selenium \u53ef\u4ee5\u4f7f\u7528 Chrome \u6269\u5c55\u7a0b\u5e8f\u7834\u89e3\u6240\u6709\u9a8c\u8bc1\u7801\u5417\uff1f"},"content":{"rendered":"<p class=\"wp-block-paragraph\">Captcha \u662f\u201c\u5b8c\u5168\u81ea\u52a8\u5316\u7684\u516c\u5171\u56fe\u7075\u6d4b\u8bd5\u201d\u7684\u7f29\u5199\uff0c\u7528\u4e8e\u533a\u5206\u8ba1\u7b97\u673a\u548c\u4eba\u7c7b\uff0c\u5b83\u5df2\u6210\u4e3a\u4e92\u8054\u7f51\u4e0a\u65e0\u5904\u4e0d\u5728\u7684\u969c\u788d\u3002\u4ece\u9632\u6b62\u5783\u573e\u90ae\u4ef6\u5230\u4fdd\u62a4\u5728\u7ebf\u4ea4\u6613\uff0c\u9a8c\u8bc1\u7801\u65e0\u5904\u4e0d\u5728\u3002\u7136\u800c\uff0c\u5b83\u4eec\u53ef\u80fd\u5f88\u9ebb\u70e6\uff0c\u59a8\u788d\u7528\u6237\u4f53\u9a8c\u5e76\u963b\u788d\u81ea\u52a8\u5316\u6d41\u7a0b\u3002\u5728\u672c\u6587\u4e2d\uff0c\u6211\u4eec\u63a2\u7d22\u4e86\u4e00\u79cd\u5229\u7528 Python\u3001Selenium \u548c Chrome \u6269\u5c55\u7a0b\u5e8f\u6709\u6548\u89e3\u51b3\u5404\u79cd\u7c7b\u578b\u9a8c\u8bc1\u7801\u7684\u6f5c\u5728\u89e3\u51b3\u65b9\u6848\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u4e86\u89e3\u9a8c\u8bc1\u7801\uff1a<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u5728\u6df1\u5165\u7814\u7a76\u89e3\u51b3\u65b9\u6848\u4e4b\u524d\uff0c\u4e86\u89e3\u5728\u7ebf\u9047\u5230\u7684\u4e0d\u540c\u7c7b\u578b\u7684\u9a8c\u8bc1\u7801\u81f3\u5173\u91cd\u8981\u3002\u5b83\u4eec\u7684\u8303\u56f4\u4ece\u7b80\u5355\u7684\u57fa\u4e8e\u6587\u672c\u7684\u6311\u6218\u5230\u66f4\u590d\u6742\u7684\u56fe\u50cf\u8bc6\u522b\u6d4b\u8bd5\uff0c\u751a\u81f3\u97f3\u9891\u6311\u6218\u3002\u6bcf\u79cd\u7c7b\u578b\u90fd\u4e3a\u81ea\u52a8\u5316\u811a\u672c\u5e26\u6765\u4e86\u72ec\u7279\u7684\u969c\u788d\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Python \u548c Selenium\uff1a<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Python \u662f\u4e00\u79cd\u591a\u529f\u80fd\u7f16\u7a0b\u8bed\u8a00\uff0c\u4e0e\u5f3a\u5927\u7684 Web \u81ea\u52a8\u5316\u5de5\u5177 Selenium \u76f8\u7ed3\u5408\uff0c\u5f62\u6210\u4e86\u4e00\u4e2a\u5f3a\u5927\u7684\u7ec4\u5408\uff0c\u53ef\u7528\u4e8e\u5bfc\u822a\u52a8\u6001\u7f51\u9875\u5e76\u4e0e\u5143\u7d20\u65e0\u7f1d\u4ea4\u4e92\u3002Selenium \u5141\u8bb8\u5f00\u53d1\u4eba\u5458\u81ea\u52a8\u5316 Web \u6d4f\u89c8\u5668\uff0c\u6a21\u4eff\u4eba\u7c7b\u7684\u64cd\u4f5c\uff0c\u4f8b\u5982\u5355\u51fb\u6309\u94ae\u3001\u586b\u5199\u8868\u683c\uff0c\u751a\u81f3\u89e3\u51b3\u9a8c\u8bc1\u7801\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Chrome\u6269\u5c55\u7a0b\u5e8f\u7684\u4f5c\u7528\uff1a<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e3a\u4e86\u589e\u5f3a Selenium \u5904\u7406\u9a8c\u8bc1\u7801\u7684\u80fd\u529b\uff0c\u5f00\u53d1\u4eba\u5458\u521b\u5efa\u4e86\u4e13\u95e8\u7528\u4e8e\u89e3\u51b3\u9a8c\u8bc1\u7801\u7684 Chrome \u6269\u5c55\u7a0b\u5e8f\u3002\u8fd9\u4e9b\u6269\u5c55\u7a0b\u5e8f\u5229\u7528\u5148\u8fdb\u7684\u7b97\u6cd5\u548c\u673a\u5668\u5b66\u4e60\u6280\u672f\u6765\u51c6\u786e\u89e3\u5bc6\u6700\u590d\u6742\u7684\u9a8c\u8bc1\u7801\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Python + Selenium + Chrome \u6269\u5c55\u7a0b\u5e8f\u7ec4\u5408\u7684\u4f18\u70b9\uff1a<\/strong><\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u591a\u529f\u80fd\u6027\uff1a<\/strong> \u8be5\u89e3\u51b3\u65b9\u6848\u529f\u80fd\u591a\u6837\uff0c\u80fd\u591f\u5904\u7406\u5404\u79cd\u7c7b\u578b\u7684\u9a8c\u8bc1\u7801\uff0c\u5305\u62ec\u57fa\u4e8e\u56fe\u50cf\u7684\u3001\u57fa\u4e8e\u6587\u672c\u7684\u548c reCAPTCHA\u3002<\/li>\n\n\n\n<li><strong>\u6613\u4e8e\u5b9e\u65bd\uff1a<\/strong> Python \u7684\u7b80\u5355\u6027\u548c Selenium \u7684\u76f4\u89c2 API \u4f7f\u5f97\u5f00\u53d1\u4eba\u5458\u53ef\u4ee5\u76f8\u5bf9\u8f7b\u677e\u5730\u5c06\u9a8c\u8bc1\u7801\u89e3\u51b3\u529f\u80fd\u96c6\u6210\u5230\u4ed6\u4eec\u7684\u81ea\u52a8\u5316\u811a\u672c\u4e2d\u3002<\/li>\n\n\n\n<li><strong>\u6210\u672c\u6548\u76ca\uff1a<\/strong> \u4e0e\u4e00\u4e9b\u5546\u4e1a\u9a8c\u8bc1\u7801\u89e3\u51b3\u670d\u52a1\u4e0d\u540c\uff0cPython + Selenium + Chrome \u6269\u5c55\u65b9\u6cd5\u5177\u6709\u6210\u672c\u6548\u76ca\uff0c\u56e0\u4e3a\u5b83\u4f9d\u8d56\u4e8e\u5f00\u6e90\u5de5\u5177\u548c\u5e93\u3002<\/li>\n\n\n\n<li><strong>\u5b9a\u5236\uff1a<\/strong> \u5f00\u53d1\u4eba\u5458\u53ef\u4ee5\u6839\u636e\u81ea\u5df1\u7684\u5177\u4f53\u8981\u6c42\u7075\u6d3b\u5730\u5b9a\u5236\u548c\u5fae\u8c03\u9a8c\u8bc1\u7801\u89e3\u51b3\u8fc7\u7a0b\u3002<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u5de5\u5177\u548c\u5e93\uff1a<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e3a\u4e86\u6709\u6548\u5730\u5b9e\u65bd\u8be5\u89e3\u51b3\u65b9\u6848\uff0c\u5f00\u53d1\u4eba\u5458\u53ef\u4ee5\u5229\u7528\u4ee5\u4e0b\u5de5\u5177\u548c\u5e93\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th><strong>\u5de5\u5177\/\u5e93<\/strong><\/th><th><strong>\u63cf\u8ff0<\/strong><\/th><\/tr><\/thead><tbody><tr><td>Python<\/td><td>\u4e00\u79cd\u4ee5\u7b80\u5355\u6027\u548c\u591a\u529f\u80fd\u6027\u800c\u95fb\u540d\u7684\u9ad8\u7ea7\u7f16\u7a0b\u8bed\u8a00\u3002<\/td><\/tr><tr><td>\u7852<\/td><td>\u4e00\u79cd\u7f51\u7edc\u81ea\u52a8\u5316\u5de5\u5177\uff0c\u53ef\u4ee5\u4ee5\u7f16\u7a0b\u65b9\u5f0f\u4e0e\u7f51\u7edc\u5143\u7d20\u548c\u6d4f\u89c8\u5668\u8fdb\u884c\u4ea4\u4e92\u3002<\/td><\/tr><tr><td>Chrome \u6269\u5c55\u7a0b\u5e8f<\/td><td>\u4e13\u4e3a Chrome \u6d4f\u89c8\u5668\u8bbe\u8ba1\u7684\u6269\u5c55\u7a0b\u5e8f\uff0c\u914d\u5907\u9a8c\u8bc1\u7801\u89e3\u51b3\u529f\u80fd\u3002<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u5b9e\u65bd\u6b65\u9aa4\uff1a<\/strong><\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u8bbe\u7f6e\u73af\u5883\uff1a<\/strong> \u5b89\u88c5 Python\u3001Selenium \u548c\u89e3\u51b3\u9a8c\u8bc1\u7801\u6240\u9700\u7684 Chrome \u6269\u5c55\u7a0b\u5e8f\u3002<\/li>\n\n\n\n<li><strong>\u5bfc\u822a\u81f3\u9a8c\u8bc1\u7801\u9875\u9762\uff1a<\/strong> \u4f7f\u7528 Selenium \u5bfc\u822a\u5230\u5305\u542b\u9a8c\u8bc1\u7801\u6311\u6218\u7684\u7f51\u9875\u3002<\/li>\n\n\n\n<li><strong>\u6355\u83b7\u9a8c\u8bc1\u7801\uff1a<\/strong> \u4f7f\u7528 Selenium \u8bc6\u522b\u9a8c\u8bc1\u7801\u5143\u7d20\u5e76\u6355\u83b7\u5176\u56fe\u50cf\u6216\u6587\u672c\u3002<\/li>\n\n\n\n<li><strong>\u9a8c\u8bc1\u7801\u89e3\u7b54\uff1a<\/strong> \u5229\u7528 Chrome \u6269\u5c55\u7a0b\u5e8f\u6765\u5904\u7406\u548c\u89e3\u51b3\u9a8c\u8bc1\u7801\u6311\u6218\u3002<\/li>\n\n\n\n<li><strong>\u63d0\u4ea4\u89e3\u51b3\u65b9\u6848\uff1a<\/strong> \u4e00\u65e6\u9a8c\u8bc1\u7801\u88ab\u89e3\u51b3\uff0c\u4f7f\u7528 Selenium \u5c06\u89e3\u51b3\u65b9\u6848\u8f93\u5165\u5230\u9002\u5f53\u7684\u8868\u5355\u5b57\u6bb5\u5e76\u7ee7\u7eed\u81ea\u52a8\u5316\u8fc7\u7a0b\u3002<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u7ed3\u8bba\uff1a<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u603b\u4e4b\uff0cPython\u3001Selenium \u548c Chrome \u6269\u5c55\u7a0b\u5e8f\u7684\u7ec4\u5408\u4e3a\u89e3\u51b3 Web \u81ea\u52a8\u5316\u4efb\u52a1\u4e2d\u9047\u5230\u7684\u5404\u79cd\u7c7b\u578b\u7684\u9a8c\u8bc1\u7801\u63d0\u4f9b\u4e86\u5f3a\u5927\u7684\u89e3\u51b3\u65b9\u6848\u3002\u901a\u8fc7\u5229\u7528\u81ea\u52a8\u5316\u548c\u9ad8\u7ea7\u7b97\u6cd5\u7684\u5f3a\u5927\u529f\u80fd\uff0c\u5f00\u53d1\u4eba\u5458\u53ef\u4ee5\u7b80\u5316\u4ed6\u4eec\u7684\u5de5\u4f5c\u6d41\u7a0b\u5e76\u6709\u6548\u514b\u670d\u9a8c\u8bc1\u7801\u5e26\u6765\u7684\u969c\u788d\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u65e0\u8bba\u60a8\u662f\u5e0c\u671b\u81ea\u52a8\u6267\u884c\u91cd\u590d\u4efb\u52a1\u7684\u5f00\u53d1\u4eba\u5458\uff0c\u8fd8\u662f\u5bfb\u6c42\u63d0\u9ad8\u8fd0\u8425\u6548\u7387\u7684\u4f01\u4e1a\uff0c\u6b64\u89e3\u51b3\u65b9\u6848\u90fd\u63d0\u4f9b\u4e86\u4e00\u79cd\u7ecf\u6d4e\u9ad8\u6548\u4e14\u53ef\u9760\u7684\u65b9\u5f0f\u6765\u5728\u7ebf\u6d4f\u89c8\u9a8c\u8bc1\u7801\u8ff7\u5bab\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u501f\u52a9 Chrome \u6269\u5c55\u7a0b\u5e8f\u91ca\u653e Python \u548c Selenium \u7684\u6f5c\u529b\uff0c\u4e00\u52b3\u6c38\u9038\u5730\u544a\u522b\u9a8c\u8bc1\u7801\u7684\u70e6\u607c\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4f8b\u5b50\uff1a<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0b\u9762\u662f\u4e00\u4e2a\u793a\u4f8b Python \u4ee3\u7801\uff0c\u6f14\u793a\u5982\u4f55\u4f7f\u7528 Selenium \u548c Chrome WebDriver \u89e3\u51b3\u7b80\u5355\u7684\u57fa\u4e8e\u6587\u672c\u7684\u9a8c\u8bc1\u7801\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code data-no-translation=\"\">from selenium import webdriver\nfrom selenium.webdriver.common.by import By\nfrom selenium.webdriver.support.ui import WebDriverWait\nfrom selenium.webdriver.support import expected_conditions as EC\n\n# Path to Chrome WebDriver executable\nchrome_driver_path = '\/path\/to\/chromedriver'\n\n# Initialize Chrome WebDriver\noptions = webdriver.ChromeOptions()\n# Add Chrome extension for captcha solving\noptions.add_extension('\/path\/to\/captcha_solver_extension.crx')\ndriver = webdriver.Chrome(executable_path=chrome_driver_path, options=options)\n\n# URL of the webpage containing the captcha\ncaptcha_url = 'https:\/\/example.com\/captcha_page'\n\n# Navigate to the webpage\ndriver.get(captcha_url)\n\n# Wait for the captcha element to be visible\ncaptcha_element = WebDriverWait(driver, 10).until(\n    EC.visibility_of_element_located((By.ID, 'captcha_image'))\n)\n\n# Capture the captcha text\ncaptcha_text = captcha_element.text\n\n# Solve the captcha using the Chrome extension\n# Note: The specific implementation depends on the extension used\n\n# Input the captcha solution into the form field\nsolution_input = driver.find_element(By.ID, 'captcha_solution')\nsolution_input.send_keys(captcha_text)\n\n# Submit the form\nsubmit_button = driver.find_element(By.ID, 'submit_button')\nsubmit_button.click()\n\n# Wait for the next page to load or continue with further automation steps\n\n# Close the browser session\ndriver.quit()<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u5728\u6b64\u793a\u4f8b\u4e2d\uff1a<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u6211\u4eec\u4ece Selenium \u5e93\u5bfc\u5165\u5fc5\u8981\u7684\u6a21\u5757\u3002<\/li>\n\n\n\n<li>\u6211\u4eec\u5b9a\u4e49 Chrome WebDriver \u53ef\u6267\u884c\u6587\u4ef6\u7684\u8def\u5f84\u5e76\u4f7f\u7528\u6240\u9700\u7684\u9009\u9879\u521d\u59cb\u5316 WebDriver\u3002<\/li>\n\n\n\n<li>\u6211\u4eec\u6307\u5b9a\u5305\u542b\u9a8c\u8bc1\u7801\u7684\u7f51\u9875\u7684 URL\u3002<\/li>\n\n\n\n<li>\u6211\u4eec\u5bfc\u822a\u5230\u7f51\u9875\u5e76\u7b49\u5f85\u9a8c\u8bc1\u7801\u5143\u7d20\u53ef\u89c1\u3002<\/li>\n\n\n\n<li>\u6211\u4eec\u6355\u83b7\u9a8c\u8bc1\u7801\u7684\u6587\u672c\u3002<\/li>\n\n\n\n<li>\u6211\u4eec\u4f7f\u7528 Chrome \u6269\u5c55\u7a0b\u5e8f\u89e3\u51b3\u9a8c\u8bc1\u7801\uff08\u6b64\u90e8\u5206\u4f1a\u6839\u636e\u6240\u4f7f\u7528\u7684\u5177\u4f53\u6269\u5c55\u7a0b\u5e8f\u800c\u6709\u6240\u4e0d\u540c\uff09\u3002<\/li>\n\n\n\n<li>\u6211\u4eec\u5c06\u9a8c\u8bc1\u7801\u89e3\u51b3\u65b9\u6848\u8f93\u5165\u5230\u8868\u5355\u5b57\u6bb5\u4e2d\u3002<\/li>\n\n\n\n<li>\u6211\u4eec\u63d0\u4ea4\u8868\u683c\u3002<\/li>\n\n\n\n<li>\u6211\u4eec\u6839\u636e\u9700\u8981\u5904\u7406\u8fdb\u4e00\u6b65\u7684\u81ea\u52a8\u5316\u6b65\u9aa4\u3002<\/li>\n\n\n\n<li>\u6700\u540e\uff0c\u6211\u4eec\u5173\u95ed\u6d4f\u89c8\u5668\u4f1a\u8bdd\u3002<\/li>\n<\/ol>","protected":false},"excerpt":{"rendered":"<p>Captcha, an acronym for Completely Automated Public Turing test to tell Computers and Humans Apart, has become an omnipresent barrier on the internet. From preventing spam to safeguarding online transactions, captchas are ubiquitous. However, they can be a nuisance, hindering user experience and impeding automation processes. In this article, we explore a potential solution utilizing [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":923145,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-923144","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-articles"],"acf":[],"_links":{"self":[{"href":"https:\/\/proxyelite.info\/cn\/wp-json\/wp\/v2\/posts\/923144","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/proxyelite.info\/cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/proxyelite.info\/cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/proxyelite.info\/cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/proxyelite.info\/cn\/wp-json\/wp\/v2\/comments?post=923144"}],"version-history":[{"count":0,"href":"https:\/\/proxyelite.info\/cn\/wp-json\/wp\/v2\/posts\/923144\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/proxyelite.info\/cn\/wp-json\/wp\/v2\/media\/923145"}],"wp:attachment":[{"href":"https:\/\/proxyelite.info\/cn\/wp-json\/wp\/v2\/media?parent=923144"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/proxyelite.info\/cn\/wp-json\/wp\/v2\/categories?post=923144"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/proxyelite.info\/cn\/wp-json\/wp\/v2\/tags?post=923144"}],"curies":[{"name":"\u53ef\u6e7f\u6027\u7c89\u5242","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}