-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
47 lines (38 loc) · 1.69 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import time
import datetime
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
chrome_driver=r"C:\developer\chromedriver.exe"
driver=webdriver.Chrome(service=Service(chrome_driver))
driver.get('https://orteil.dashnet.org/cookieclicker/')
def english_clicker():
try:
eng=driver.find_element(By.XPATH, '//*[@id="langSelect-EN"]')
eng.click()
except:
english_clicker()
english_clicker()
time.sleep(5)
click_cookie=driver.find_element(By.XPATH, '//*[@id="bigCookie"]')
cursor_upgrade = driver.find_element(By.XPATH, '//*[@id="product0"]')
grandma_upgrade = driver.find_element(By.XPATH, '//*[@id="product1"]')
now= datetime.datetime.now()
five_minute_from_now=now+datetime.timedelta(minutes=5)
while datetime.datetime.now()<five_minute_from_now:
click_cookie.click()
cookie = int(driver.find_element(By.XPATH, '//*[@id="cookies"]').text.split()[0].replace(',', ''))
cursor_price = int(driver.find_element(By.XPATH, '//*[@id="productPrice0"]').text.replace(',', ''))
grandma_price = int(driver.find_element(By.XPATH, '//*[@id="productPrice1"]').text.replace(',', ''))
try:
product3_price_upgrade = driver.find_element(By.XPATH, '//*[@id="product2"]')
product3_price = int(driver.find_element(By.XPATH, '//*[@id="productPrice2"]').text.replace(',', ''))
if cookie > product3_price:
product3_price_upgrade.click()
elif cookie > grandma_price and grandma_price<product3_price/8:
grandma_upgrade.click()
elif cookie>cursor_price and cursor_price<grandma_price/8:
cursor_upgrade.click()
except:
pass
driver.quit()