Skip to content

Options (Surfmeter Selenium for Java)

If you like, you can also setup some further options for the measurement, e.g.:

import com.aveq.selenium.SurfmeterVideoTestOptions;
import com.aveq.SurfmeterVideoPageMonitor;

class MyTest {

   // ...
   public void setup() {
      // ...

      new SurfmeterVideoTest.Builder()
              // ...
              .options(new SurfmeterVideoTestOptions() {{
                 /*
                  * For tests with Safari, Surfmeter has to wait until the page is at least interactive before a script can be injected.
                  *  This method enables the developer to set the number of seconds to wait until the page is interactive. Set it null if you want to skip this wait option.
                  */
                 setPageInteractiveWaitTimeoutInSeconds(30); // 30s by default, allows null, only non-negative

                 /*
                  * This is the time we will wait always before we try to interact the first time with the window.top.surfmeter object
                  *  In general this is set to a generous 30s, in practice the whole operation runs in a few milliseconds. Use this option
                  *  if you want to change the timeout for some reason.
                  */
                 setSurfmeterInitializationWaitTimeoutInSeconds(30); // 30s by default, only non-negative

                 /*
                  * In order to allow working with callbacks, the Surfmeter Selenium for Java for Java library creates a WebSocket that connects
                  *  with the given WebDriver instance. By default this is 8887. If you want to use another port number, as e.g. you
                  *  already have another socket running on this number, feel free to change it.
                  */
                 setSurfmeterWebSocketPort(8887); // 8887 by default, only non-negative

                 /*
                  * In general statistics can be calculated at the end of a full playback or whenever anything crucial changes.
                  *  To get statistics earlier and in more regular intervals, the playback is split into a segment of x seconds when
                  *  new statistics are computed. By default, we compute every 5s. Feel free to change this number if you want to have
                  *  them more or less regularly.
                  */
                 setStatisticsCalculationIntervalInSeconds(5); // 5s by default, only non-negative
              }});

      // ...
   }

   // ...
}