[Python] How to use Selenium on headless Raspberry Pi

Discussão em 'Python' iniciado por Stack, Setembro 13, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to get Selenium (v. 4.35.0) working on my headless Raspberry Pi.

    I installed Chromium and Chromedriver on the Pi. In my usr/bin/ directory I have chromedriver, chromium, and chromium-browser.

    Here's the code I have tried:

    from selenium import webdriver

    driver = webdriver.Chrome()


    which throws NoSuchDriverException.

    from selenium import webdriver
    from selenium.webdriver.chrome.service import Service

    service = Service('/usr/bin/chromedriver')
    driver = webdriver.Chrome(service=service)


    which throws SessionNotCreatedException with the following stacktrace:

    #0 0x555629968e28 <unknown>
    #1 0x5556293ce524 <unknown>
    #2 0x5556294054cc <unknown>
    #3 0x555629400b00 <unknown>
    #4 0x555629442e24 <unknown>
    #5 0x5556294427a4 <unknown>
    #6 0x55562940bbd4 <unknown>
    #7 0x5556299351a4 <unknown>
    #8 0x55562993812c <unknown>
    #9 0x555629937d08 <unknown>
    #10 0x555629920030 <unknown>
    #11 0x5556299387a4 <unknown>
    #12 0x55562990a010 <unknown>
    #13 0x55562995686c <unknown>
    #14 0x555629956a78 <unknown>
    #15 0x555629967c08 <unknown>
    #16 0x7fff2f71202c <unknown>
    #17 0x7fff2f77bf58 <unknown>

    Continue reading...

Compartilhe esta Página