lundi 11 janvier 2021

Selenium can't press all checkboxes

All checkboxes are checked first, after that I try to uncheck all besides "Киберспорт" I don't understand why Selenium can't click some checkboxes.. I use this script

for i, chckbx in enumerate(checkboxes):
    if chckbx.get_attribute("data-order") != "Киберспорт":
        
         print(f"{chckbx.text}")  # I get all names of checkboxes besides "Киберспорт"
         chckbx.click()

However, Selenium clicks not all checkboxes

Result is shown on the pictureenter image description here

First 2 checkboxes in HTML:

<div class="col-xs-6 col-md-3 order-item" data-order="Авст. футбол">
                        <div class="checkbox">
                                <input checked="checked" name="sports[]" value="20" id="sports_20" type="checkbox">
                                <label for="sports_20">
                                    <span class="custom_checkbox"></span>
                                    <p>Авст. футбол</p>
                                </label>
                        </div>
                      </div>

<div class="col-xs-6 col-md-3 order-item" data-order="Гэл.спорт">
                        <div class="checkbox">
                                <input checked="checked" name="sports[]" value="23" id="sports_23" type="checkbox">
                                <label for="sports_23">
                                    <span class="custom_checkbox"></span>
                                    <p>Гэл.спорт</p>
                                </label>
                        </div>
                      </div>




Aucun commentaire:

Enregistrer un commentaire