Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from selenium import webdriver
- from selenium.webdriver.common.by import By
- from selenium.webdriver.chrome.service import Service
- import time
- # Start the WebDriver (assuming Chrome in this example)
- driver_path = "C:\Apps\chromedriver\chromedriver-win64\chromedriver.exe"
- service = Service(driver_path)
- # Start the WebDriver using the specified service
- driver = webdriver.Chrome(service=service)# Replace 'your_url' with the actual URL of the webpage
- driver.get('https://omayo.blogspot.com/')
- driver.maximize_window()
- # Locate the checkbox element
- checkbox_element = driver.find_element(By.ID, 'checkbox2')
- # Check if the checkbox is selected
- if not checkbox_element.is_selected():
- checkbox_element.click()
- print("Checkbox is selected")
- else:
- print("Checkbox is not selected")
- # Close the WebDriver
- time.sleep(5)
- driver.quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement