You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>If running on a Linux server, <code>uc_gui_handle_cf()</code> might not be good enough. Switch to <code>uc_gui_click_cf()</code> to be more stealthy. You can also use <code>uc_gui_click_captcha()</code> as a generic CAPTCHA-clicker, which auto-detects between CF Turnstile and reCAPTCHA.</p>
2704
+
<p>If running on a Linux server, <code>uc_gui_handle_cf()</code> might not be good enough. Switch to <code>uc_gui_click_cf()</code> to be more stealthy. You can also use <code>uc_gui_click_captcha()</code> as a generic CAPTCHA-clicker, which auto-detects between CF Turnstile and Google reCAPTCHA.</p>
2704
2705
<p>👤 Here's an example <b>where the CAPTCHA appears after submitting a form</b>:</p>
<spanclass="n">sb</span><spanclass="o">.</span><spanclass="n">uc_open_with_reconnect</span><spanclass="p">(</span><spanclass="n">url</span><spanclass="p">,</span><spanclass="mi">1</span><spanclass="p">)</span><spanclass="c1"># The bot-check is later</span>
2712
+
<spanclass="n">sb</span><spanclass="o">.</span><spanclass="n">uc_open_with_reconnect</span><spanclass="p">(</span><spanclass="n">url</span><spanclass="p">,</span><spanclass="mi">2</span><spanclass="p">)</span><spanclass="c1"># The bot-check is later</span>
<p>(Note that while the special <b><codetranslate="no">UC Mode</code></b> breakpoint is active, you can't use <b><codetranslate="no">Selenium</code></b> commands in the browser, and the browser can't detect <b><codetranslate="no">Selenium</code></b>.)</p>
2829
-
<p>👤 On Linux, you may need to use <code>driver.uc_gui_click_cf()</code> to successfully bypass a Cloudflare CAPTCHA. If there's more than one iframe on that website (and Cloudflare isn't the first one) then put the CSS Selector of that iframe as the first arg to <code>driver.uc_gui_click_cf()</code>. This method uses <code>pyautogui</code>. In order for <code>pyautogui</code> to focus on the correct element, use <code>xvfb=True</code> / <code>--xvfb</code> to activate a special virtual display on Linux.</p>
2827
+
<p>👤 On Linux, you may need to use <code>driver.uc_gui_click_cf()</code> to successfully bypass a Cloudflare CAPTCHA. If there's more than one Cloudflare iframe on that website, then put the CSS Selector of an element that's above the iframe as the first arg to <code>driver.uc_gui_click_cf()</code>. This method uses <code>pyautogui</code>. In order for <code>pyautogui</code> to focus on the correct element, use <code>xvfb=True</code> / <code>--xvfb</code> to activate a special virtual display on Linux.</p>
2830
2828
<p>👤 <code>driver.uc_gui_click_cf(frame="iframe", retry=False, blind=False)</code> has three args. (All optional). The first one, <code>frame</code>, lets you specify the iframe in case the CAPTCHA is not located in the first iframe on the page. The second one, <code>retry</code>, lets you retry the click after reloading the page if the first one didn't work (and a CAPTCHA is still present after the page reload). The third arg, <code>blind</code>, will retry after a page reload (if the first click failed) by clicking at the last known coordinates of the CAPTCHA checkbox without confirming first with Selenium that a CAPTCHA is still on the page.</p>
2831
2829
<p>👤 <code>driver.uc_gui_click_rc(frame="iframe", retry=False, blind=False)</code> is for reCAPTCHA. This may only work a few times before not working anymore... not because Selenium was detected, but because reCAPTCHA uses advanced AI to detect unusual activity, unlike the CF Turnstile, which only uses basic detection.</p>
2832
2830
<p>👤 <code>driver.uc_gui_click_captcha()</code> auto-detects the CAPTCHA type before trying to click it. This is a generic method for both CF Turnstile and Google reCAPTCHA. It will use the code from <code>uc_gui_click_cf()</code> and <code>uc_gui_click_rc()</code> as needed.</p>
<p>The above JS method is used within the <b><codetranslate="no">SeleniumBase</code></b><btranslate="no">UC Mode</b> method: <b><codetranslate="no">driver.uc_click(selector)</code></b> so that clicking can be done in a stealthy way. <btranslate="no">UC Mode</b> schedules your click, disconnects <b><codetranslate="no">chromedriver</code></b> from <btranslate="no">Chrome</b>, waits a little (customizable), and reconnects.</p>
2896
2894
<hr/>
2895
+
<p>🛠️ <b>Troubleshooting UC Mode</b></p>
2896
+
<p>On Windows, the <code>uc_gui_click_cf()</code> and <code>uc_gui_click_captcha()</code> methods require "Scaling" to be set at "100%". (Note that "100%" may be different from the system's "Recommended" percent, which can be higher depending on your screen resolution and monitor size.)</p>
2897
+
<p><imgsrc="https://seleniumbase.github.io/other/ts_uc_1.jpg" title="Make sure Scaling is set to 100%" width="410"></p>
2898
+
<p>As an alternative to using the <code>uc_gui_click_cf()</code> or <code>uc_gui_click_captcha()</code> methods on Windows, you can use <code>sb.uc_gui_handle_cf()</code>, which does not require "Scaling" to be set to a specific value. Instead of using the mouse to click a CAPTCHA, <code>sb.uc_gui_handle_cf()</code> uses a combination of the <code>TAB</code> key and the <code>SPACEBAR</code>.</p>
2899
+
<hr/>
2897
2900
<p>🏆 <b>Choosing the right CAPTCHA service</b> for your business / website:</p>
<p>As an ethical hacker / cybersecurity researcher who builds bots that bypass CAPTCHAs for sport, <b>the CAPTCHA service that I personally recommend</b> for keeping bots out is <btranslate="no">Google's reCAPTCHA</b>:</p>
0 commit comments