Skip to content

yesod-test: testing radio buttons with the same label #1770

@eahlberg

Description

@eahlberg

I have a form with multiple radio button sections where the labels of the radio inputs are the same:

<form>
  <div>
    <label for="hident1">How do you rate your stay?</label>
    <div id="hident1">
      <label class="radio" for="hident1-1">
        <div>
          <input id="hident1-1" type="radio" name="f4" value="1" required="required">1
        </div>
      </label>
      <label class="radio" for="hident1-2">
        <div>
          <input id="hident1-2" type="radio" name="f4" value="2" required="required">2
        </div>
      </label>
    </div>
  </div>
  <div>
    <label for="hident2">How do you rate your dinner?</label>
    <div id="hident2">
      <label class="radio" for="hident2-1">
        <div>
          <input id="hident2-1" type="radio" name="f5" value="1" required="required">1
        </div>
      </label>
      <label class="radio" for="hident2-2">
        <div>
          <input id="hident2-2" type="radio" name="f5" value="2" required="required">2
        </div>
      </label>
    </div>
  </div>
</form>

Selecting a radio option by using e.g. byLabelContain "1" "1" therefore results in "More than one label contained 1". Is there another way to select a label in this case?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions