selenium icon indicating copy to clipboard operation
selenium copied to clipboard

[🚀 Feature]: allow MAX_WS_MESSAGE_SIZE to be configurable

Open wizardstein opened this issue 2 months ago • 2 comments

Description

The problem trying to solve: Right now we can do this:

log_entries = []

driver.script.add_console_message_handler(log_entries.append)

And seems to work for several logs, but not all. We have some bigger logs (300kb+) and they do not show up in our code

I checked and I suspect the functionality, working through web sockets, is limited somewhere, maybe via MAX_WS_MESSAGE_SIZE, which is why it would be great if we could increase this limit via an environment variable

Have you considered any alternatives or workarounds?

No response

wizardstein avatar Nov 03 '25 12:11 wizardstein

@wizardstein, thank you for creating this issue. We will troubleshoot it as soon as we can.

Selenium Triage Team: remember to follow the Triage Guide

selenium-ci avatar Nov 03 '25 12:11 selenium-ci

It's pretty awkward, but I think you can do this now:

from selenium import webdriver
from selenium.webdriver.remote import webdriver as wd

options = webdriver.ChromeOptions()
options.enable_bidi = True
wd.import_cdp()
wd.cdp.MAX_WS_MESSAGE_SIZE = 2**32
driver = webdriver.Chrome(options=options)

... now any WebSocket connections made by driver will use max_message_size of 2**32 instead of the default 2**24.

We could possibly make this easier by adding an attribute to the ClientConfig class along with the other WebSocket configuration settings.

cgoldberg avatar Dec 04 '25 00:12 cgoldberg