how do you click on a element using a web driver python?

I don’t know if your imports were correct. Also, your code doesn’t scroll to the bottom of the page. Use this.

import os
from import expected_conditions as EC
import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from import By
from import WebDriverWait

driver = webdriver.Chrome(executable_path='driver path')
driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
element = WebDriverWait(driver, 15).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="ctl00_ContentPlaceHolder1_gvMajorIncident_ctl23_lbtnYear"]')))

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top