Skip to content

Best Practices

Useful Chrome Options

We recommend to launch the driver with the following start arguments:

import org.openqa.selenium.PageLoadStrategy;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;


class MyTest {

    // ...
    public void setup() {
        // setup chrome driver with PageLoadStrategy.NONE
        ChromeOptions options = new ChromeOptions();
        options.setPageLoadStrategy(PageLoadStrategy.NONE);

        options.addArguments(
            "--mute-audio", // mute audio, just relevant if you don't want to always listen to BigBuckBunny sounds while you are debugging
            "--autoplay-policy=no-user-gesture-required" // for enabling pages to immediately start with the autoplay if available without further user interaction (i.e. no simulation of play button clicks or other stuff like that)
        );

        WebDriver driver = new ChromeDriver(options);

        // ...
    }

    // ...
}

Set PageLoadStrategy to NONE

For exact video test results the page load preference has to be set to PageLoadStrategy.NONE. Using any other page load strategy than NONE might distort your gathered video quality results. As we know that for complex test scenarios it can be difficult to work with NONE as page load strategy, Surfmeter will just log a warning for now and continue working. But have in mind, the results may be not 100% correct, especially when analyzing video load times.

import org.openqa.selenium.PageLoadStrategy;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;


class MyTest {

    // ...
    public void setup() {
        // setup chrome driver with PageLoadStrategy.NONE
        ChromeOptions options = new ChromeOptions();
        options.setPageLoadStrategy(PageLoadStrategy.NONE);

        WebDriver driver = new ChromeDriver(options);

        // ...
    }

    // ...
}