Skip to content

Add command-line shortcuts for Pure CDP Mode (sb_cdp) #4008

@mdmintz

Description

@mdmintz

Add command-line shortcuts for Pure CDP Mode (sb_cdp)

So far, if you wanted to pass options to Pure CDP Mode, such as incognito=True, then it would be done via sb_cdp.Chrome(), eg:

from seleniumbase import sb_cdp

url = "https://seleniumbase.io/apps/turnstile"
sb = sb_cdp.Chrome(url, incognito=True)
sb.gui_click_captcha()
sb.assert_element("img#captcha-success")
sb.sleep(2)
sb.driver.stop()

But now, we're adding the ability to set options via command-line args. Here's what to expect, with examples:

python SCRIPT.py --incognito
python SCRIPT.py --guest
python SCRIPT.py --headless
python SCRIPT.py --ad-block
python SCRIPT.py --agent="MY NEW USER AGENT"
python SCRIPT.py --geolocation="(31.774390, 35.222450)"
python SCRIPT.py --timezone=="Asia/Kolkata"
python SCRIPT.py --platform="MacIntel"
python SCRIPT.py --lang="fr"
python SCRIPT.py --proxy="USER:PASS@SERVER:PORT"
python SCRIPT.py --binary-location="/Applications/Brave Browser.app/Contents/MacOS/Brave Browser"

There are a few additional options on Linux, such as --gui/--headed, (which overrides the default Linux headless mode).
And there's --xvfb on Linux for the special virtual display (which may already be set by default if not using other options).

This aims to simplify option-handling, as you will no longer need to modify a script itself in order to change how it runs.

For those unaware, sb_cdp (Pure CDP Mode) is a special stealth mode of SeleniumBase that doesn't use Selenium at all.

Metadata

Metadata

Assignees

Labels

UC Mode / CDP ModeUndetected Chromedriver Mode / CDP ModeenhancementMaking things better

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions