[Python] Python Selenium - Checkbox Is Not Clicked With Explicit Wait

Discussão em 'Python' iniciado por Stack, Abril 24, 2025.

  1. Stack

    Stack Membro Participativo

    H, I am trying to click on the below checkbox.


    <thead class="ant-table-thead" xpath="1">
    <tr>
    <th class="ant-table-selection-column"><span class="ant-table-header-column"><div><span class="ant-table-column-title"><div class="ant-table-selection"><label class="ant-checkbox-wrapper"><span class="ant-checkbox"><input type="checkbox" class="ant-checkbox-input" value=""><span class="ant-checkbox-inner"></span></span>
    </label>
    </div>
    </span><span class="ant-table-column-sorter"></span></div>
    </span>
    </th>


    </tr>
    </thead>

    It gets clicked instantly only as follows:

    Checkbox = "//thead/tr[1]/th[1]/span[1]/div[1]/span[1]/div[1]/label[1]/span[1]/input[1]"
    driver.find_element_by_xpath(Checkbox).click()


    However, when I try to add explicit wait, the checkbox doesn't get clicked

    if WebDriverWait(driver, 30).until(
    EC.element_to_be_clickable((By.XPATH, Checkbox))): driver.find_element_by_xpath(
    Checkbox).click()


    I have also tried EC.visibility_of_element_located but also doesn't work

    Thanks for the help in advance

    Continue reading...

Compartilhe esta Página