Selenium 4 alpha has a way to interact with the DevTools API using the java client. In particular, you are looking for the Profiler domain ( https://chromedevtools.imtqy.com/devtools-protocol/tot/Profiler ).
I recently provided the Network and Performance domains for the best user API in Java Selenium - https://github.com/SeleniumHQ/selenium/pull/7212.
I believe that Profiler will also be implemented soon. Of course, there is a universal API for all domains in the Java client, which was merged some time ago, you can use it as follows:
driver.getDevTools().createSession(); driver.getDevTools().send(new Command("Profiler.enable", ImmutableMap.of())); driver.getDevTools().send(new Command("Profiler.start", ImmutableMap.of())); //register to profiler events driver.getDevTools().addListener(new Event("Profiler.consoleProfileStarted", ConsoleProfileStarted.class), new Consumer<Object>() { @Override public void accept(Object o) { //do something } });
Until the Profiler domain is added to the Selenium Java client, you will need to provide your Mapper.
source share