I'm trying to tick all checkboxes on a page. There are about 50 of them and this code seems to work but only ticks what is visible on the screen. It doesn't scroll down the table and tick the remaining boxes.
def select_checkbox():
checkboxes = driver.find_elements_by_css_selector("//input[@type='checkbox']")
for checkbox in checkboxes:
if not checkbox.is_selected():
checkbox.click() # to tick it
I'm thinking It's only finding those on the screen as the rest are still loading. I need to wait until all checkboxes have loaded but I'm not sure about how to go about this. Any help is appreciated.
Below is the table row
<input type="checkbox" value="1" name="admin_contract_form[price_forms_attributes][51][offered]" id="admin_contract_form_price_forms_attributes_51_offered">