Description
Getting ready for the next UC Mode video tutorial
If you haven't already heard the news, the last one was quite popular:
Thousands of views, hundreds of likes, and people want to see more.
(Here's the GitHub ticket for the previous video: #2213)
Now comes the time to plan the next one. There are lot of things that I didn't get to cover last time. I'll start a list:
📗 People wanted more information about the renamed Chrome console variables that appear when chromedriver launches Chrome. This is quite easy to show in a screenshot:

If you use regular Selenium/WebDriver to launch Chrome, those variables appear in the console. It's one of the easiest ways for websites to detect Selenium. In UC Mode, those variables are renamed/removed.
📗 Since the previous tutorial, more examples have been added:
In particular, those example deal with a different type of CloudFlare CAPTCHA: One where all users must click the box (generally after filling out a form) in order to proceed. The first video covered the CAPTCHA that only appears when you initially load a page. Only traffic detected as bot-traffic would be stopped by it. With the form CAPTCHA, everyone has to click the box (even if Cloudflare thinks you're human) so it has to be handled in a different/special way.
📗 The previous tutorial did not cover all the differences between the Driver(uc=True)
and SB(uc=True)
formats. People need to know when they should use SB()
instead of Driver()
. In particular, the SB()
format does a lot more, and has a lot more methods. For instance, the SB()
format will automatically close the driver for you at the end of the test or code block, whereas in the Driver()
format, the user needs to call driver.quit()
in the script. Not doing that would cause a memory leak, which gets you detected. Also, the SB()
format also automatically handles virtual displays for environments with no GUI. With the Driver()
format, users may need to add in something like sbvirtualdisplay
themselves if they want to run on certain Linux environments while remaining undetected.
📗 Since the previous tutorial, a new way has been added in so that you can easily combine automation with manual intervention in UC Mode in such a way that it keeps your browser undetected. Here are a few examples of that:
sb.driver.uc_open_with_reconnect("https://nowsecure.nl/#relax", reconnect_time="breakpoint")
sb.driver.uc_open_with_reconnect("https://nowsecure.nl/#relax", "breakpoint")
sb.driver.reconnect(timeout="breakpoint")
sb.driver.reconnect("breakpoint")
It's important to note that while in that special breakpoint()
, websites can't detect you, but it also means that you can't call any Selenium commands until after you've left the breakpoint()
. (More info on that here: #2384)
📗 People want to see more live demos using sites with non-Cloudflare protection. (The previous live demos mainly covered Cloudflare-protected sites.)
📗 People also commented on the video clips (mainly of Star Trek actors) that were embedded in the full video for entertainment value and highlighting important points. There seemed to be a love/hate reaction to that, where some people really enjoyed them, while others saw it as a distraction. Based on YouTube's apparent algorithm, adding small clips into a video like that seems to make videos far more likely to appear in the Suggested Videos section of other videos, which greatly increases the number of people who find out about a video and watch it. At least for the time being, my channel and videos can really benefit from any marketing assistance that they can get... which means the video clips will continue for now, but I'll try using fewer of them in total. (To the person who said Christopher Lloyd wasn't in Star Trek... Please watch Star Trek III: The Search for Spock... Lloyd was the main villain!)
📗 People were wondering how to combine UC Mode with Wire Mode so that the browser remains undetected while still being able to see the requests being made. (The two modes cannot be used together.) Wire Mode uses an unmodified selenium-wire
for that, so there's not much that can be done there unless selenium-wire
makes changes to their repo to support that. To make matters worse, "Selenium Wire is no longer being maintained" according to their repo. (They announced that in January 2024). The good news is that alternatives exist, eg: SeleniumBase/examples/uc_cdp_events.py, which demonstrates how to collect CDP events from the browser. Additionally, I'm working on a selenium-wire
alternative that allows you to see browser requests (and still be compatible with UC Mode).
📗 People also want to know how to record automation scripts while using UC Mode. Just start the Recorder like this:
sbase recorder --uc
Additionally, you can activate the Recorder in the middle of a script like this: self.activate_recorder()
📗 There's also a new UC Mode section in the SeleniumBase Docs: SeleniumBase/help_docs/uc_mode.md
Looks like there are lots of things to cover in the next UC Mode video tutorial. Get ready to be ready!