<commit_before>package org.openlmis.UiUtils;


import com.gargoylesoftware.htmlunit.BrowserVersion;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;


public class DriverFactory {

    private String driverType;

    public WebDriver loadDriver() {
        return loadDriver(true);
    }

    public WebDriver loadDriverWithJavascriptDisabledIfPossible() {
        return loadDriver(false);
    }

    private WebDriver loadDriver(boolean enableJavascript) {
        /*
        For Firefox
         */
        driverType = System.getProperty("web.driver", "Firefox");
        /*
        For Chrome
         */
        //driverType=System.setProperty("webdriver.chrome.driver", "<path_to_chromedriver i.e.> /Users/Manjot/Downloads/chromedriver");
        //driverType = System.getProperty("webdriver.chrome.driver");

        if (driverType.equalsIgnoreCase("Firefox")) {
            return createFirefoxDriver(enableJavascript);
        } else if (driverType.equalsIgnoreCase("IE")) {
            return new InternetExplorerDriver();
        }
//        else if (driverType.equals("<path_to_chromedriver i.e.> /Users/Manjot/Downloads/chromedriver"))
//        {
//                return new ChromeDriver();
//        }
      else if (driverType.equalsIgnoreCase("HTMLUnit")) {
            if (!enableJavascript) {
            }
            return new HtmlUnitDriver(BrowserVersion.INTERNET_EXPLORER_8);
        } else {
            throw new RuntimeException(String.format("Driver %sNot Supported", driverType));
        }
    }

    private WebDriver createFirefoxDriver(boolean enableJavascript) {
        FirefoxProfile profile = new FirefoxProfile();<commit_msg>|Manjyot, Lokesh|#61| Added code to invoke functional tests using google chrome + Code for checking auto running of functional tests|<commit_after>package org.openlmis.UiUtils;


import com.gargoylesoftware.htmlunit.BrowserVersion;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;


public class DriverFactory {

    private String driverType;

    public WebDriver loadDriver() {
        return loadDriver(true);
    }

    public WebDriver loadDriverWithJavascriptDisabledIfPossible() {
        return loadDriver(false);
    }

    private WebDriver loadDriver(boolean enableJavascript) {
        /*
        For Firefox
         */
        driverType = System.getProperty("web.driver", "Firefox");
        /*
        For Chrome
         */
        //driverType=System.setProperty("webdriver.chrome.driver", "<path_to_chromedriver i.e.> /Users/Manjot/Downloads/chromedriver");
        //driverType = System.getProperty("webdriver.chrome.driver");

        if (driverType.equalsIgnoreCase("Firefox")) {
            return createFirefoxDriver(enableJavascript);
        } else if (driverType.equalsIgnoreCase("IE")) {
            return new InternetExplorerDriver();
        }
//        else if (driverType.equals("<path_to_chromedriver> /Users/Manjot/Downloads/chromedriver"))
//        {
//                return new ChromeDriver();
//        }
      else if (driverType.equalsIgnoreCase("HTMLUnit")) {
            if (!enableJavascript) {
            }
            return new HtmlUnitDriver(BrowserVersion.INTERNET_EXPLORER_8);
        } else {
            throw new RuntimeException(String.format("Driver %sNot Supported", driverType));
        }
    }

    private WebDriver createFirefoxDriver(boolean enableJavascript) {
        FirefoxProfile profile = new FirefoxProfile();
{'fraction_non_alphanumeric': 0.10292249047013977, 'fraction_numerical': 0.0010165184243964421, 'mean_word_length': 2.9959390862944164, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '534288', 'n_tokens_mistral': 1141, 'n_tokens_neox': 1078, 'n_words': 196}