<commit_before>package browserview;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriverException;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;

import java.util.NoSuchElementException;

// acts as a middleman for ChromeDriver when not in testing mode,
// and as a stub when testing

public class ChromeDriverEx {

    private static final Logger logger = LogManager.getLogger(ChromeDriverEx.class.getName());

    private boolean isTestChromeDriver;
    private ChromeDriver driver;

    ChromeDriverEx(ChromeOptions options, boolean isTestChromeDriver) {
        this.isTestChromeDriver = isTestChromeDriver;
        initialise(options);
    }

    private void initialise(ChromeOptions options) {
        if (!isTestChromeDriver) driver = new ChromeDriver(options);
    }

    public WebDriver.Options manage() {
        return !isTestChromeDriver ? driver.manage() : null;
    }

    public void quit() {
        if (!isTestChromeDriver) driver.quit();
    }

    public void get(String url) throws WebDriverException {
        if (isTestChromeDriver) {
            logger.info("Test loading page: " + url);
            testGet();
        } else {
            if (driver.getCurrentUrl().toLowerCase().equals(url)) {
                logger.info("Already on page: " + url + " will not load it again. ");
            } else {
                logger.info("Previous page was: " + driver.getCurrentUrl());
                logger.info("Loading page: " + url);<commit_msg>added toLowerCase for next url in ChromeDriverEx<commit_after>package browserview;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriverException;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;

import java.util.NoSuchElementException;

// acts as a middleman for ChromeDriver when not in testing mode,
// and as a stub when testing

public class ChromeDriverEx {

    private static final Logger logger = LogManager.getLogger(ChromeDriverEx.class.getName());

    private boolean isTestChromeDriver;
    private ChromeDriver driver;

    ChromeDriverEx(ChromeOptions options, boolean isTestChromeDriver) {
        this.isTestChromeDriver = isTestChromeDriver;
        initialise(options);
    }

    private void initialise(ChromeOptions options) {
        if (!isTestChromeDriver) driver = new ChromeDriver(options);
    }

    public WebDriver.Options manage() {
        return !isTestChromeDriver ? driver.manage() : null;
    }

    public void quit() {
        if (!isTestChromeDriver) driver.quit();
    }

    public void get(String url) throws WebDriverException {
        if (isTestChromeDriver) {
            logger.info("Test loading page: " + url);
            testGet();
        } else {
            if (driver.getCurrentUrl().toLowerCase().equals(url.toLowerCase())) {
                logger.info("Already on page: " + url + " will not load it again. ");
            } else {
                logger.info("Previous page was: " + driver.getCurrentUrl());
                logger.info("Loading page: " + url);
{'fraction_non_alphanumeric': 0.09904153354632587, 'fraction_numerical': 0.0011617775196049957, 'mean_word_length': 3.179611650485437, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7311714', 'n_tokens_mistral': 984, 'n_tokens_neox': 958, 'n_words': 233}