How to optimize start time of new FirefoxDriver(firefoxOptions) – java – selenium

My Firefox driver takes around 4 seconds to start each time i run test. Is it possible to create singleton FirefoxDriver and change its firefoxOptions in runtime ?


public WebDriver getWebdriver() {

    FirefoxOptions firefoxOptions = getModifiedFirefoxOptions();
    log.error("fnal opt start");
    FirefoxDriver firefoxDriver =  new FirefoxDriver(firefoxOptions);
    log.error("fnal opt end"); // taking minimum 4 seconds each time
    return firefoxDriver;

Is it possibel to do something like

firefoxDriver.setOptions(firefoxOptions) // to save this 4 seconds

I checked but there is not set option in firefoxDriver

Selenium version : 3.14.0

Java - 8

Read more here:

Content Attribution

This content was originally published by Jeya Kumar at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: