<bdo id='O7MrI'></bdo><ul id='O7MrI'></ul>

  • <tfoot id='O7MrI'></tfoot>
  • <small id='O7MrI'></small><noframes id='O7MrI'>

      <i id='O7MrI'><tr id='O7MrI'><dt id='O7MrI'><q id='O7MrI'><span id='O7MrI'><b id='O7MrI'><form id='O7MrI'><ins id='O7MrI'></ins><ul id='O7MrI'></ul><sub id='O7MrI'></sub></form><legend id='O7MrI'></legend><bdo id='O7MrI'><pre id='O7MrI'><center id='O7MrI'></center></pre></bdo></b><th id='O7MrI'></th></span></q></dt></tr></i><div id='O7MrI'><tfoot id='O7MrI'></tfoot><dl id='O7MrI'><fieldset id='O7MrI'></fieldset></dl></div>

        <legend id='O7MrI'><style id='O7MrI'><dir id='O7MrI'><q id='O7MrI'></q></dir></style></legend>

        如何使用 Selenium 和 Python 绕过 Google 验证码?

        时间:2023-06-05

            <bdo id='aUa7g'></bdo><ul id='aUa7g'></ul>
              • <tfoot id='aUa7g'></tfoot>

                <small id='aUa7g'></small><noframes id='aUa7g'>

                  <tbody id='aUa7g'></tbody>
                <legend id='aUa7g'><style id='aUa7g'><dir id='aUa7g'><q id='aUa7g'></q></dir></style></legend>
                1. <i id='aUa7g'><tr id='aUa7g'><dt id='aUa7g'><q id='aUa7g'><span id='aUa7g'><b id='aUa7g'><form id='aUa7g'><ins id='aUa7g'></ins><ul id='aUa7g'></ul><sub id='aUa7g'></sub></form><legend id='aUa7g'></legend><bdo id='aUa7g'><pre id='aUa7g'><center id='aUa7g'></center></pre></bdo></b><th id='aUa7g'></th></span></q></dt></tr></i><div id='aUa7g'><tfoot id='aUa7g'></tfoot><dl id='aUa7g'><fieldset id='aUa7g'></fieldset></dl></div>

                  本文介绍了如何使用 Selenium 和 Python 绕过 Google 验证码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  如何使用 Selenium 和 Python 绕过 Google 验证码?

                  How can I bypass the Google CAPTCHA using Selenium and Python?

                  当我尝试抓取某些内容时,Google 会给我一个验证码.我可以使用 Selenium Python 绕过 Google 验证码吗?

                  When I try to scrape something, Google give me a CAPTCHA. Can I bypass the Google CAPTCHA with Selenium Python?

                  例如,它是 Google reCAPTCHA.您可以通过以下链接查看此验证码:https://www.google.com/recaptcha/api2/演示

                  As an example, it's Google reCAPTCHA. You can see this CAPTCHA via this link: https://www.google.com/recaptcha/api2/demo

                  推荐答案

                  开始使用 Selenium 的 Python 客户端,你应该避免解决/绕过 Google 验证码.

                  To start with using Selenium's Python clients, you should avoid solving/bypass Google CAPTCHA.

                  Selenium 使浏览器自动化.现在,您想用这种能力实现什么完全取决于个人,但主要是为了通过浏览器客户端自动化 Web 应用程序以进行测试,当然不限于此.

                  Selenium automates browsers. Now, what you want to achieve with that power is entirely up to individuals, but primarily it is for automating web applications through browser clients for testing purposes and of coarse it is certainly not limited to that.

                  另一方面,CAPTCHA(缩写为 ...完全自动化用于区分计算机和人类的公共图灵测试...)是一种用于计算以确定用户是否是人类的挑战-响应测试.

                  On the other hand, CAPTCHA (the acronym being ...Completely Automated Public Turing test to tell Computers and Humans Apart...) is a type of challenge–response test used in computing to determine if the user is human.

                  因此,SeleniumCAPTCHA 服务于两个完全不同的目的,理想情况下不应该用于完成任何相互关联的任务.

                  So, Selenium and CAPTCHA serves two completely different purposes and ideally shouldn't be used to achieve any interrelated tasks.

                  话虽如此,reCAPTCHA 可以轻松检测网络流量并将您的程序识别为 Selenium 驱动 bot.

                  Having said that, reCAPTCHA can easily detect the network traffic and identify your program as a Selenium driven bot.

                  但是,有一些通用方法可以避免在网页抓取时被检测到:

                  However, there are some generic approaches to avoid getting detected while web scraping:

                  • 网站可以确定您的脚本/程序的首要属性是您的显示器大小.所以建议不要使用常规的Viewport.
                  • 如果您需要向网站发送多个请求,请继续更改每个请求的用户代理.在这里您可以找到关于 如何在 Selenium 中更改 Google Chrome 用户代理?
                  • 要模拟 类人 行为,您可能需要减慢脚本执行速度,甚至超出 WebDriverWait 和 expected_conditions 诱导 time.sleep(secs).在这里您可以找到关于如何的详细讨论在 Python 中休眠 Selenium WebDriver 几毫秒
                  • The first and foremost attribute a website can determine your script/program by is through your monitor size. So it is recommended not to use the conventional Viewport.
                  • If you need to send multiple requests to a website, keep on changing the User Agent on each request. Here you can find a detailed discussion on Way to change Google Chrome user agent in Selenium?
                  • To simulate humanlike behavior, you may require to slow down the script execution even beyond WebDriverWait and expected_conditions inducing time.sleep(secs). Here you can find a detailed discussion on How to sleep Selenium WebDriver in Python for milliseconds

                  但是,在几个用例中,我们能够与 reCAPTCHA 进行交互使用 Selenium,您可以在以下讨论中找到更多详细信息:

                  However, in a couple of use cases we were able to interact with the reCAPTCHA using Selenium and you can find more details in the following discussions:

                  • 如何点击使用 Selenium 和 Java 的 reCAPTCHA
                  • CSS 选择器使用 Selenium 和 VBA Excel 进行 reCAPTCHA 支票簿
                  • 查找reCAPTCHA 元素并点击它——Python + Selenium

                  您可以在以下位置找到一些相关的讨论:

                  You can find a couple of related discussion in:

                  • 如何通过 Python 使用 GeckoDriver 和 Firefox 使 Selenium 脚本无法检测?
                  • 是否存在无法检测到的 Selenium WebDriver 版本?
                  • reCAPTCHA 3 如何知道我在使用 Selenium/chromedriver?

                  这篇关于如何使用 Selenium 和 Python 绕过 Google 验证码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  <i id='ihMh9'><tr id='ihMh9'><dt id='ihMh9'><q id='ihMh9'><span id='ihMh9'><b id='ihMh9'><form id='ihMh9'><ins id='ihMh9'></ins><ul id='ihMh9'></ul><sub id='ihMh9'></sub></form><legend id='ihMh9'></legend><bdo id='ihMh9'><pre id='ihMh9'><center id='ihMh9'></center></pre></bdo></b><th id='ihMh9'></th></span></q></dt></tr></i><div id='ihMh9'><tfoot id='ihMh9'></tfoot><dl id='ihMh9'><fieldset id='ihMh9'></fieldset></dl></div>

                  • <bdo id='ihMh9'></bdo><ul id='ihMh9'></ul>

                        1. <small id='ihMh9'></small><noframes id='ihMh9'>

                          <tfoot id='ihMh9'></tfoot><legend id='ihMh9'><style id='ihMh9'><dir id='ihMh9'><q id='ihMh9'></q></dir></style></legend>
                            <tbody id='ihMh9'></tbody>