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

Evolution to Graph Databases and Neo4J

The Life and Lingering Death of Internet Explorer

I/0 Algorithm

What Are The Benefits Of AWS Lambda Serverless Computing?

A Different Way To Layout Views Programmatically Using Swift

Ignore Files In Gitignore Using Globbing Patterns

Mule Application Deployment using TeamCity

Mobydick Finance

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 3 speech recognition (speech to text)

The Python Series #4 — While Loop and General Terminologies

What is __name__ == “__main__” in Python?

Python Setup & Installation for Beginner