package org.jbehave.web.selenium;

import org.openqa.selenium.firefox.FirefoxDriver;

/**
 * Default factory that provides instances of {@link FirefoxDriver}s.
 */
public class DefaultWebDriverFactory extends DelegatingWebDriverFactory {

    public void initialize() {
        delegate = new FirefoxDriver();
    }
}

@@ -59,123 +59,434 @@
 ium.
-firefox.FirefoxDriver;%0A%0A/**%0A * Default factory that provides instances of %7B@link FirefoxDriver%7Ds.%0A */%0A
+WebDriver;%0Aimport org.openqa.selenium.firefox.FirefoxDriver;%0A%0A/**%0A * Makes WebDriver instances as needed.%0A * These can be per-story, per-scenario, or one for all stories.%0A */%0Apublic class DefaultWebDriverFactory extends DelegatingWebDriverFactory %7B%0A%0A    private Class%3C? extends WebDriver%3E driver;%0A%0A    /**%0A     * Provides instances of a supplied type%0A     * @param driver the WebDriver type to instantiate.%0A     */%0A    
 public 
-class 
 Defa
@@ -496,32 +496,40 @@
 WebDriverFactory
+(Class%3C?
  extends Delegat
@@ -517,34 +517,169 @@
 s%3C? extends 
-Delegating
+WebDriver%3E driver) %7B%0A        this.driver = driver;%0A    %7D%0A%0A    /**%0A     * Provides instances of %7B@link FirefoxDriver%7Ds.%0A     */%0A    public Default
 WebDriverFac
@@ -686,87 +686,357 @@
 tory
+()
  %7B%0A
-%0A    public void initialize() %7B%0A        delegate = new FirefoxDriver();
+        this.driver = FirefoxDriver.class;%0A    %7D%0A%0A    public void initialize() %7B%0A        try %7B%0A            delegate = driver.newInstance();%0A        %7D catch (InstantiationException e) %7B%0A            new UnsupportedOperationException(e);%0A        %7D catch (IllegalAccessException e) %7B%0A            new UnsupportedOperationException(e);%0A        %7D
 %0A    %7D%0A%7D
 %0A
@@ -1034,9 +1034,8 @@
 %0A    %7D%0A%7D
-%0A

make factory more flexible than just Firefox