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>(Note: If running UC Mode scripts on headless Linux machines, then you'll need to use the <b><codetranslate="no">SB</code></b> manager instead of the <b><codetranslate="no">Driver</code></b> manager because the <b><codetranslate="no">SB</code></b> manager includes a special virtual display that allows for <b><codetranslate="no">PyAutoGUI</code></b> actions.)</p>
2683
-
<p>👤 Here's a longer example, which includes a special <b><codetranslate="no">PyAutoGUI</code></b>click if the CAPTCHA isn't bypassed on the initial page load:</p>
2685
+
<p>👤 Here's a longer example: (Note that <codetranslate="no">sb.uc_gui_click_captcha()</code> performs a special click using <b><codetranslate="no">PyAutoGUI</code></b> if a CAPTCHA is detected.)</p>
<p>If running on a Linux server, <code>uc_gui_handle_captcha()</code> might not be good enough. Switch to <code>uc_gui_click_captcha()</code> to be more stealthy. Note that these methods auto-detect between CF Turnstile and Google reCAPTCHA.</p>
2710
-
<p>Sometimes you need to add <code>incognito=True</code> with <code>uc=True</code> to maximize your anti-detection abilities. (Some websites can detect you if you don't do that.)</p>
2712
+
<p>Sometimes you need to add <codetranslate="no">incognito=True</code> with <codetranslate="no">uc=True</code> to maximize your anti-detection abilities. (Some websites can detect you if you don't do that.)</p>
2711
2713
<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_gui_click_captcha</span><spanclass="p">()</span><spanclass="c1"># Only if needed</span>
2749
+
<spanclass="n">sb</span><spanclass="o">.</span><spanclass="n">uc_gui_click_captcha</span><spanclass="p">()</span><spanclass="c1"># Only used if needed</span>
<p><ahref="https://github.com/mdmintz/undetected-testing/actions/runs/9637461606/job/26576722411"><imgwidth="540" alt="uc_gui_click_captcha on Linux" src="https://github.com/seleniumbase/SeleniumBase/assets/6788579/6aceb2a3-2a32-4521-b30a-f79446d2ce28"></a></p>
2755
-
<p>The 2nd <code>print()</code> should output "Virtual Manager", which means that the automation successfully passed the Turnstile.</p>
2757
+
<p>The 2nd <codetranslate="no">print()</code> should output <codetranslate="no">Virtual Manager</code>, which means that the automation successfully passed the Turnstile.</p>
2756
2758
<hr/>
2757
2759
<p>👤 In <btranslate="no">UC Mode</b>, <codetranslate="no">driver.get(url)</code> has been modified from its original version: If anti-bot services are detected from a <codetranslate="no">requests.get(url)</code> call that's made before navigating to the website, then <codetranslate="no">driver.uc_open_with_reconnect(url)</code> will be used instead. To open a URL normally in <btranslate="no">UC Mode</b>, use <codetranslate="no">driver.default_get(url)</code>.</p>
<h3id="here-are-the-driver-specific-methods-added-by-seleniumbase-for-uc-mode-uc-uctrue">👤 Here are the <b><codetranslate="no">driver</code></b>-specific methods added by SeleniumBase for UC Mode: <code>--uc</code> / <b><codetranslate="no">uc=True</code></b><aclass="headerlink" href="#here-are-the-driver-specific-methods-added-by-seleniumbase-for-uc-mode-uc-uctrue" title="Permanent link">¶</a></h3>
2793
+
<h3id="here-are-the-seleniumbase-uc-mode-methods-uc-uctrue">👤 Here are the SeleniumBase UC Mode methods: (<code>--uc</code> / <strong><code>uc=True</code></strong>)<aclass="headerlink" href="#here-are-the-seleniumbase-uc-mode-methods-uc-uctrue" title="Permanent link">¶</a></h3>
<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>
2847
2849
<hr/>
2848
-
<p>👤 On Linux, you may need to use <code>uc_gui_click_captcha()</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>uc_gui_click_captcha()</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>
2849
-
<p>👤 <code>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>
2850
-
<p>👤 <code>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 selector above 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>, (if <code>True</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>
2851
-
<p>👤 <code>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>
2850
+
<p>👤 On Linux, you may need to use <codetranslate="no">uc_gui_click_captcha()</code> to successfully bypass a CAPTCHA. If there's more than one CAPTCHA on a website, then put the CSS Selector of an element that's above the CAPTCHA as the first arg to <codetranslate="no">uc_gui_click_captcha()</code>. This method uses <codetranslate="no">pyautogui</code>. In order for <codetranslate="no">pyautogui</code> to focus on the correct element, use <codetranslate="no">xvfb=True</code> / <codetranslate="no">--xvfb</code> to activate a special virtual display on Linux.</p>
2851
+
<p>👤 <codetranslate="no">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 <codetranslate="no">uc_gui_click_cf()</code> and <codetranslate="no">uc_gui_click_rc()</code> as needed.</p>
2852
+
<p>👤 <codetranslate="no">uc_gui_click_cf(frame="iframe", retry=False, blind=False)</code> has three args. (All optional). The first one, <codetranslate="no">frame</code>, lets you specify the selector above the <codetranslate="no">iframe</code> in case the CAPTCHA is not located in the first <codetranslate="no">iframe</code> on the page. (In the case of Shadow-DOM, specify the selector of an element that's above the Shadow-DOM.) The second one, <codetranslate="no">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, <codetranslate="no">blind</code>, (if <codetranslate="no">True</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>
2853
+
<p>👤 <codetranslate="no">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>
2852
2854
<hr/>
2853
2855
<p>👤 To find out if <btranslate="no">UC Mode</b> will work at all on a specific site (before adjusting for timing), load your site with the following script:</p>
<p>(If you remain undetected while loading the page and performing manual actions, then you know you can create a working script once you swap the breakpoint with a time and add special methods like <b><codetranslate="no">sb.uc_click</code></b> as needed.)</p>
2860
2862
<hr/>
2861
2863
<p>👤 <b>Multithreaded UC Mode:</b></p>
2862
-
<p>If you're using <b><codetranslate="no">pytest</code></b> for multithreaded <btranslate="no">UC Mode</b> (which requires using one of the <b><codetranslate="no">pytest</code></b><ahref="../syntax_formats/">syntax formats</a>), then all you have to do is set the number of threads when your script runs. (<code>-n NUM</code>) Eg:</p>
2864
+
<p>If you're using <b><codetranslate="no">pytest</code></b> for multithreaded <btranslate="no">UC Mode</b> (which requires using one of the <b><codetranslate="no">pytest</code></b><ahref="../syntax_formats/">syntax formats</a>), then all you have to do is set the number of threads when your script runs. (<codetranslate="no">-n NUM</code>) Eg:</p>
0 commit comments