Exemple #1
0
def assert_not_checked_checkbox(self, value):
    """
    Assert the checkbox with label (recommended), name or id is not checked.
    """
    check_box = find_field(world.browser, 'checkbox', value)
    assert check_box, "Cannot find checkbox '{}'.".format(value)
    assert not check_box.is_selected(), "Check box should not be selected."
Exemple #2
0
def assert_not_checked_checkbox(self, value):
    """
    Assert the checkbox with label (recommended), name or id is not checked.
    """
    check_box = find_field(world.browser, 'checkbox', value)
    assert check_box, "Cannot find checkbox '{}'.".format(value)
    assert_false(check_box.is_selected())
def assert_radio_not_selected(self, value):
    """
    Assert the radio button with the given label (recommended), name or id is
    not chosen.
    """
    box = find_field(world.browser, 'radio', value)
    assert_false(box.is_selected())
def choose_radio(self, value):
    """
    Click (and choose) the radio button with the given label (recommended),
    name or id.
    """
    box = find_field(world.browser, 'radio', value)
    box.click()
Exemple #5
0
def select_multi_items(self, select_name):
    """
    Select multiple options from select with label (recommended), name, or
    id. Pass a multiline string of options. e.g.

    .. code-block:: gherkin

        When I select the following from "Contact Methods":
            \"\"\"
            Email
            Phone
            Fax
            \"\"\"
    """
    # Ensure only the options selected are actually selected
    option_names = self.multiline.split('\n')
    select_box = find_field(world.browser, 'select', select_name)
    assert select_box, "Cannot find a '{}' select.".format(select_name)

    select = Select(select_box)
    select.deselect_all()

    for option in option_names:
        try:
            select.select_by_value(option)
        except NoSuchElementException:
            try:
                select.select_by_visible_text(option)
            except NoSuchElementException:
                raise AssertionError(
                    "Cannot find option: '{}'.".format(option))
Exemple #6
0
def select_multi_items(self, select_name):
    """
    Select multiple options from select with label (recommended), name, or
    id. Pass a multiline string of options. e.g.

    .. code-block:: gherkin

        When I select the following from "Contact Methods":
            \"\"\"
            Email
            Phone
            Fax
            \"\"\"
    """
    # Ensure only the options selected are actually selected
    option_names = self.multiline.split('\n')
    select_box = find_field(world.browser, 'select', select_name)
    assert select_box, "Cannot find a '{}' select.".format(select_name)

    select = Select(select_box)
    select.deselect_all()

    for option in option_names:
        try:
            select.select_by_value(option)
        except NoSuchElementException:
            try:
                select.select_by_visible_text(option)
            except NoSuchElementException:
                raise AssertionError("Cannot find option: '{}'.".format(option))
Exemple #7
0
def choose_radio(self, value):
    """
    Click (and choose) the radio button with the given label (recommended),
    name or id.
    """
    box = find_field(world.browser, 'radio', value)
    assert box, "Cannot find a '{}' radio button.".format(value)
    box.click()
def assert_radio_not_selected(self, value):
    """
    Assert the radio button with the given label (recommended), name or id is
    not chosen.
    """
    radio = find_field(world.browser, 'radio', value)
    assert radio, "Cannot find a '{}' radio button.".format(value)
    assert not radio.is_selected(), "Radio button should not be selected."
Exemple #9
0
def assert_radio_selected(self, value):
    """
    Assert the radio button with the given label (recommended), name or id is
    chosen.
    """
    box = find_field(world.browser, 'radio', value)
    assert box, "Cannot find a '{}' radio button.".format(value)
    assert_true(box.is_selected())
Exemple #10
0
def assert_radio_not_selected(self, value):
    """
    Assert the radio button with the given label (recommended), name or id is
    not chosen.
    """
    radio = find_field(world.browser, 'radio', value)
    assert radio, "Cannot find a '{}' radio button.".format(value)
    assert not radio.is_selected(), "Radio button should not be selected."
Exemple #11
0
def choose_radio(self, value):
    """
    Click (and choose) the radio button with the given label (recommended),
    name or id.
    """
    box = find_field(world.browser, 'radio', value)
    assert box, "Cannot find a '{}' radio button.".format(value)
    box.click()
Exemple #12
0
def assert_multi_selected(self, select_name):
    # Ensure its not selected unless its one of our options
    option_names = self.multiline.split('\n')
    select_box = find_field(world.browser, 'select', select_name)
    option_elems = select_box.find_elements_by_xpath(str('./option'))
    for option in option_elems:
        if option.get_attribute('id') in option_names or \
           option.get_attribute('name') in option_names or \
           option.get_attribute('value') in option_names or \
           option.text in option_names:
            assert_true(option.is_selected())
        else:
            assert_false(option.is_selected())
Exemple #13
0
def select_multi_items(self, select_name):
    # Ensure only the options selected are actually selected
    option_names = self.multiline.split('\n')
    select_box = find_field(world.browser, 'select', select_name)

    select = Select(select_box)
    select.deselect_all()

    for option in option_names:
        try:
            select.select_by_value(option)
        except NoSuchElementException:
            select.select_by_visible_text(option)
def assert_multi_selected(self, select_name):
    # Ensure its not selected unless its one of our options
    option_names = self.multiline.split('\n')
    select_box = find_field(world.browser, 'select', select_name)
    option_elems = select_box.find_elements_by_xpath(str('./option'))
    for option in option_elems:
        if option.get_attribute('id') in option_names or \
           option.get_attribute('name') in option_names or \
           option.get_attribute('value') in option_names or \
           option.text in option_names:
            assert_true(option.is_selected())
        else:
            assert_false(option.is_selected())
def select_multi_items(self, select_name):
    # Ensure only the options selected are actually selected
    option_names = self.multiline.split('\n')
    select_box = find_field(world.browser, 'select', select_name)

    select = Select(select_box)
    select.deselect_all()

    for option in option_names:
        try:
            select.select_by_value(option)
        except NoSuchElementException:
            select.select_by_visible_text(option)
Exemple #16
0
def assert_multi_selected(self, select_name):
    select_box = find_field(world.browser, 'select', select_name)
    assert select_box, "Cannot find a '{}' select.".format(select_name)

    option_names = self.multiline.split('\n')
    option_elems = select_box.find_elements_by_xpath(str('./option'))

    # Check only the options that are specified are selected
    for option in option_elems:
        if option.get_attribute('id') in option_names or \
           option.get_attribute('name') in option_names or \
           option.get_attribute('value') in option_names or \
           option.text in option_names:
            assert_true(option.is_selected())
        else:
            assert_false(option.is_selected())
Exemple #17
0
def assert_multi_selected(self, select_name):
    select_box = find_field(world.browser, 'select', select_name)
    assert select_box, "Cannot find a '{}' select.".format(select_name)

    option_names = self.multiline.split('\n')
    option_elems = select_box.find_elements_by_xpath(str('./option'))

    # Check only the options that are specified are selected
    for option in option_elems:
        if option.get_attribute('id') in option_names or \
                option.get_attribute('name') in option_names or \
                option.get_attribute('value') in option_names or \
                option.text in option_names:
            assert option.is_selected(), "Option should be selected."
        else:
            assert not option.is_selected(), \
                "Option should not be selected."
Exemple #18
0
def choose_radio(self, value):
    box = find_field(world.browser, 'radio', value)
    box.click()
Exemple #19
0
def uncheck_checkbox(self, value):
    """Uncheck the checkbox with label (recommended), name or id."""
    check_box = find_field(world.browser, 'checkbox', value)
    assert check_box, "Cannot find checkbox '{}'.".format(value)
    if check_box.is_selected():
        check_box.click()
Exemple #20
0
def uncheck_checkbox(self, value):
    """Uncheck the checkbox with label (recommended), name or id."""
    check_box = find_field(world.browser, 'checkbox', value)
    assert check_box, "Cannot find checkbox '{}'.".format(value)
    if check_box.is_selected():
        check_box.click()
 def test_find_field(self):
     assert find_field(world.browser, "text", "username")
     assert find_field(world.browser, "text", "Username:"******"text", "user")
     assert find_field(world.browser, "text", "ชื่อ:")
 def test_find_field(self):
     from aloe_webdriver.util import find_field
     assert find_field(world.browser, 'text', 'username')
     assert find_field(world.browser, 'text', 'Username:'******'text', 'user')
     assert find_field(world.browser, 'text', 'ชื่อ:')
 def test_find_field(self):
     assert find_field(world.browser, 'text', 'username')
     assert find_field(world.browser, 'text', 'Username:'******'text', 'user')
     assert find_field(world.browser, 'text', 'ชื่อ:')
Exemple #24
0
def uncheck_checkbox(self, value):
    check_box = find_field(world.browser, 'checkbox', value)
    if check_box.is_selected():
        check_box.click()
def assert_radio_not_selected(self, value):
    box = find_field(world.browser, 'radio', value)
    assert_false(box.is_selected())
def choose_radio(self, value):
    box = find_field(world.browser, 'radio', value)
    box.click()
Exemple #27
0
def assert_not_checked_checkbox(self, value):
    check_box = find_field(world.browser, 'checkbox', value)
    assert_false(check_box.is_selected())
Exemple #28
0
def assert_checked_checkbox(self, value):
    """Assert the checkbox with label (recommended), name or id is checked."""
    check_box = find_field(world.browser, 'checkbox', value)
    assert_true(check_box.is_selected())
def assert_not_checked_checkbox(self, value):
    check_box = find_field(world.browser, 'checkbox', value)
    assert_false(check_box.is_selected())
Exemple #30
0
def assert_radio_not_selected(self, value):
    box = find_field(world.browser, 'radio', value)
    assert_false(box.is_selected())
def uncheck_checkbox(self, value):
    check_box = find_field(world.browser, 'checkbox', value)
    if check_box.is_selected():
        check_box.click()
 def test_find_field(self):
     assert find_field(world.browser, 'text', 'username')
     assert find_field(world.browser, 'text', 'Username:'******'text', 'user')
     assert find_field(world.browser, 'text', 'ชื่อ:')
Exemple #33
0
def uncheck_checkbox(self, value):
    """Uncheck the checkbox with label (recommended), name or id."""
    check_box = find_field(world.browser, 'checkbox', value)
    if check_box.is_selected():
        check_box.click()