Skip to content

[🐛 Bug]: JsonException: Unable to find type coercer for class org.openqa.selenium.Cookie #13311

@baflQA

Description

@baflQA

What happened?

A JSON parse error is thrown when capturing the network with BiDi.

How can we reproduce the issue?

I've created a standalone test that can be used to reproduce this issue.
https://github.com/baflQA/selenium-debug/blob/main/src/test/java/seleniumdebug/BiDiPlaygroundTest.java
After running this test, in the console there will be many errors like:

Caused by: org.openqa.selenium.json.JsonException: Unable to find type coercer for class org.openqa.selenium.Cookie
Build info: version: '4.16.1', revision: '9b4c83354e'
System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '14.1.2', java.version: '17.0.9'
Driver info: driver.version: unknown
	at org.openqa.selenium.json.JsonTypeCoercer.lambda$buildCoercer$8(JsonTypeCoercer.java:173)
	at java.base/java.util.Optional.orElseThrow(Optional.java:403)
	at org.openqa.selenium.json.JsonTypeCoercer.buildCoercer(JsonTypeCoercer.java:173)
	at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1740)
	at org.openqa.selenium.json.JsonTypeCoercer.coerce(JsonTypeCoercer.java:142)
	at org.openqa.selenium.json.CollectionCoercer.lambda$apply$0(CollectionCoercer.java:63)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
	at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1845)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
	at org.openqa.selenium.json.CollectionCoercer.lambda$apply$1(CollectionCoercer.java:64)
	at org.openqa.selenium.json.JsonTypeCoercer.lambda$buildCoercer$6(JsonTypeCoercer.java:171)
	at org.openqa.selenium.json.JsonTypeCoercer.coerce(JsonTypeCoercer.java:146)
	at org.openqa.selenium.json.JsonInput.read(JsonInput.java:423)
	at org.openqa.selenium.bidi.network.RequestData.fromJson(RequestData.java:84)

present.
As a result, it won't be able to capture some of the requests.

Relevant log output

Caused by: org.openqa.selenium.json.JsonException: Unable to find type coercer for class org.openqa.selenium.Cookie
Build info: version: '4.16.1', revision: '9b4c83354e'
System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '14.1.2', java.version: '17.0.9'
Driver info: driver.version: unknown
	at org.openqa.selenium.json.JsonTypeCoercer.lambda$buildCoercer$8(JsonTypeCoercer.java:173)
	at java.base/java.util.Optional.orElseThrow(Optional.java:403)
	at org.openqa.selenium.json.JsonTypeCoercer.buildCoercer(JsonTypeCoercer.java:173)
	at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1740)
	at org.openqa.selenium.json.JsonTypeCoercer.coerce(JsonTypeCoercer.java:142)
	at org.openqa.selenium.json.CollectionCoercer.lambda$apply$0(CollectionCoercer.java:63)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
	at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1845)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
	at org.openqa.selenium.json.CollectionCoercer.lambda$apply$1(CollectionCoercer.java:64)
	at org.openqa.selenium.json.JsonTypeCoercer.lambda$buildCoercer$6(JsonTypeCoercer.java:171)
	at org.openqa.selenium.json.JsonTypeCoercer.coerce(JsonTypeCoercer.java:146)
	at org.openqa.selenium.json.JsonInput.read(JsonInput.java:423)
	at org.openqa.selenium.bidi.network.RequestData.fromJson(RequestData.java:84)

Operating System

macOS, Linux

Selenium version

4.16.1

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

Chrome 120

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

Chromedriver 120

Are you using Selenium Grid?

not relevant

Metadata

Metadata

Assignees

Labels

A-needs-triagingA Selenium member will evaluate this soon!B-devtoolsIncludes everything BiDi or Chrome DevTools relatedC-javaJava BindingsI-defectSomething is not working as intended

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions