Is there a way to handle checkboxes and radio buttons using Python Selenium?

Is there a way to handle checkboxes and radio buttons using Python Selenium?

Hi Brett,

You can try these lines of code to handle checkboxes and radio buttons using Python Selenium:

from selenium import webdriver
from selenium.webdriver.support.ui import Select
from time import sleep
from selenium.common.exceptions import NoSuchElementException
from pip._vendor.distlib import resources

driver = webdriver.Firefox()
driver.get("https://www.facebook.com")

''' Let the page load completely '''
sleep(20)

try:
    driver.find_element_by_id("u_0_5").click()
except NoSuchElementException:
    print("Element not found")

sleep(5)

driver.quit()