// Path: src/main/java/me/alb_i986/selenium/tinafw/ui/WebDriverFactoryLocal.java
// public class WebDriverFactoryLocal implements WebDriverFactory {
// 	
// 	/**
// 	 * @throws WebDriverFactoryException if the instantiation of the WebDriver fails
// 	 */
// 	@Override
// 	public WebDriver getWebDriver(SupportedBrowser browserType) {
// 		try {
// 			return browserType.toClass().newInstance();
// 		} catch (InstantiationException | IllegalAccessException e) {
// 			throw new WebDriverFactoryException(
// 					"cannot create a WebDriver instance for " + browserType, e);
// 		}
// 	}
// 
// }
// 
// Path: src/main/java/me/alb_i986/selenium/tinafw/ui/WebDriverFactoryRemote.java
// public class WebDriverFactoryRemote implements WebDriverFactory {
// 
// 	private URL gridHubURL;
// 	private DesiredCapabilities extraCapabilities;
// 
// 	/**
// 	 * A factory creating {@link WebDriver}s matching the given set of extra,
// 	 * desired capabilities
// 	 * (see also {@link RemoteWebDriver#RemoteWebDriver(URL, Capabilities)}).
// 	 * 
// 	 * @param hubURL
// 	 * @param extraCapabilities
// 	 * 
// 	 * @throws IllegalArgumentException if the desired capabilities specify
// 	 *         a {@link CapabilityType#BROWSER_NAME}
// 	 */
// 	public WebDriverFactoryRemote(URL hubURL, DesiredCapabilities extraCapabilities) {
// 		this(hubURL);
// 		if(extraCapabilities.is(CapabilityType.BROWSER_NAME))
// 			throw new IllegalArgumentException("Desired capabilities cannot specify a browser name");
// 		this.extraCapabilities = extraCapabilities;
// 	}
// 
// 	/**
// 	 * A factory creating {@link WebDriver}s against the given hub.
// 	 * 
// 	 * @param hubURL
// 	 */
// 	public WebDriverFactoryRemote(URL hubURL) {
// 		this.gridHubURL = hubURL;
// 	}
// 
// 	@Override
// 	public WebDriver getWebDriver(SupportedBrowser browserType) {
// 		DesiredCapabilities capabilities = browserType.toCapabilities();
// 		capabilities.merge(extraCapabilities);
// 		RemoteWebDriver remoteDriver = new RemoteWebDriver(gridHubURL, capabilities);
// 		remoteDriver.setFileDetector(new LocalFileDetector());
// 		return remoteDriver;
// 	}
// 
// }


import com.google.inject.AbstractModule;
import com.google.inject.Provides;
import com.google.inject.Singleton;
import me.alb_i986.selenium.tinafw.ui.WebDriverFactory;
import me.alb_i986.selenium.tinafw.ui.WebDriverFactoryDecoratorImplicitWait;
import me.alb_i986.selenium.tinafw.ui.WebDriverFactoryLocal;
import me.alb_i986.selenium.tinafw.ui.WebDriverFactoryRemote;
import org.openqa.selenium.remote.DesiredCapabilities;
import java.net.URL;
package me.alb_i986.selenium.tinafw.config;




public class TinafwGuiceModule extends AbstractModule {

    @Override
    protected void configure() {
    }

    /**
     * A {@link WebDriverFactory} according to the settings:
     * <ul>
     * <li>a {@link WebDriverFactoryLocal} if {@link Config#PROP_GRID_HUB_URL} is
     *     not defined;
     * <li>else, a {@link WebDriverFactoryRemote}
     * <li>finally, decorate it with {@link WebDriverFactoryDecoratorImplicitWait}, if
     *     {@link Config#PROP_TIMEOUT_IMPLICIT_WAIT} is defined
     * </ul>
     */
    @Provides
    @Singleton
    WebDriverFactory webDriverFactoryProvider() {
        WebDriverFactory tmpFactoryFromConfig;
        URL hubURL = Config.getGridHubUrl();
        if(hubURL == null) {
// Path: src/main/java/me/alb_i986/selenium/tinafw/ui/WebDriverFactoryLocal.java
// public class WebDriverFactoryLocal implements WebDriverFactory {
// 	
// 	/**
// 	 * @throws WebDriverFactoryException if the instantiation of the WebDriver fails
// 	 */
// 	@Override
// 	public WebDriver getWebDriver(SupportedBrowser browserType) {
// 		try {
// 			return browserType.toClass().newInstance();
// 		} catch (InstantiationException | IllegalAccessException e) {
// 			throw new WebDriverFactoryException(
// 					"cannot create a WebDriver instance for " + browserType, e);
// 		}
// 	}
// 
// }
// 
// Path: src/main/java/me/alb_i986/selenium/tinafw/ui/WebDriverFactoryRemote.java
// public class WebDriverFactoryRemote implements WebDriverFactory {
// 
// 	private URL gridHubURL;
// 	private DesiredCapabilities extraCapabilities;
// 
// 	/**
// 	 * A factory creating {@link WebDriver}s matching the given set of extra,
// 	 * desired capabilities
// 	 * (see also {@link RemoteWebDriver#RemoteWebDriver(URL, Capabilities)}).
// 	 * 
// 	 * @param hubURL
// 	 * @param extraCapabilities
// 	 * 
// 	 * @throws IllegalArgumentException if the desired capabilities specify
// 	 *         a {@link CapabilityType#BROWSER_NAME}
// 	 */
// 	public WebDriverFactoryRemote(URL hubURL, DesiredCapabilities extraCapabilities) {
// 		this(hubURL);
// 		if(extraCapabilities.is(CapabilityType.BROWSER_NAME))
// 			throw new IllegalArgumentException("Desired capabilities cannot specify a browser name");
// 		this.extraCapabilities = extraCapabilities;
// 	}
// 
// 	/**
// 	 * A factory creating {@link WebDriver}s against the given hub.
// 	 * 
// 	 * @param hubURL
// 	 */
// 	public WebDriverFactoryRemote(URL hubURL) {
// 		this.gridHubURL = hubURL;
// 	}
// 
// 	@Override
// 	public WebDriver getWebDriver(SupportedBrowser browserType) {
// 		DesiredCapabilities capabilities = browserType.toCapabilities();
// 		capabilities.merge(extraCapabilities);
// 		RemoteWebDriver remoteDriver = new RemoteWebDriver(gridHubURL, capabilities);
// 		remoteDriver.setFileDetector(new LocalFileDetector());
// 		return remoteDriver;
// 	}
// 
// }


// Path: src/main/java/me/alb_i986/selenium/tinafw/config/TinafwGuiceModule.java
import com.google.inject.AbstractModule;
import com.google.inject.Provides;
import com.google.inject.Singleton;
import me.alb_i986.selenium.tinafw.ui.WebDriverFactory;
import me.alb_i986.selenium.tinafw.ui.WebDriverFactoryDecoratorImplicitWait;
import me.alb_i986.selenium.tinafw.ui.WebDriverFactoryLocal;
import me.alb_i986.selenium.tinafw.ui.WebDriverFactoryRemote;
import org.openqa.selenium.remote.DesiredCapabilities;
import java.net.URL;

package me.alb_i986.selenium.tinafw.config;




public class TinafwGuiceModule extends AbstractModule {

    @Override
    protected void configure() {
    }

    /**
     * A {@link WebDriverFactory} according to the settings:
     * <ul>
     * <li>a {@link WebDriverFactoryLocal} if {@link Config#PROP_GRID_HUB_URL} is
     *     not defined;
     * <li>else, a {@link WebDriverFactoryRemote}
     * <li>finally, decorate it with {@link WebDriverFactoryDecoratorImplicitWait}, if
     *     {@link Config#PROP_TIMEOUT_IMPLICIT_WAIT} is defined
     * </ul>
     */
    @Provides
    @Singleton
    WebDriverFactory webDriverFactoryProvider() {
        WebDriverFactory tmpFactoryFromConfig;
        URL hubURL = Config.getGridHubUrl();
        if(hubURL == null) {
            tmpFactoryFromConfig = new WebDriverFactoryLocal();