Automating cookie clicker with python and selenium

import time
from selenium import webdriver
from selenium.webdriver import *
import keyboard
options = Options()
options.add_argument("--start-maximized")
driver = webdriver.Chrome(chrome_options = options, executable_path = r"Enter the path to your driver here")
driver.get("https://orteil.dashnet.org/cookieclicker/")
import time
from selenium import webdriver
from selenium.webdriver import *
import keyboard
options = Options()
options.add_argument("--start-maximized")
driver = webdriver.Chrome(chrome_options = options, executable_path = r"Enter the path to your driver here")driver.get("https://orteil.dashnet.org/cookieclicker/")
  1. Click on the cookie repeatedly
  2. Buy any products or upgrades that we can
The html for the game
def Click_on_cookie(num):    
Big_cookie = driver.find_element_by_id("bigCookie")
for i in range(num):
Big_cookie.click()
import time
from selenium import webdriver
from selenium.webdriver import *
import keyboard
options = Options()
options.add_argument("--start-maximized")
driver = webdriver.Chrome(chrome_options = options, executable_path = r"Enter the path to your driver here")driver.get("https://orteil.dashnet.org/cookieclicker/")def Click_on_cookie(num):
Big_cookie = driver.find_element_by_id("bigCookie")
for i in range(num):
Big_cookie.click()
#time to wait for the site to load
time.sleep(10)
while true:
Click_on_cookie(1)
#Kill switch
if keyboard.is_pressed("q"):
break
#Game Loop
while True:
Click_on_cookie(5)
#Buy all the items
try:
items = driver.find_elements_by_class_name("enabled")
for item in items[::-1]:
item.click()
except:
print("Not enough cookies")
#Kill switch
if keyboard.is_pressed("q"):
import time
from selenium import webdriver
from selenium.webdriver import *
import keyboard
options = Options()
options.add_argument("--start-maximized")
driver = webdriver.Chrome(chrome_options = options, executable_path = r"Enter the path to your driver here")driver.get("https://orteil.dashnet.org/cookieclicker/")def Click_on_cookie(num):
Big_cookie = driver.find_element_by_id("bigCookie")
for i in range(num):
Big_cookie.click()
#time to wait for the site to load
time.sleep(10)
#Game Loop
while True:
Click_on_cookie(5)
#Buy all the items
try:
items = driver.find_elements_by_class_name("enabled")
for item in items[::-1]:
item.click()
except:
print("Not enough cookies")
#Kill switch
if keyboard.is_pressed("q"):

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store