[Python] Read stdout and stderr logs from selenium controlled chrome browser

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

  1. Stack

    Stack Membro Participativo

    I made some minor modifications to the Chromium browser and built a custom version that does some logging on stderr. I would like to control this browser with Selenium (Python version) and read these stderr logs.

    The following is a minimal example of what I am doing:

    from selenium import webdriver
    from selenium.webdriver.chrome.options import Options
    import os.path

    options = Options()
    options.binary_location = '/home/phani/chromium/src/out/Default/chrome'
    options.add_argument('--user-data-dir=/tmp/')
    driver = webdriver.Chrome(executable_path=os.path.abspath("chromedriver"), chrome_options=options)
    driver.get('http://www.facebook.com')


    Can someone tell me how I can read the logs produced by the Chromium browser? For Firefox, there is an argument called "log_file" which allows us to direct output from the browser to stdout/stderr if we prefer. https://seleniumhq.github.io/seleni...ule-selenium.webdriver.firefox.firefox_binary

    Is there something similar for Chromium?

    Continue reading...

Compartilhe esta Página