seleniumbase / SeleniumBase

📊 Python's all-in-one framework for web crawling, scraping, testing, and reporting. Supports pytest. UC Mode provides stealth. Includes many tools.
https://seleniumbase.io
MIT License
4.46k stars 909 forks source link

Add argument to Chromium with Driver class #2756

Closed FRIKIdelTO closed 1 month ago

FRIKIdelTO commented 1 month ago

I am using Driver class from seleniumbase on Raspberry pi OS Bookworm 64bit with X11 backend and I am having problems with Chromium acceleration. How can I add the "--disable-gpu" argument when instantiating like this:

from seleniumbase import Driver
driver = Driver(uc=True)

As far as I see, this argument is not used by default:

>>> driver.options.arguments
['--window-size=1440,1880', '--no-sandbox', '--disable-dev-shm-usage', '--disable-application-cache', '--disable-setuid-sandbox', '--disable-browser-side-navigation', '--disable-save-password-bubble', '--disable-single-click-autofill', '--allow-file-access-from-files', '--disable-prompt-on-repost', '--dns-prefetch-disable', '--disable-translate', '--disable-renderer-backgrounding', '--disable-backgrounding-occluded-windows', '--disable-client-side-phishing-detection', '--disable-oopr-debug-crash-dump', '--disable-top-sites', '--ash-no-nudges', '--no-crash-upload', '--deny-permission-prompts', '--disable-features=OptimizationHintsFetching,Translate,OptimizationTargetPrediction,DownloadBubble,DownloadBubbleV2,InsecureDownloadWarnings', '--disable-popup-blocking', '--homepage=chrome://new-tab-page/', '--headless=new', '--remote-debugging-host=127.0.0.1', '--remote-debugging-port=9222', '--user-data-dir=/tmp/tmpemr44m_f', '--lang=es-ES', '--no-default-browser-check', '--no-first-run', '--no-service-autorun', '--password-store=basic', '--log-level=0']
mdmintz commented 1 month ago

Setting --disable-gpu can make UC Mode detectable. If you still want to set it, you can pass it into chromium_arg. Eg: Driver(uc=True, chromium_arg="--disable-gpu") chromium_arg takes a comma-separated list, no spaces.