Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🐛 Bug]: Can't set chrome options due to JSON MAX_DEPTH #12201

Closed
idontusenumbers opened this issue Jun 14, 2023 · 7 comments · Fixed by #12205
Closed

[🐛 Bug]: Can't set chrome options due to JSON MAX_DEPTH #12201

idontusenumbers opened this issue Jun 14, 2023 · 7 comments · Fixed by #12205

Comments

@idontusenumbers
Copy link

What happened?

I can't set complex chrome webdriver options because org/openqa/selenium/json/JsonOutput.java specifies a MAX_DEPTH of 10.

This was working in 4.8.1.

How can we reproduce the issue?

ChromeOptions options = new ChromeOptions();
options.addArguments("--no-sandbox"); // has to be the very first option
options.addArguments("--disable-gpu");
options.addArguments("--disable-translate");
options.addArguments("--disable-plugins");
options.addArguments("--window-size=1920,1080");

options.setAcceptInsecureCerts(true);

Map<String, Object> prefs = new HashMap<>();
Map<String, Object> profile = new HashMap<>();
Map<String, Object> contentSettings = new HashMap<>();
Map<String, Object> exceptions = new HashMap<>();
Map<String, Object> clipboard = new HashMap<>();
Map<String, Object> domain = new HashMap<>();

// Enable clipboard permissions
domain.put("expiration", 0);
domain.put("last_modified", System.currentTimeMillis());
domain.put("model", 0);
domain.put("setting", 1);
clipboard.put(siteRoot + ",*", domain);
exceptions.put("clipboard", clipboard);
contentSettings.put("exceptions", exceptions);
profile.put("content_settings", contentSettings);
prefs.put("profile", profile);
options.setExperimentalOption("prefs", prefs);


log.debug("Connecting to selenium at " + webDriverURI);
RemoteWebDriver newDriver = new RemoteWebDriver(webDriverURI, options);
log.debug("Connected to selenium");


### Relevant log output

```shell
org.openqa.selenium.json.JsonException: Reached the maximum depth of 10 while writing JSON


### Operating System

macOS 13.4

### Selenium version

Java 4.10.0

### What are the browser(s) and version(s) where you see this issue?

standalone-chromium:113.0

### What are the browser driver(s) and version(s) where you see this issue?

standalone-chromium:113.0

### Are you using Selenium Grid?

_No response_
@github-actions
Copy link

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


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

@diemol
Copy link
Member

diemol commented Jun 14, 2023

@joerg1985 if you have time, could you please help us to have a look?

@idontusenumbers
Copy link
Author

What assistance can I provide?

@joerg1985
Copy link
Member

The object is more than 10 levels deep, but it seems to be a legit request.

So i would suggest to set a limit of 100 for the new NewSessionPayload?
@diemol if this is okay i would create a PR for the increased limit.

image

@idontusenumbers
Copy link
Author

idontusenumbers commented Jun 14, 2023

As a side note, this issue was pretty hard to diagnose because gradle kind of swallows the log for the exception and doesn't print anything until I add -i and

testLogging {
        showStandardStreams = true
    }

The effect is that the tests just never enumerate and the gradle process never exits, though it's probably largely related to how I'm loading webdrivers in my specific tests.

@diemol
Copy link
Member

diemol commented Jun 14, 2023

@joerg1985 yes, that would be great!

Also, I've sent you a message in Slack.

Copy link

github-actions bot commented Dec 9, 2023

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants