public static WebDriver getFirefoxDriver(String pathToFirefoxExecutable) { String path = "src/test/resources/geckodriver"; System.setProperty("webdriver.gecko.driver", path); System.setProperty("webdriver.firefox.bin", pathToFirefoxExecutable); DesiredCapabilities capabilities = DesiredCapabilities.firefox(); capabilities.setCapability("marionette", true); capabilities.setCapability("networkConnectionEnabled", true); capabilities.setCapability("browserConnectionEnabled", true); WebDriver driver = new MarionetteDriver(capabilities); return driver; }