Skip to content

selectOption() not working with Bootrap's radio-custom radiobuttons #21

@ThomasLandauer

Description

@ThomasLandauer

I have a Bootstrap custom radio button:

<div class="custom-control custom-radio">
    <input type="radio" id="form_foo_0" name="form[foo]" value="Whatever" class="custom-control-input">
    <label for="form_foo_0" class="radio-custom custom-control-label required">Whatever</label>
</div>

When I do this in an acceptance test:

$I->selectOption('input[name="form[foo]"]', 'Whatever:');

or

$I->click(['css' => '#form_foo_0']);

...I'm getting:

[Facebook\WebDriver\Exception\ElementClickInterceptedException] element click intercepted:
Element <input type="radio" id="form_foo_0" name="form[foo]" value="Whatever" class="custom-control-input"> is not clickable at point (44, 1171).
Other element would receive the click:
<label for="form_foo_0" class="radio-custom custom-control-label required">...</label>
(Session info: chrome=85.0.4183.83)

The workaround I'm using now is to click the label:

$I->click(['css' => 'label[for="form_foo_0"]']);

Due to the popularity of Bootstrap I'm wondering if an out-of-the-box solution would be better in this case.

P.S.: I don't know why I have the class radio-custom on the <label> - it's created by Symfony's Bootstrap form theme

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