I'm trying to implement a cookie clicker bot. Cookie clicker it's just a stupid simple game, where you can click on the cookie to earn more cookies. You can take a look at that masterpiece here.
The bot should just open the page, and click on the cookie 4000 times, but it clicks only one time.
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.action_chains import ActionChains
PATH = "C:\Program Files (x86)\chromedriver.exe"
driver = webdriver.Chrome(PATH)
driver.get("https://orteil.dashnet.org/cookieclicker/")
driver.implicitly_wait(10)
cookie = driver.find_element(By.ID, "bigCookie")
actions = ActionChains(driver)
actions.click(cookie)
for i in range(4000):
actions.perform()
I see these messages in the console. What is wrong with me my code?

for i in range(5000): cookie.click()But it really does look like the documentation says what you're doing at Tim's instructions should work, but it's just not. To my unlearned eyes, @Prophet's suggestion looks like it would create anActionChainthat grows longer with each iteration. Anyway, I just refactored to skip theActionChain.