[Python] Nobara ( Fedora ) Linux with Python issues when using Selenium and ChromeDriver

Discussão em 'Python' iniciado por Stack, Fevereiro 27, 2025.

  1. Stack

    Stack Membro Participativo

    The Specs: Intellidea using Python on Nobara Linux ( Fedora based 41) Flatpak method.

    The problem:

    I have been trying to make an script to check some files on a social media website. I started using Firefox, so far so good. Until it started to give me problem with errors when trying to check logs( My goals is checking the NETWORK logs as they contain a file I want to display, instead of a protected blob url). Turns out the logging method in Firefox sucks and either crashes or gives empty data.

    So I decided to use Chrome. Problem? I have tried to run every single implementation of Chrome using Chromedriver, Selenium's own and other variants and I always keep getting the same issue about profiles.

    The fragment of code:

    from selenium.webdriver.common.by import By
    from selenium import webdriver
    from selenium.webdriver.chrome.service import Service


    import logging

    #options = Options()
    options = webdriver.ChromeOptions()
    service = Service()
    options.set_capability(
    "goog:loggingPrefs", {"performance": "ALL", "browser": "ALL"}
    )
    options.log_path='/home/cesarin/IdeaProjects/Seleniumtest1/geckodriver_log_path.log'
    options.add_argument("--enable-logging --v=1")
    options.add_argument("--start-maximized")
    options.add_argument("--log-level=3")
    #options.add_argument("--user-data-dir=/home/cesarin/.config/google-chrome-back/")
    #options.add_argument("----profile-directory=Profile 3")
    #options.add_argument(log.level)
    options.add_argument("--path=/home/cesarin/IdeaProjects/Seleniumtest1/chrome-linux64/")

    driver = webdriver.Chrome(service=service, options=options)
    log_entries = driver.get_log("performance")


    The error: This is the error that It keeps spitting.

    selenium.common.exceptions.SessionNotCreatedException: Message: session not created: probably user data directory is already in use, please specify a unique value for --user-data-dir argument, or don't use --user-data-dir


    Other things and attempts to go around: So far I tried to make sure that no copies of Chrome were running in the background. Also tried to make a copy of the profiles folder. I also tried to make a new profile using Chrome itself. tried to use multiple profiles as well, nope.

    I tried even running the standalone executable of chrome downloaded from the chromedriver section of Google's development page. No go, same issue.

    I also wonder if there is a conflict either with the Flatpak method of installation of Intellidea OR with Brave which is installed along with Chrome on my system.

    Expectations: Chrome to open itself correctly and follow my selenium behavior in the same way that it did successful ran on Firefox (until the logging part).

    Continue reading...

Compartilhe esta Página