module-webdriver icon indicating copy to clipboard operation
module-webdriver copied to clipboard

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

Open ThomasLandauer opened this issue 3 years ago • 1 comments

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

ThomasLandauer avatar Sep 21 '20 16:09 ThomasLandauer