Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
1.9 kB
3
Indexable
Never
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys

chrome_options = Options()
chrome_options.add_experimental_option("detach", True)
import re
url = "https://orteil.dashnet.org/experiments/cookie/"
browser = webdriver.Chrome(options=chrome_options)
browser.get(url)

bas = browser.find_element(By.CSS_SELECTOR, value='#cookie')
a = ["#buyCursor","#buyGrandma","#buyFactory","#buyMine","#buyShipment","#buyPortal"]
f = True
import time


время_в_секундах = 5 * 60

# Время начала выполнения цикла
начальное_время = time.time()

while time.time() - начальное_время < время_в_секундах:

    money = browser.find_element(By.CSS_SELECTOR, value='#money')
    test = 0




    def mathh(text, i):
        if i >= 3:
            z = mathh1(text)
            return z
        else:
            match = re.search(r'\b\d+\b', text)
            number = int(match.group())
            return int(number)


    def mathh1(text):
        match = re.search(r'\b\d{1,3}(,\d{3})*\b', text)
        number1 = int(match.group().replace(',', ''))

        return int(number1)
    def sanau(money,number,bas2):

        if int(money) >= number:
            bas2.click()

    for i in range(6):
        bas.click()
        bas.click()
        bas.click()
        bas.click()
        if i < 6:
            bas2 = browser.find_element(By.CSS_SELECTOR, value=f'{a[i]}')
            bas3 = browser.find_element(By.CSS_SELECTOR, value=f'{a[i]} b')
            x = mathh(bas3.text,i)
            sanau(money.text,x,bas2)
time.sleep(1)
cokkiesseccond = browser.find_element(By.CSS_SELECTOR, value='#cps')
print(cokkiesseccond.text)
browser.quit()
Leave a Comment