mardi 26 septembre 2017

Unable to clear checkboxes using Watir

I am trying to clear two currently checked checkboxes using Watir.

The HTML contains the following:

<input type="checkbox" name="checkbox" class="notifications-settings-tickbox" value="PLAYER" id="PLAYER-settings-checkbox" checked="checked">

<input type="checkbox" name="checkbox" class="notifications-settings-tickbox" value="MUSIC" id="MUSIC-settings-checkbox" checked="checked">

When the page is loaded, both of these are checked. I am trying to clear them both.

My code is:

    $website.checkboxes(:class => "notifications-settings-tickbox").each do |checkbox|
        checkbox.clear
     end

But the checkboxes remain checked. I'm not receiving any error message either so i'm a bit unsure as to what's going on.

I've also tried to directly clear each checkbox:

$website.checkbox(:id => "PLAYER-settings-checkbox").clear
$website.checkbox(:id => "MUSIC-settings-checkbox").clear

But have the same outcome.




Aucun commentaire:

Enregistrer un commentaire