<commit_before>import sys
import os
import sublime

sys.path.append(os.path.dirname(__file__))

from .selenium.webdriver import Chrome


class Browser:
    def __init__(self):
        print("Intializing BrowserIntegration instance.")

        self.webdriver = None
        self.selected_items = []
        self.old_selector = ''
        self.recording = False

    def connected(self):
        return self.webdriver is not None

    def connect(self):
        self.webdriver = Chrome(os.path.join(os.path.dirname(__file__), '..',
                                             'chromedriver'))

    def quit(self):
        self.webdriver.quit()
        self.webdriver = None

    def select_css(self, selector):
        if selector:
            try:
                self.selected_items = \
                    self.webdriver.find_elements_by_css_selector(selector)

                self.old_selector = selector
            except:
                self.selected_items = []
        else:
            self.selected_items = []
            self.old_selector = ''

        return self.selected_items

    def execute(self, script):
        from .browser_integration import warning

        try:
            return self.webdriver.execute_script(script)
        except Exception as e:
            warning(str(e))
            view = sublime.active_window().new_file()
            view.run_command('insert_into_view', {'text': str(e)})<commit_msg>Removed opening new tab with error on script executing<commit_after>import sys
import os

sys.path.append(os.path.dirname(__file__))

from .selenium.webdriver import Chrome


class Browser:
    def __init__(self):
        print("Intializing BrowserIntegration instance.")

        self.webdriver = None
        self.selected_items = []
        self.old_selector = ''
        self.recording = False

    def connected(self):
        return self.webdriver is not None

    def connect(self):
        self.webdriver = Chrome(os.path.join(os.path.dirname(__file__), '..',
                                             'chromedriver'))

    def quit(self):
        self.webdriver.quit()
        self.webdriver = None

    def select_css(self, selector):
        if selector:
            try:
                self.selected_items = \
                    self.webdriver.find_elements_by_css_selector(selector)

                self.old_selector = selector
            except:
                self.selected_items = []
        else:
            self.selected_items = []
            self.old_selector = ''

        return self.selected_items

    def execute(self, script):
        from .browser_integration import warning

        try:
            return self.webdriver.execute_script(script)
        except Exception as e:
            warning(str(e))
            print(str(e))
{'fraction_non_alphanumeric': 0.09068189932167083, 'fraction_numerical': 0.0, 'mean_word_length': 1.8446700507614213, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4383112', 'n_tokens_mistral': 766, 'n_tokens_neox': 721, 'n_words': 157}