<commit_before>__author__ = 'kpaskov'

import re
from behave import step
from selenium.common.exceptions import NoSuchElementException

@step('I visit "{url}" for "{obj}"')
def visit_page_for(context, url, obj):
    context.browser.get(context.base_url + url.replace('?', obj))

@step('I click the button with id "{button_id}"')
def click_button_with_id(context, button_id):
    try:
        button = context.browser.find_element_by_id(button_id)
        button.click()
    except NoSuchElementException:
        assert 0, 'No element with id ' + button_id

@step('I should see an element with id "{element_id}"')
def should_see_element_with_id(context, element_id):
    try:
        context.browser.find_element_by_id(element_id)
    except NoSuchElementException:
        assert 0, 'No element with id ' + element_id

@step('I should see an element with class_name "{element_class}"')
def should_see_element_with_class_name(context, element_class):
    try:
        context.browser.find_element_by_class_name(element_class)
    except NoSuchElementException:
        assert 0, 'No element with class ' + element_class

@step('I should see an element with css_selector "{css_selector}"')
def should_see_element_with_css_selector(context, css_selector):
        try:
            context.browser.find_element_by_css_selector(css_selector)
        except:
            assert 0, 'No element with CSS selector ' + css_selector

@step('I should see an element "{element_id}" with text "{text}"')
def should_see_element_with_id_with_text(context, element_id, text):<commit_msg>add setp for asserting element not present<commit_after>__author__ = 'kpaskov'

import re
from behave import step
from selenium.common.exceptions import NoSuchElementException

@step('I visit "{url}" for "{obj}"')
def visit_page_for(context, url, obj):
    context.browser.get(context.base_url + url.replace('?', obj))

@step('I click the button with id "{button_id}"')
def click_button_with_id(context, button_id):
    try:
        button = context.browser.find_element_by_id(button_id)
        button.click()
    except NoSuchElementException:
        assert 0, 'No element with id ' + button_id

@step('I should see an element with id "{element_id}"')
def should_see_element_with_id(context, element_id):
    try:
        context.browser.find_element_by_id(element_id)
    except NoSuchElementException:
        assert 0, 'No element with id ' + element_id

@step('I should not see an element with id "{element_id}"')
def should_see_element_with_id(context, element_id):
    try:
        context.browser.find_element_by_id(element_id)
        assert 0, 'Element with id ' + element_id + ' is present.'
    except NoSuchElementException:
        pass

@step('I should see an element with class_name "{element_class}"')
def should_see_element_with_class_name(context, element_class):
    try:
        context.browser.find_element_by_class_name(element_class)
    except NoSuchElementException:
        assert 0, 'No element with class ' + element_class

@step('I should see an element with css_selector "{css_selector}"')
def should_see_element_with_css_selector(context, css_selector):
        try:
            context.browser.find_element_by_css_selector(css_selector)
        except:
            assert 0, 'No element with CSS selector ' + css_selector

@step('I should see an element "{element_id}" with text "{text}"')
def should_see_element_with_id_with_text(context, element_id, text):
{'fraction_non_alphanumeric': 0.09613163972286375, 'fraction_numerical': 0.002598152424942263, 'mean_word_length': 4.44811320754717, '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': '1216909', 'n_tokens_mistral': 1059, 'n_tokens_neox': 1042, 'n_words': 282}