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/")
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"):

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Data Information Visualizations Analyses and Actions

PerfstackAnalysis.png

TIF strikes back for the next edition!

In which I discovered that whereHas() worked with nested relationships

Notifications: How they might impact hotels’ operational process in the Hospitality Industry

Enterprise vs Consumer Products 🚀— The Engineering Difference

When to use Segment Trees and Binary Search Trees.

In-Memory, Distributed Data Structures for the masses

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
Aashrut Agarwal

Aashrut Agarwal

More from Medium

Python System programming Part 3

Check All The Links Of A Given Website Using Python

Data scraping with Python tutorial on real estate website

Building Image Dataset from Scraping using Selenium 4