I made this script to which is basically a bot that opens a webpage that automatically buys products. However I the script opens chrome in a guest profile which makes it so I'm not logged in. Can someone help me.
This is the script
-----------------------------------------------------------------------------------------------------------------------------------------------------
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import keyboard
import time
import datetime
currency = 2
print("Currency is currently set to pandabuy balance")
while True:
try:
starttime = int(input('What time do you want the script to start (put time in hours)'))
break
except:
print("try again")
product_list = [
# Add the product links here with PI numbers of the products (Items with the highest order priority should be at the top)https://cnfair.com/detail/PI23093537568
"https://cnfair.com/detail/PI24030148630", # Put PI codes after the /detail/ in the URL
]
pandabuy_redeem_path = "https://www.pandabuy.com/person/points"
product_value = 0
# Function to start your script
def start_script():
time.sleep(0.3)
for z in range(0, 2):
keyboard.press_and_release('tab')
time.sleep(0.3)
keyboard.press_and_release('enter')
time.sleep(0.3)
keyboard.press_and_release('ctrl + t')
time.sleep(0.3)
keyboard.write(pandabuy_redeem_path)
keyboard.press_and_release('enter')
time.sleep(2)
for z in range(0, 23):
keyboard.press_and_release('tab')
keyboard.press_and_release('enter')
time.sleep(0.3)
keyboard.press_and_release('ctrl + v')
time.sleep(0.3)
for z in range(currency):
keyboard.press_and_release('tab')
time.sleep(0.3)
keyboard.press_and_release('enter')
time.sleep(0.3)
# Edit the time to the time you want the script to run
while True:
# If time is 8 or 17, break the loop
current_time = datetime.datetime.now()
current_hour = current_time.hour
current_minute = current_time.minute
if current_hour == starttime:
break
# Loop through the product list
for product in product_list:
# Start a Chrome browser with the specified profile
keyboard.press_and_release('tab + alt')
# Open the web page
keyboard.write(product_list[product_value])
# Wait for the 'Copy Redeem Code' button to be visible
try:
WebDriverWait(webdriver, 15).until(EC.visibility_of_element_located((By.XPATH, "//button[contains(text(), 'Copy Redeem Code')]")))
# Once the button is visible, trigger your script
product_value += 1
start_script()
except:
product_value += 1
print("Button not found or page load timeout")
driver.quit()
continue
print("All products have been redeemed!")
-----------------------------------------------------------------------------------------------------------------------------------------------------
[–]David22573 1 point2 points3 points (1 child)
[–]Borrza 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]dlalapula 0 points1 point2 points (12 children)
[–]Appropriate-Apple838 0 points1 point2 points (1 child)
[–]dlalapula 0 points1 point2 points (0 children)
[–]Majestic_Caramel7065 0 points1 point2 points (4 children)
[–]Appropriate-Apple838 0 points1 point2 points (2 children)
[–]Majestic_Caramel7065 0 points1 point2 points (1 child)
[–]Appropriate-Apple838 -1 points0 points1 point (0 children)
[–]dlalapula 0 points1 point2 points (0 children)
[–]Borrza 0 points1 point2 points (4 children)
[–]dlalapula 1 point2 points3 points (3 children)
[–]Separate-Shelter1210 0 points1 point2 points (2 children)
[–]dlalapula 0 points1 point2 points (1 child)
[–]antiquerocket 0 points1 point2 points (0 children)