Skip to content

[🐛 Bug]: Java. CDP failed to deserialize params for TargetFilter #13184

@vlad8x8

Description

@vlad8x8

What happened?

Chrome Devtools failed to deserialize params for TargetFilter if it's not Optional.empty()

I tried:
new FilterEntry(empty(), Optional.of("page"))
new FilterEntry(Optional.of(true), Optional.of("page")
new FilterEntry(Optional.of(false), Optional.of("page")

How can we reproduce the issue?

package org.example;

import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.devtools.v119.target.Target;
import org.openqa.selenium.devtools.v119.target.model.FilterEntry;
import org.openqa.selenium.devtools.v119.target.model.TargetFilter;

import java.util.ArrayList;
import java.util.List;
import java.util.Optional;

public class Main {
    public static void main(String[] args) {
        List<FilterEntry> list = new ArrayList<>();
        list.add(new FilterEntry(Optional.of(true), Optional.of("page")));
        TargetFilter filter = new TargetFilter(list);
        new ChromeDriver().getDevTools().send(Target.getTargets(Optional.of(filter)));
    }
}

Relevant log output

Exception in thread "main" org.openqa.selenium.devtools.DevToolsException: {"id":1,"error":{"code":-32602,"message":"Invalid parameters","data":"Failed to deserialize params.filter - CBOR: array start expected at position 22"}}
Build info: version: '4.16.0-SNAPSHOT', revision: 'b9ef666'
System info: os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.21'
Driver info: driver.version: unknown
	at org.openqa.selenium.devtools.Connection.sendAndWait(Connection.java:193)
	at org.openqa.selenium.devtools.DevTools.send(DevTools.java:89)
	at org.example.Main.main(Main.java:17)
Caused by: org.openqa.selenium.WebDriverException: {"id":1,"error":{"code":-32602,"message":"Invalid parameters","data":"Failed to deserialize params.filter - CBOR: array start expected at position 22"}}
Build info: version: '4.16.0-SNAPSHOT', revision: 'b9ef666'
System info: os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.21'
Driver info: driver.version: unknown
	at org.openqa.selenium.devtools.Connection.handle(Connection.java:272)
	at org.openqa.selenium.devtools.Connection$Listener.lambda$onText$0(Connection.java:236)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)

Operating System

Windows 10

Selenium version

Java 4.16 Night build

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

Chrome 119

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

se:cdpVersion -> 119.0.6045.160

Are you using Selenium Grid?

no

Metadata

Metadata

Assignees

No one assigned

    Labels

    B-devtoolsIncludes everything BiDi or Chrome DevTools relatedC-javaJava BindingsI-defectSomething is not working as intendedR-help wantedIssues looking for contributions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions