Skip to content

Is it possible to extract any Header value from the Network panel on google chrome developer tools with selenium?

I want to access the value of one of the Headers under the Network panel on google chrome developer tools with selenium.

I’m able to navigate and access the json for Networks panel using ChromeOptions in Selenium. But i also need to extract a value of any of the Headers for any Name. For ex. I manually navigated to, press F12, click on any name from the left column and for that particular name, in the right hand side, i need to access the “Request URL” under Headers section.

Using the below code, i’m able to access the Networks panel:

ChromeOptions options = new ChromeOptions();
WebDriver driver = new ChromeDriver(options);[enter image description here][1]
String scriptToExecute = "var performance = window.performance || window.mozPerformance || window.msPerformance || window.webkitPerformance || {}; var network = performance.getEntries() || {}; return network;";
String netData = ((JavascriptExecutor)driver).executeScript(scriptToExecute).toString();

Is it possible through Selenium or also through any Java program?


you need to use LogType.performance to get that. It will contain a lot of info and you can filter accordingly.

public class travelComps {
    static ChromeDriver driver;

    public static void main(String[] args) {

        ChromeOptions cop = new ChromeOptions();

        LoggingPreferences loggingprefs = new LoggingPreferences();
        loggingprefs.enable(LogType.BROWSER, Level.ALL);
        loggingprefs.enable(LogType.CLIENT, Level.ALL);
        loggingprefs.enable(LogType.PERFORMANCE, Level.ALL);
        loggingprefs.enable(LogType.PROFILER, Level.ALL);

        DesiredCapabilities capabilities =;
        capabilities.setCapability(CapabilityType.LOGGING_PREFS, loggingprefs);
        cop.setCapability("goog:loggingPrefs", loggingprefs);

        driver = new ChromeDriver(cop);




    private static void logBrowserConsoleLogs() {



    public static void all(String logTypes) {
        System.out.println("================== " + logTypes + "  LOGS =======================");

        List<LogEntry> logEntries = driver.manage().logs().get(logTypes).getAll();
        for (LogEntry entry : logEntries) {
            System.out.println(new Date(entry.getTimestamp()) + " " + entry.getLevel() + " " + entry.getMessage());