- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1.4k
Open
Labels
Tutorials & LearningTutorial videos and blog postsTutorial videos and blog postsUC Mode / CDP ModeUndetected Chromedriver Mode / CDP ModeUndetected Chromedriver Mode / CDP Modedocumentation
Description
There's a new UC Mode video showing how it works, and how it fixes bugs with undetected-chromedriver:
https://www.youtube.com/watch?v=5dMFI3e85ig
Note the improvements made:
- Driver version-detection & management.
- Allowing mismatched browser/driver versions.
- Automatically changing the user agent to prevent detection. (HeadlessChrometoChrome)
- Automatically disconnecting chromedriver from Chrome as needed. (And reconnecting)
- Multithreading tests in parallel via pytest-xdist.
- Adjusting configuration based on the environment. (Linux/Ubuntu vs Windows vs macOS)
- Explaining how to set a custom user-data-dircorrectly.
- Has options for setting proxy and proxy-with-auth.
Many of these fixes can be back-ported easily to undetected-chromedriver. (Explanation in the video of how to do that, such as using requests.get(url) before navigating to a URL to know if you need to disconnect/reconnect the driver from Chrome.)
Here's a script with retries and a captcha-click failsafe for bypassing detection:
from seleniumbase import SB
with SB(uc=True) as sb:
    sb.driver.get("https://nowsecure.nl/#relax")
    sb.sleep(1)
    if not sb.is_text_visible("OH YEAH, you passed!", "h1"):
        sb.get_new_driver(undetectable=True)
        sb.driver.get("https://nowsecure.nl/#relax")
        sb.sleep(1)
    if not sb.is_text_visible("OH YEAH, you passed!", "h1"):
        if sb.is_element_visible('iframe[src*="challenge"]'):
            with sb.frame_switch('iframe[src*="challenge"]'):
                sb.click("span.mark")
                sb.sleep(2)
    sb.activate_demo_mode()
    sb.assert_text("OH YEAH, you passed!", "h1", timeout=3)The presentation slides were autogenerated by running: https://github.com/seleniumbase/SeleniumBase/blob/master/examples/presenter/uc_presentation.py
Here are some existing examples that use --uc mode:
LiPingYen, harmindersinghnijjar, stevedep and boludozpierre-aurele-martin, DanielTatarkin and sunnymnie
Metadata
Metadata
Assignees
Labels
Tutorials & LearningTutorial videos and blog postsTutorial videos and blog postsUC Mode / CDP ModeUndetected Chromedriver Mode / CDP ModeUndetected Chromedriver Mode / CDP Modedocumentation
