Untitled

mail@pastecode.io avatar
unknown
python
a year ago
1.6 kB
9
Indexable
Never
while True:
		cookie.click()
		if time.time() > timeout:

			while True:
				try:
					cursor = driver.find_element(By.XPATH, "//*[@id='buyCursor']")
					grandma = driver.find_element(By.XPATH, "//*[@id='buyGrandma']")
					factory = driver.find_element(By.XPATH, "//*[@id='buyFactory']")
					mine = driver.find_element(By.XPATH, "//*[@id='buyMine']")
					shipment = driver.find_element(By.XPATH, "//*[@id='buyShipment']")
					alchemy = driver.find_element(By.XPATH, "//*[@id='buyAlchemy lab']")
					portal = driver.find_element(By.XPATH, "//*[@id='buyPortal']")
					timemachine = driver.find_element(By.XPATH, "//*[@id='buyTime machine']")

					dict1 = {
						cursor: int(cursor.text.split()[2].replace(",","")),
						grandma: int(grandma.text.split()[2].replace(",","")),
						factory: int(factory.text.split()[2].replace(",","")),
						mine: int(mine.text.split()[2].replace(",","")),
						shipment: int(shipment.text.split()[2].replace(",","")),
						alchemy: int(alchemy.text.split()[3].replace(",","")),
						portal: int(portal.text.split()[2].replace(",","")),
						timemachine: int(timemachine.text.split()[3].replace(",","")),
					}
					break
				except (StaleElementReferenceException, NoSuchElementException, selenium.common.exceptions.WebDriverException):
					continue



			sorted_dict1_list = sorted(dict1.items(), key=lambda x: x[1], reverse=True)
			sorted_dict1 = dict(sorted_dict1_list)

			for key, value in sorted_dict1.items():
				if int(cookieclicknum.text.replace(",","")) >= value:
					print(value)
					key.click()
					break
			timeout = time.time() + 5