* SeleniumBase Driver as a Python Context Manager or a returnable object. * Example 1: (context manager format) ----------------------------------- .. code-block:: python from seleniumbase import DriverContext with DriverContext() as driver: driver.get(
(
browser=None, # Choose from "chrome", "edge", "firefox", or "safari".
headless=None, # Use the default headless mode for Chromium and Firefox.
headless1=None, # Use Chromium's old headless mode. (Fast, but limited)
headless2=None, # Use Chromium's new headless mode. (Has more features)
headed=None, # Run tests in headed/GUI mode on Linux, where not default.
locale_code=None, # Set the Language Locale Code for the web browser.
protocol=None, # The Selenium Grid protocol: "http" or "https".
servername=None, # The Selenium Grid server/IP used for tests.
port=None, # The Selenium Grid port used by the test server.
proxy=None, # Use proxy. Format: "SERVER:PORT" or "USER:PASS@SERVER:PORT".
proxy_bypass_list=None, # Skip proxy when using the listed domains.
proxy_pac_url=None, # Use PAC file. (Format: URL or USERNAME:PASSWORD@URL)
multi_proxy=None, # Allow multiple proxies with auth when multi-threaded.
agent=None, # Modify the web browser's User-Agent string.
cap_file=None, # The desired capabilities to use with a Selenium Grid.
cap_string=None, # The desired capabilities to use with a Selenium Grid.
recorder_ext=None, # Enables the SeleniumBase Recorder Chromium extension.
disable_cookies=None, # Disable Cookies on websites. (Pages might break!)
disable_js=None, # Disable JavaScript on websites. (Pages might break!)
disable_csp=None, # Disable the Content Security Policy of websites.
enable_ws=None, # Enable Web Security on Chromium-based browsers.
disable_ws=None, # Reverse of "enable_ws". (None and False are different)
enable_sync=None, # Enable "Chrome Sync" on websites.
use_auto_ext=None, # Use Chrome's automation extension.
undetectable=None, # Use undetected-chromedriver to evade bot-detection.
uc_cdp_events=None, # Capture CDP events in undetected-chromedriver mode.
uc_subprocess=None, # Use undetected-chromedriver as a subprocess.
log_cdp_events=None, # Capture {"performance": "ALL", "browser": "ALL"}
no_sandbox=None, # (DEPRECATED) - "--no-sandbox" is always used now.
disable_gpu=None, # (DEPRECATED) - GPU is disabled if not "swiftshader".
incognito=None, # Enable Chromium's Incognito mode.
guest_mode=None, # Enable Chromium's Guest mode.
dark_mode=None, # Enable Chromium's Dark mode.
devtools=None, # Open Chromium's DevTools when the browser opens.
remote_debug=None, # Enable Chrome's Debugger on "http://localhost:9222".
enable_3d_apis=None, # Enable WebGL and 3D APIs.
swiftshader=None, # Chrome: --use-gl=angle / --use-angle=swiftshader-webgl
ad_block_on=None, # Block some types of display ads from loading.
host_resolver_rules=None, # Set host-resolver-rules, comma-separated.
block_images=None, # Block images from loading during tests.
do_not_track=None, # Tell websites that you don't want to be tracked.
chromium_arg=None, # "ARG=N,ARG2" (Set Chromium args, ","-separated.)
firefox_arg=None, # "ARG=N,ARG2" (Set Firefox args, comma-separated.)
firefox_pref=None, # SET (Set Firefox PREFERENCE:VALUE set, ","-separated)
user_data_dir=None, # Set the Chrome user data directory to use.
extension_zip=None, # Load a Chrome Extension .zip|.crx, comma-separated.
extension_dir=None, # Load a Chrome Extension directory, comma-separated.
disable_features=None, # "F1,F2" (Disable Chrome features, ","-separated.)
binary_location=None, # Set path of the Chromium browser binary to use.
driver_version=None, # Set the chromedriver or uc_driver version to use.
page_load_strategy=None, # Set Chrome PLS to "normal", "eager", or "none".
external_pdf=None, # Set Chrome "plugins.always_open_pdf_externally":True.
window_position=None, # Set the browser's starting window position: "X,Y"
window_size=None, # Set the browser's starting window size: "Width,Height"
is_mobile=None, # Use the mobile device emulator while running tests.
mobile=None, # Shortcut / Duplicate of "is_mobile".
d_width=None, # Set device width
d_height=None, # Set device height
d_p_r=None, # Set device pixel ratio
position=None, # Shortcut / Duplicate of "window_position".
size=None, # Shortcut / Duplicate of "window_size".
uc=None, # Shortcut / Duplicate of "undetectable".
undetected=None, # Shortcut / Duplicate of "undetectable".
uc_cdp=None, # Shortcut / Duplicate of "uc_cdp_events".
uc_sub=None, # Shortcut / Duplicate of "uc_subprocess".
locale=None, # Shortcut / Duplicate of "locale_code".
log_cdp=None, # Shortcut / Duplicate of "log_cdp_events".
ad_block=None, # Shortcut / Duplicate of "ad_block_on".
server=None, # Shortcut / Duplicate of "servername".
guest=None, # Shortcut / Duplicate of "guest_mode".
pls=None, # Shortcut / Duplicate of "page_load_strategy".
cft=None, # Use "Chrome for Testing"
chs=None, # Use "Chrome-Headless-Shell"
use_chromium=None, # Use base "Chromium"
)
| 65 | |
| 66 | |
| 67 | def Driver( |
| 68 | browser=None, # Choose from "chrome", "edge", "firefox", or "safari". |
| 69 | headless=None, # Use the default headless mode for Chromium and Firefox. |
| 70 | headless1=None, # Use Chromium's old headless mode. (Fast, but limited) |
| 71 | headless2=None, # Use Chromium's new headless mode. (Has more features) |
| 72 | headed=None, # Run tests in headed/GUI mode on Linux, where not default. |
| 73 | locale_code=None, # Set the Language Locale Code for the web browser. |
| 74 | protocol=None, # The Selenium Grid protocol: "http" or "https". |
| 75 | servername=None, # The Selenium Grid server/IP used for tests. |
| 76 | port=None, # The Selenium Grid port used by the test server. |
| 77 | proxy=None, # Use proxy. Format: "SERVER:PORT" or "USER:PASS@SERVER:PORT". |
| 78 | proxy_bypass_list=None, # Skip proxy when using the listed domains. |
| 79 | proxy_pac_url=None, # Use PAC file. (Format: URL or USERNAME:PASSWORD@URL) |
| 80 | multi_proxy=None, # Allow multiple proxies with auth when multi-threaded. |
| 81 | agent=None, # Modify the web browser's User-Agent string. |
| 82 | cap_file=None, # The desired capabilities to use with a Selenium Grid. |
| 83 | cap_string=None, # The desired capabilities to use with a Selenium Grid. |
| 84 | recorder_ext=None, # Enables the SeleniumBase Recorder Chromium extension. |
| 85 | disable_cookies=None, # Disable Cookies on websites. (Pages might break!) |
| 86 | disable_js=None, # Disable JavaScript on websites. (Pages might break!) |
| 87 | disable_csp=None, # Disable the Content Security Policy of websites. |
| 88 | enable_ws=None, # Enable Web Security on Chromium-based browsers. |
| 89 | disable_ws=None, # Reverse of "enable_ws". (None and False are different) |
| 90 | enable_sync=None, # Enable "Chrome Sync" on websites. |
| 91 | use_auto_ext=None, # Use Chrome's automation extension. |
| 92 | undetectable=None, # Use undetected-chromedriver to evade bot-detection. |
| 93 | uc_cdp_events=None, # Capture CDP events in undetected-chromedriver mode. |
| 94 | uc_subprocess=None, # Use undetected-chromedriver as a subprocess. |
| 95 | log_cdp_events=None, # Capture {"performance": "ALL", "browser": "ALL"} |
| 96 | no_sandbox=None, # (DEPRECATED) - "--no-sandbox" is always used now. |
| 97 | disable_gpu=None, # (DEPRECATED) - GPU is disabled if not "swiftshader". |
| 98 | incognito=None, # Enable Chromium's Incognito mode. |
| 99 | guest_mode=None, # Enable Chromium's Guest mode. |
| 100 | dark_mode=None, # Enable Chromium's Dark mode. |
| 101 | devtools=None, # Open Chromium's DevTools when the browser opens. |
| 102 | remote_debug=None, # Enable Chrome's Debugger on "http://localhost:9222". |
| 103 | enable_3d_apis=None, # Enable WebGL and 3D APIs. |
| 104 | swiftshader=None, # Chrome: --use-gl=angle / --use-angle=swiftshader-webgl |
| 105 | ad_block_on=None, # Block some types of display ads from loading. |
| 106 | host_resolver_rules=None, # Set host-resolver-rules, comma-separated. |
| 107 | block_images=None, # Block images from loading during tests. |
| 108 | do_not_track=None, # Tell websites that you don't want to be tracked. |
| 109 | chromium_arg=None, # "ARG=N,ARG2" (Set Chromium args, ","-separated.) |
| 110 | firefox_arg=None, # "ARG=N,ARG2" (Set Firefox args, comma-separated.) |
| 111 | firefox_pref=None, # SET (Set Firefox PREFERENCE:VALUE set, ","-separated) |
| 112 | user_data_dir=None, # Set the Chrome user data directory to use. |
| 113 | extension_zip=None, # Load a Chrome Extension .zip|.crx, comma-separated. |
| 114 | extension_dir=None, # Load a Chrome Extension directory, comma-separated. |
| 115 | disable_features=None, # "F1,F2" (Disable Chrome features, ","-separated.) |
| 116 | binary_location=None, # Set path of the Chromium browser binary to use. |
| 117 | driver_version=None, # Set the chromedriver or uc_driver version to use. |
| 118 | page_load_strategy=None, # Set Chrome PLS to "normal", "eager", or "none". |
| 119 | external_pdf=None, # Set Chrome "plugins.always_open_pdf_externally":True. |
| 120 | window_position=None, # Set the browser's starting window position: "X,Y" |
| 121 | window_size=None, # Set the browser's starting window size: "Width,Height" |
| 122 | is_mobile=None, # Use the mobile device emulator while running tests. |
| 123 | mobile=None, # Shortcut / Duplicate of "is_mobile". |
| 124 | d_width=None, # Set device width |
no test coverage detected
searching dependent graphs…