protected function getSelectedOptionByLabel($select, $option_label, $check_selected = TRUE) {
    if (!$field = $this->getSession()->getPage()->findField($select)) {
      throw new ExpectationException("Field '$select' not found.", $this->getSession());
    }

    /* @var \Behat\Mink\Element\NodeElement $field */

    // Check that the specified field is a <select> field.
    $this->assertElementType($field, 'select');

    $options = $field->findAll('css', 'option');
    $options = array_filter($options, function (NodeElement $option) use ($option_label) {
      return $option->getText() == $option_label ? $option : FALSE;
    });

    if (!($option = $options ? reset($options) : NULL)) {
      throw new ExpectationException("Option '$option_label' doesn't exist in '$select' select.", $this->getSession());
    }

    return $check_selected ? $option->isSelected() : !$option->isSelected();
  }