How to get Chrome Performance lighthouse data using Selenium

Viewed 2223

is there any java API to capture Chrome Performance Lighthouse data using selenium Java?

1 Answers

This is probably not your answer but you can try something like this;

For example this calculates Scroll performance of in browser;

public static String toLastElement(WebDriver driver, List<WebElement> webElementList) {
        JavascriptExecutor js = (JavascriptExecutor) driver;
        int y = webElementList.get(webElementList.size() - 1).getLocation().getY();
        return (String) js.executeScript("var start = performance.now(); " +
                            "window.scrollTo(0," + y + "); " +
                            "var end = performance.now(); " +
                            "return '' + (end - start) + '';");
    }

In summary you can use javascript to measure performance in Selenium Webdriver.

Related