Skip to content

Running on RPi #1

@ahnyerkeester

Description

@ahnyerkeester

LOVE this script! Just what I was looking for. On an RPi 4 running Bookworm, I ran into a problem with Selenium and ChromeDriver setup. The problem is that webdriver-manager does not provide compatible ARM64 ChromeDriver binaries.

Here is how I got it to work.

Before I started your installation instructions, I did:

sudo apt install chromium-browser -y
sudo apt install chromium-driver -y

Then I followed your setup instructions but stopped at Configuration.

cp freedom_settings.remote.example.json ~/.freedom_settings.json worked fine but I had to change part of trigger_freedom_session.py to get it to work with the RPi binaries. I replaced:

else:
    logger.info("Using local ChromeDriver")
    try:
        driver = webdriver.Chrome(options=options)
        logger.info("Used Selenium's built-in driver manager")
    except Exception as local_error:
        logger.warning(f"Selenium's built-in manager failed: {local_error}")
        try:
            from webdriver_manager.chrome import ChromeDriverManager
            service = Service(ChromeDriverManager().install())
            driver = webdriver.Chrome(service=service, options=options)
            logger.info("Used webdriver-manager fallback")
        except Exception as wdm_error:
            logger.warning(f"webdriver-manager failed: {wdm_error}")
            try:
                service = Service()
                driver = webdriver.Chrome(service=service, options=options)
                logger.info("Used system ChromeDriver")
            except Exception as path_error:
                logger.error(f"All local ChromeDriver attempts failed. Final error: {path_error}")
                raise

with

else:
    logger.info("Using system ChromeDriver at /usr/bin/chromedriver")
    try:
        service = Service("/usr/bin/chromedriver")
        driver = webdriver.Chrome(service=service, options=options)
        logger.info("System ChromeDriver initialized successfully")
    except Exception as e:
        logger.error(f"Failed to initialize system ChromeDriver: {e}")
        raise

My change is pretty brute force but I'm sure you can incorporate it more elegantly into your existing section.

After these changes, the rest worked fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions