<commit_before>import atexit
from contextlib import contextmanager
from selenium import webdriver
from selenium.common.exceptions import (
    NoAlertPresentException,
    NoSuchWindowException,
    StaleElementReferenceException,
    UnexpectedAlertPresentException)
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from time import sleep, time

import capybara
from capybara.driver.base import Base
from capybara.exceptions import ExpectationNotMet, ModalNotFound
from capybara.selenium.node import Node
from capybara.utils import cached_property


class Driver(Base):
    def __init__(self, app):
        self.app = app
        self._frame_handles = []

    @cached_property
    def browser(self):
        browser = webdriver.Firefox(
            # Auto-accept unload alerts triggered by navigating away.
            capabilities={"unexpectedAlertBehaviour": "ignore"})
        atexit.register(browser.quit)
        return browser

    @property
    def current_url(self):
        return self.browser.current_url

    @property
    def title(self):
        return self.browser.title

    @property
    def html(self):
        return self.browser.page_source

    @property
    def text(self):
        return self.browser.text
<commit_msg>Use default Firefox capabilities as well as unexpectedAlertBehaviour<commit_after>import atexit
from contextlib import contextmanager
from selenium import webdriver
from selenium.common.exceptions import (
    NoAlertPresentException,
    NoSuchWindowException,
    StaleElementReferenceException,
    UnexpectedAlertPresentException)
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from time import sleep, time

import capybara
from capybara.driver.base import Base
from capybara.exceptions import ExpectationNotMet, ModalNotFound
from capybara.selenium.node import Node
from capybara.utils import cached_property


class Driver(Base):
    def __init__(self, app):
        self.app = app
        self._frame_handles = []

    @cached_property
    def browser(self):
        capabilities = DesiredCapabilities.FIREFOX.copy()
        # Auto-accept unload alerts triggered by navigating away.
        capabilities["unexpectedAlertBehaviour"] = "ignore"
        browser = webdriver.Firefox(capabilities=capabilities)
        atexit.register(browser.quit)
        return browser

    @property
    def current_url(self):
        return self.browser.current_url

    @property
    def title(self):
        return self.browser.title

    @property
    def html(self):
        return self.browser.page_source

    @property
    def text(self):
        return self.browser.text

{'fraction_non_alphanumeric': 0.061375661375661375, 'fraction_numerical': 0.0, 'mean_word_length': 3.6568144499178983, 'pattern_counts': {'":': 1, '<': 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': '5257005', 'n_tokens_mistral': 777, 'n_tokens_neox': 730, 'n_words': 205}