if type == 2: for p in range(1, maxpages + 1): link = url + str(p) driver.get(link) Users = driver.find_elements_by_