unable to find the error in this python code <p>Unable to find the error indicated in <code>driver.find_element_by_css_selector(button).click()</code> trying to run in python 2.7</p> <pre><code>from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as ec from selenium.webdriver.common.by import By import time chrome_path=r"C:\Users\Bhanwar\Desktop\New folder (2)\chromedriver.exe" driver =webdriver.Chrome(chrome_path) driver.get("https://priceraja.com/mobile/pricelist/samsung-mobile-price-list-in-india") driver.implicitly_wait(10) i=0 time = 5 by = By.ID hook = "product-itmes-" # The id of one item, they seems to be this plus # the number item that they are button = '.loadmore' while i&lt;4: element_number = 25*i # It looks like there are 25 items added each time, and starts at 25 WebDriverWait(driver, time). until(ec.presence_of_element_located(by, hook+str(element_number)) driver.find_element_by_css_selector(button).click() time.sleep(1) # Makes the page wait for the element to change i+=1 </code></pre>