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]: JSON decoding fails on '=' #11341

Closed
Davincible opened this issue Dec 1, 2022 · 4 comments · Fixed by #11367
Closed

[🐛 Bug]: JSON decoding fails on '=' #11341

Davincible opened this issue Dec 1, 2022 · 4 comments · Fixed by #11367

Comments

@Davincible
Copy link

Davincible commented Dec 1, 2022

What happened?

JSON decoding fails if an '=' is added with a "string untermindated" error. I'm guessing this has something todo with the unicode escaping.

How can we reproduce the issue?

Fails:

java -jar selenium-server-4.6.0.jar standalone --port 50859 --detect-drivers false --driver-configuration display-name="Chrome Custom" stereotype='{"browserName":"chrome","goog:chromeOptions":{"args":["--user-data-dir=\"./data\""]},"pageLoadStrategy":"normal"}' webdriver-executable=driver/driver_xyz

Works:

java -jar selenium-server-4.6.0.jar standalone --port 50859 --detect-drivers false --driver-configuration display-name="Chrome Custom" stereotype='{"browserName":"chrome","goog:chromeOptions":{"args":["--user-data-dir \"./data\""]},"pageLoadStrategy":"normal"}' webdriver-executable=driver/driver_xyz

Relevant log output

java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.openqa.selenium.grid.Bootstrap.runMain(Bootstrap.java:77)
        at org.openqa.selenium.grid.Bootstrap.main(Bootstrap.java:70)
Caused by: org.openqa.selenium.grid.config.ConfigException: java.lang.reflect.InvocationTargetException
        at org.openqa.selenium.grid.config.MemoizedConfig.getClass(MemoizedConfig.java:115)
        at org.openqa.selenium.grid.node.config.NodeOptions.getNode(NodeOptions.java:152)
        at org.openqa.selenium.grid.commands.Standalone.createHandlers(Standalone.java:206)
        at org.openqa.selenium.grid.TemplateGridServerCommand.asServer(TemplateGridServerCommand.java:41)
        at org.openqa.selenium.grid.commands.Standalone.execute(Standalone.java:245)
        at org.openqa.selenium.grid.TemplateGridCommand.lambda$configure$4(TemplateGridCommand.java:129)
        at org.openqa.selenium.grid.Main.launch(Main.java:83)
        at org.openqa.selenium.grid.Main.go(Main.java:57)
        at org.openqa.selenium.grid.Main.main(Main.java:42)
        ... 6 more
Caused by: java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.openqa.selenium.grid.config.ClassCreation.callCreateMethod(ClassCreation.java:50)
        at org.openqa.selenium.grid.config.MemoizedConfig.lambda$getClass$4(MemoizedConfig.java:100)
        at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1737)
        at org.openqa.selenium.grid.config.MemoizedConfig.getClass(MemoizedConfig.java:95)
        ... 14 more
Caused by: org.openqa.selenium.json.JsonException: Unable to parse: {"browserName":"chrome","goog:chromeOptions":{"args":["--user-data-dir
        at org.openqa.selenium.json.Json.toType(Json.java:57)
        at org.openqa.selenium.json.Json.toType(Json.java:50)
        at org.openqa.selenium.grid.node.config.NodeOptions.lambda$addDriverConfigs$15(NodeOptions.java:369)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
        at org.openqa.selenium.grid.node.config.NodeOptions.lambda$addDriverConfigs$16(NodeOptions.java:364)
        at java.base/java.util.Optional.ifPresent(Optional.java:183)
        at org.openqa.selenium.grid.node.config.NodeOptions.addDriverConfigs(NodeOptions.java:318)
        at org.openqa.selenium.grid.node.config.NodeOptions.getSessionFactories(NodeOptions.java:211)
        at org.openqa.selenium.grid.node.local.LocalNodeFactory.create(LocalNodeFactory.java:80)
        ... 22 more
Caused by: org.openqa.selenium.json.JsonException: Unterminated string: --user-data-dir. Last 70 characters read: {"browserName":"chrome","goog:chromeOptions":{"args":["--user-data-dir
Build info: version: '4.6.0', revision: '79f1c02ae20'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '6.0.6-1-MANJARO', java.version: '11.0.17'
Driver info: driver.version: unknown
        at org.openqa.selenium.json.JsonInput.readString(JsonInput.java:359)
        at org.openqa.selenium.json.JsonInput.nextString(JsonInput.java:187)
        at org.openqa.selenium.json.StringCoercer.lambda$apply$0(StringCoercer.java:44)
        at org.openqa.selenium.json.JsonTypeCoercer.lambda$buildCoercer$6(JsonTypeCoercer.java:145)
        at org.openqa.selenium.json.JsonTypeCoercer.coerce(JsonTypeCoercer.java:127)
        at org.openqa.selenium.json.ObjectCoercer.lambda$apply$0(ObjectCoercer.java:72)
        at org.openqa.selenium.json.JsonTypeCoercer.lambda$buildCoercer$6(JsonTypeCoercer.java:145)
        at org.openqa.selenium.json.JsonTypeCoercer.coerce(JsonTypeCoercer.java:127)
        at org.openqa.selenium.json.CollectionCoercer.lambda$apply$0(CollectionCoercer.java:64)
        at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
        at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
        at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
        at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
        at org.openqa.selenium.json.CollectionCoercer.lambda$apply$1(CollectionCoercer.java:65)
        at org.openqa.selenium.json.JsonTypeCoercer.lambda$buildCoercer$6(JsonTypeCoercer.java:145)
        at org.openqa.selenium.json.JsonTypeCoercer.coerce(JsonTypeCoercer.java:127)
        at org.openqa.selenium.json.ObjectCoercer.lambda$apply$0(ObjectCoercer.java:72)
        at org.openqa.selenium.json.JsonTypeCoercer.lambda$buildCoercer$6(JsonTypeCoercer.java:145)
        at org.openqa.selenium.json.JsonTypeCoercer.coerce(JsonTypeCoercer.java:127)
        at org.openqa.selenium.json.MapCoercer.lambda$apply$0(MapCoercer.java:68)
        at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
        at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
        at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
        at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
        at org.openqa.selenium.json.MapCoercer.lambda$apply$1(MapCoercer.java:72)
        at org.openqa.selenium.json.JsonTypeCoercer.lambda$buildCoercer$6(JsonTypeCoercer.java:145)
        at org.openqa.selenium.json.JsonTypeCoercer.coerce(JsonTypeCoercer.java:127)
        at org.openqa.selenium.json.ObjectCoercer.lambda$apply$0(ObjectCoercer.java:72)
        at org.openqa.selenium.json.JsonTypeCoercer.lambda$buildCoercer$6(JsonTypeCoercer.java:145)
        at org.openqa.selenium.json.JsonTypeCoercer.coerce(JsonTypeCoercer.java:127)
        at org.openqa.selenium.json.MapCoercer.lambda$apply$0(MapCoercer.java:68)
        at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
        at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
        at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
        at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
        at org.openqa.selenium.json.MapCoercer.lambda$apply$1(MapCoercer.java:72)
        at org.openqa.selenium.json.JsonTypeCoercer.lambda$buildCoercer$6(JsonTypeCoercer.java:145)
        at org.openqa.selenium.json.JsonTypeCoercer.coerce(JsonTypeCoercer.java:127)
        at org.openqa.selenium.json.Json.toType(Json.java:71)
        at org.openqa.selenium.json.Json.toType(Json.java:55)
        ... 30 more

Operating System

Linux 6.0.6-1-MANJARO

Selenium version

Java 4.6.0

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

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

Are you using Selenium Grid?

4.6.0

@github-actions
Copy link

github-actions bot commented Dec 1, 2022

@Davincible, 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!

@pujagani
Copy link
Contributor

pujagani commented Dec 2, 2022

Thank you for providing the details. I was able to reproduce it and fix it locally. Though I think I found another bug, now that the Grid starts as expected, I don't see the argument values being respected for a new session. I want to first confirm and see how we do it in code and what is expected.

@pujagani
Copy link
Contributor

pujagani commented Dec 5, 2022

Will be triaging the bug discovered as part of this in another issue/PR fix.

@github-actions
Copy link

github-actions bot commented Jan 5, 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 Jan 5, 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.

4 participants