|  | 
| 16 | 16 | 
 | 
| 17 | 17 | ---- | 
| 18 | 18 | 
 | 
|  | 19 | +<!-- YouTube View --><a href="https://www.youtube.com/watch?v=-EpZlhGWo9k"><img src="http://img.youtube.com/vi/-EpZlhGWo9k/0.jpg" title="SeleniumBase on YouTube" width="350" /></a> | 
|  | 20 | +<p>(<b><a href="https://www.youtube.com/watch?v=-EpZlhGWo9k">Watch the 3rd UC Mode tutorial on YouTube! ▶️</a></b>)</p> | 
|  | 21 | + | 
|  | 22 | +---- | 
|  | 23 | + | 
| 19 | 24 | 👤 <b translate="no">UC Mode</b> is based on [undetected-chromedriver](https://github.com/ultrafunkamsterdam/undetected-chromedriver), but includes multiple updates, fixes, and improvements, such as: | 
| 20 | 25 | 
 | 
| 21 | 26 | * Automatically changing user agents to prevent detection. | 
| @@ -83,6 +88,8 @@ with SB(uc=True, test=True) as sb: | 
| 83 | 88 | 
 | 
| 84 | 89 | If running on a Linux server, `uc_gui_handle_captcha()` might not be good enough. Switch to `uc_gui_click_captcha()` to be more stealthy. Note that these methods auto-detect between CF Turnstile and Google reCAPTCHA. | 
| 85 | 90 | 
 | 
|  | 91 | +Sometimes you need to add `incognito=True` with `uc=True` to maximize your anti-detection abilities. (Some websites can detect you if you don't do that.) | 
|  | 92 | + | 
| 86 | 93 | 👤 Here's an example <b>where the CAPTCHA appears after submitting a form</b>: | 
| 87 | 94 | 
 | 
| 88 | 95 | ```python | 
| @@ -233,24 +240,24 @@ driver.reconnect("breakpoint") | 
| 233 | 240 | 
 | 
| 234 | 241 | (Note that while the special <b><code translate="no">UC Mode</code></b> breakpoint is active, you can't use <b><code translate="no">Selenium</code></b> commands in the browser, and the browser can't detect <b><code translate="no">Selenium</code></b>.) | 
| 235 | 242 | 
 | 
| 236 |  | -👤 On Linux, you may need to use `driver.uc_gui_click_captcha()` 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 `driver.uc_gui_click_captcha()`. This method uses `pyautogui`. In order for `pyautogui` to focus on the correct element, use `xvfb=True` / `--xvfb` to activate a special virtual display on Linux. | 
|  | 243 | +👤 On Linux, you may need to use `uc_gui_click_captcha()` 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 `uc_gui_click_captcha()`. This method uses `pyautogui`. In order for `pyautogui` to focus on the correct element, use `xvfb=True` / `--xvfb` to activate a special virtual display on Linux. | 
| 237 | 244 | 
 | 
| 238 |  | -👤 `driver.uc_gui_click_captcha()` 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 `uc_gui_click_cf()` and `uc_gui_click_rc()` as needed. | 
|  | 245 | +👤 `uc_gui_click_captcha()` 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 `uc_gui_click_cf()` and `uc_gui_click_rc()` as needed. | 
| 239 | 246 | 
 | 
| 240 |  | -👤 `driver.uc_gui_click_cf(frame="iframe", retry=False, blind=False)` has three args. (All optional). The first one, `frame`, lets you specify the iframe in case the CAPTCHA is not located in the first iframe on the page. The second one, `retry`, 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, `blind`, 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. | 
|  | 247 | +👤 `uc_gui_click_cf(frame="iframe", retry=False, blind=False)` has three args. (All optional). The first one, `frame`, 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, `retry`, 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, `blind`, (if `True`), 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. | 
| 241 | 248 | 
 | 
| 242 |  | -👤 `driver.uc_gui_click_rc(frame="iframe", retry=False, blind=False)` 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. | 
|  | 249 | +👤 `uc_gui_click_rc(frame="iframe", retry=False, blind=False)` 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. | 
| 243 | 250 | 
 | 
| 244 | 251 | 👤 To find out if <b translate="no">UC Mode</b> will work at all on a specific site (before adjusting for timing), load your site with the following script: | 
| 245 | 252 | 
 | 
| 246 | 253 | ```python | 
| 247 | 254 | from seleniumbase import SB | 
| 248 | 255 | 
 | 
| 249 | 256 | with SB(uc=True) as sb: | 
| 250 |  | -    sb.driver.uc_open_with_reconnect(URL, reconnect_time="breakpoint") | 
|  | 257 | +    sb.uc_open_with_reconnect(URL, reconnect_time="breakpoint") | 
| 251 | 258 | ``` | 
| 252 | 259 | 
 | 
| 253 |  | -(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><code translate="no">driver.uc_click</code></b> as needed.) | 
|  | 260 | +(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><code translate="no">sb.uc_click</code></b> as needed.) | 
| 254 | 261 | 
 | 
| 255 | 262 | 👤 <b>Multithreaded UC Mode:</b> | 
| 256 | 263 | 
 | 
| @@ -328,7 +335,7 @@ Avoiding detection while clicking is easy if you schedule your clicks to happen | 
| 328 | 335 | 
 | 
| 329 | 336 | <li><b><code translate="no">window.setTimeout(function() { SCRIPT }, MS);</code></b> --> (Info: <a href="https://www.w3schools.com/jsref/met_win_settimeout.asp" target="_blank">W3Schools</a>)</li> | 
| 330 | 337 | 
 | 
| 331 |  | -The above JS method is used within the <b><code translate="no">SeleniumBase</code></b> <b translate="no">UC Mode</b> method: <b><code translate="no">driver.uc_click(selector)</code></b> so that clicking can be done in a stealthy way. <b translate="no">UC Mode</b> schedules your click, disconnects <b><code translate="no">chromedriver</code></b> from <b translate="no">Chrome</b>, waits a little (customizable), and reconnects. | 
|  | 338 | +The above JS method is used within the <b><code translate="no">SeleniumBase</code></b> <b translate="no">UC Mode</b> method: <b><code translate="no">sb.uc_click(selector)</code></b> so that clicking can be done in a stealthy way. <b translate="no">UC Mode</b> schedules your click, disconnects <b><code translate="no">chromedriver</code></b> from <b translate="no">Chrome</b>, waits a little (customizable), and reconnects. | 
| 332 | 339 | 
 | 
| 333 | 340 | -------- | 
| 334 | 341 | 
 | 
|  | 
0 commit comments