My HTML looks like:
<label class="btn-radio ">
<input type="radio" value="1" name="pens" class="input_normal">
<span></span>Yes
</label>
...
In my codeception test I try to set radio control:
$I->selectOption("//*[@name=pens]/ancestor::label", "1");
but it fails with error:
"Couldn't select option "//*[@name='pens' and @value='1']/ancestor::label","1": ElementNotVisibleException: element not visible".
When I remove the wrapping tags then it works, but UI is ruined. Has anyone encountered this problem before?
</div>
mcklayin gave the correct link to the solution in his comment. Here is my solution (for others to follow when needed). I had to replace selectOption() with click():
$pensionRequestField = "form#loan_application>div.form_fieldset>section>div#step1>div.row>div.col-19-24>fieldset#pension_registry>label#pension_option1";
$I->click(self::$pensionRequestField);