[Python] Selenium python webdriver : how to remove the message "DevTools listening..."

Discussão em 'Python' iniciado por Stack, Maio 16, 2025.

  1. Stack

    Stack Membro Participativo

    My setup: Python 3.11 Code looks like:

    chrome_options = webdriver.ChromeOptions()
    chrome_options.add_argument("-incognito")
    chrome_options.add_argument("disable-infobars"); # disabling infobars
    chrome_options.add_argument("--disable-extensions"); # disabling extensions
    chrome_options.add_argument("--disable-gpu"); # applicable to windows os only
    chrome_options.add_argument("--disable-dev-shm-usage"); # overcome limited resource problems
    chrome_options.add_argument("--no-sandbox"); # Bypass OS security model
    chrome_options.add_argument(f"--headless={headless_option}")
    chrome_options.add_argument("--disable-logging")
    chrome_options.add_argument("--disable-crash-reporter")
    chrome_options.add_argument("--disable-in-process-stack-traces")

    service = Service(executable_path=executable_path)
    driver = webdriver.Chrome(service=service, options=chrome_options)
    url = r'https://www.google.com'
    driver.get(url)
    driver.quit()


    I tried lot of config/options and nothing works. SO I decided to explore the code and we can see in the file :site-packages\selenium\webdriver\common\service.py

    self.process = subprocess.Popen(
    cmd,
    env=self.env,
    close_fds=close_file_descriptors,
    stdout=cast(typing.Optional[typing.Union[int, typing.IO[typing.Any]]], self.log_output),
    stderr=cast(typing.Optional[typing.Union[int, typing.IO[typing.Any]]], self.log_output),
    stdin=PIPE,
    creationflags=self.creation_flags,
    startupinfo=start_info,
    **self.popen_kw,
    )


    We can understand that it comes from creationflags.

    Continue reading...

Compartilhe esta Página