MCPcopy Create free account
hub / github.com/seleniumbase/SeleniumBase / __init__

Method __init__

seleniumbase/undetected/__init__.py:43–353  ·  view source on GitHub ↗

Starts the Chrome service and creates a new instance of chromedriver. Parameters ---------- options: (default: None) Takes an instance of ChromeOptions to customize browser behavior. user_data_dir: None (default) Create a

(
        self,
        options=None,
        user_data_dir=None,
        driver_executable_path=None,
        browser_executable_path=None,
        port=0,
        enable_cdp_events=False,
        log_level=0,
        headless=False,
        patch_driver=True,
        version_main=None,
        patcher_force_close=False,
        suppress_welcome=True,
        use_subprocess=True,
        debug=False,
        **kw,
    )

Source from the content-addressed store, hash-verified

41 debug = False
42
43 def __init__(
44 self,
45 options=None,
46 user_data_dir=None,
47 driver_executable_path=None,
48 browser_executable_path=None,
49 port=0,
50 enable_cdp_events=False,
51 log_level=0,
52 headless=False,
53 patch_driver=True,
54 version_main=None,
55 patcher_force_close=False,
56 suppress_welcome=True,
57 use_subprocess=True,
58 debug=False,
59 **kw,
60 ):
61 """
62 Starts the Chrome service and creates a new instance of chromedriver.
63
64 Parameters
65 ----------
66
67 options: (default: None)
68 Takes an instance of ChromeOptions to customize browser behavior.
69
70 user_data_dir:
71 None (default) Create a temp profile directory for the browser.
72 If user_data_dir is a path to a valid Chrome profile directory,
73 use it and turn off the automatic removal mechanism at exit.
74
75 driver_executable_path:
76 None (default) Downloads and patches the new binary.
77
78 browser_executable_path:
79 None (default) Use find_chrome_executable().
80 (If not specified, make sure Chrome is on the PATH.)
81
82 port: (default: 0)
83 Port you would like the service to run.
84 If left as 0, a free port will be found.
85
86 enable_cdp_events: (default: False)
87 When enabled, you can subscribe to CDP events by using:
88
89 driver.add_cdp_listener("Network.dataReceived", yourcallback)
90 # yourcallback: callable that accepts exactly 1 dict parameter.
91
92 log_level: (default: adapts to python global log level)
93
94 headless: (default: False)
95 Use headless mode.
96 (Already handled by seleniumbase/core/browser_launcher.py)
97
98 patch_driver: (default: True)
99 Patches uc_driver to be undetectable if not already patched.
100

Callers

nothing calls this directly

Calls 12

handle_prefsMethod · 0.95
PatcherClass · 0.85
ChromeOptionsClass · 0.85
start_detachedFunction · 0.85
ReactorClass · 0.85
autoMethod · 0.80
add_argumentMethod · 0.80
loadMethod · 0.80
startMethod · 0.80
find_chrome_executableFunction · 0.70
quitMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected