I am using ruby 2.5.1, watir 6.11, Chrome 68.0, chrome webdriver 2.40 for web-scraping and I've got a problem with selecting radio-button. Html code of my page looks like:
<tr> <td class="filtr-info"> </td>
<td class="filtr-content-radio">
<div class="iradio_square-grey checked" style="position: relative;">
<input id="id1" name="name" type="radio" value="0" checked="checked" style="position: absolute; opacity: 0;">
<ins class="iCheck-helper" style="position: absolute; top: 0%; left: 0%; display: block; width: 100%; height: 100%; margin: 0px; padding: 0px; background: rgb(255, 255, 255); border: 0px; opacity: 0; cursor: pointer;">
</ins></div>
<span class="filter-radio-name">KRS</span>
<div class="iradio_square-grey" style="position: relative;">
<input id="id2" name="name" type="radio" value="1" style="position: absolute; opacity: 0;">
<ins class="iCheck-helper" style="position: absolute; top: 0%; left: 0%; display: block; width: 100%; height: 100%; margin: 0px; padding: 0px; background: rgb(255, 255, 255); border: 0px; opacity: 0; cursor: pointer;">
</ins></div>
<span class="filter-radio-name">REGON</span>
<div class="iradio_square-grey" style="position: relative;">
<input id="id3" name="name" type="radio" value="2" style="position: absolute; opacity: 0;">
<ins class="iCheck-helper" style="position: absolute; top: 0%; left: 0%; display: block; width: 100%; height: 100%; margin: 0px; padding: 0px; background: rgb(255, 255, 255); border: 0px; opacity: 0; cursor: pointer;">
</ins></div>
<span class="filter-radio-name">NIP</span>
</td>
<td class="filtr-help"> </td>
<td> </td>
</tr>
So, I 've got 3 radio buttons and want to select one of them. The problem occurs when I try to use method set on of those I receive a following error:
unknown error: Element <input id="id1" name="name" type="radio" value="1" style="position: absolute; opacity: 0;"> is not clickable at point (623, 245).
I also tried some methods to check how watir sees those buttons:
$b.radio(:id,'id1').exists? => true
$b.radio(:id,'id1').present? => false
$b.radio(:id,'id1').visible? => false
$b.radio(:id,'id1').hidden? => false
Is there any way I can choose one of buttons if they only exist, but are not visible or present?
Since ins
element is overlaying your element and I think it's permanent from your html, you better perform this click, I hope it would work.
b.radio(id: 'id2').following_sibling.click