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))
def select_multi_items ( self , select_name ) : 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 ) )
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
            \"\"\"