forked from dkkocab/WebSiteBot_PS5
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWalmartBot_PS5_RELEASE.py
239 lines (205 loc) · 12.8 KB
/
WalmartBot_PS5_RELEASE.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
from selenium import webdriver
import tkinter
import time
from tkinter import Button, Frame, messagebox
from functools import partial
def order(driver,myFirstName,myLastName,myEmail,myAddress,myPhone,myCreditCardNum,myCreditExpireMonth,myCreditExpireYear,myCVV, myUsername, myPassword):
#VARIABLES
addToCart = '//*[@id="add-on-atc-container"]/div[1]/section/div[1]/div[3]/button/span/span'
checkOut = '//*[@id="cart-root-container-content-skip"]/div[1]/div/div[2]/div/div/div/div/div[3]/div/div/div[2]/div/div[2]/div/button[1]'
username = '//*[@id="sign-in-email"]'
password = '/html/body/div[1]/div/div[1]/div/div[1]/div[3]/div/div/div/div[1]/div/div/div/div/div[3]/div/div[4]/div/section/div/section/form/div[2]/div/div[1]/label/div[2]/div/input'
continueWithAccount = '/html/body/div[1]/div/div[1]/div/div[1]/div[3]/div/div/div/div[1]/div/div/div/div/div[3]/div/div[4]/div/section/div/section/form/div[5]/button/span'
firstContinue = '/html/body/div[1]/div/div[1]/div/div[1]/div[3]/div/div/div/div[2]/div/div[2]/div/div/div/div[3]/div/div/div[2]/button/span'
firstName ='//*[@id="firstName"]'
lastName = '//*[@id="lastName"]'
email = '//*[@id="email"]'
address = '//*[@id="addressLineOne"]'
phone = '//*[@id="phone"]'
confirmInfo = '/html/body/div[1]/div/div[1]/div/div[1]/div[3]/div/div/div/div[3]/div[1]/div[2]/div/div/div/div[3]/div/div/div/div/div/form/div[2]/div[2]/button/span'
creditCardNum = '//*[@id="creditCard"]'
creditExpireMonth = '//*[@id="month-chooser"]'
creditExpireYear = '//*[@id="year-chooser"]'
creditCVV = '//*[@id="cvv"]'
reviewOrder = '/html/body/div[1]/div/div[1]/div/div[1]/div[3]/div/div/div/div[4]/div[1]/div[2]/div/div/div/div[3]/div[2]/div/div/div/div[2]/div/div/div/form/div[3]/div/button/span/span/span'
confirmOrder = '/html/body/div[1]/div/div[1]/div/div[1]/div[3]/div/div/div[2]/div[1]/div[2]/div/div/div[2]/div/form/div/button'
#ADDS PS5 TO CART AND GOES TO CHECKOUT
clickAddToCartButton(addToCart, driver)
time.sleep(1)
clickButton(checkOut, driver)
time.sleep(1)
enterData(username, myUsername.get(), driver)
enterData(password, myPassword.get(), driver)
clickButton(continueWithAccount, driver)
time.sleep(1)
#FILLS OUT SHIPPING INFO
clickButton(firstContinue, driver)
enterData(firstName, myFirstName.get(), driver)
enterData(lastName, myLastName.get(), driver)
enterData(phone, myPhone.get(), driver)
enterData(email, myEmail.get(), driver)
enterData(address, myAddress.get(), driver)
clickButton(confirmInfo, driver)
#FILLS OUT PAYMENT
enterData(creditCardNum, myCreditCardNum.get(), driver)
enterData(creditExpireMonth, myCreditExpireMonth.get(), driver)
enterData(creditExpireYear, myCreditExpireYear.get(), driver)
enterData(creditCVV, myCVV.get(), driver)
#ORDER
clickButton(reviewOrder)
clickButton(confirmOrder)
def clickAddToCartButton(xpath,driver):
try:
driver.find_element_by_xpath(xpath).click()
pass
except Exception:
time.sleep(5)
driver.refresh();
clickAddToCartButton(xpath, driver)
def clickButton(xpath ,driver):
try:
driver.find_element_by_xpath(xpath).click()
pass
except Exception:
time.sleep(1)
clickButton(xpath, driver)
def enterData(field,data ,driver):
try:
driver.find_element_by_xpath(field).send_keys(data)
pass
except Exception:
time.sleep(1)
enterData(field,data, driver)
def PlayStationDigital(myFirstName,myLastName,myEmail,myAddress,myPhone,myCreditCardNum,myCreditExpireMonth,myCreditExpireYear,myCVV, supplier, myUsername, myPassword):
messagebox.showinfo('Message', 'Bot has been turned on. Press "Okay" to continue and the Playstation bot will run. This application may stop responding as it runs, but it will continue to run the scripts')
if supplier == "Walmart":
driver = webdriver.Chrome("C:/Users/Alex/Downloads/chromedriver_win32/chromedriver.exe")
driver.get('https://www.walmart.com/ip/Sony-PlayStation-5-Digital-Edition/493824815')
order(driver,myFirstName,myLastName,myEmail,myAddress,myPhone,myCreditCardNum,myCreditExpireMonth,myCreditExpireYear,myCVV, myUsername, myPassword)
def PlayStationPhysical(myFirstName,myLastName,myEmail,myAddress,myPhone,myCreditCardNum,myCreditExpireMonth,myCreditExpireYear,myCVV, supplier, myUsername, myPassword):
messagebox.showinfo('Message', 'Bot has been turned on. Press "Okay" to continue and the Playstation bot will run. This application may stop responding as it runs, but it will continue to run the scripts')
if supplier == "Walmart":
driver = webdriver.Chrome("C:/Users/Alex/Downloads/chromedriver_win32/chromedriver.exe")
driver.get('https://www.walmart.com/ip/PlayStation-5-Console/363472942')
order(driver,myFirstName,myLastName,myEmail,myAddress,myPhone,myCreditCardNum,myCreditExpireMonth,myCreditExpireYear,myCVV, myUsername, myPassword)
root.mainloop()
def XboxX(myFirstName,myLastName,myEmail,myAddress,myPhone,myCreditCardNum,myCreditExpireMonth,myCreditExpireYear,myCVV, supplier, myUsername, myPassword):
messagebox.showinfo('Message', 'Bot has been turned on. Press "Okay" to continue and the Xbox bot will run. This application may stop responding as it runs, but it will continue to run the scripts')
if supplier == "Walmart":
driver = webdriver.Chrome("C:/Users/Alex/Downloads/chromedriver_win32/chromedriver.exe")
driver.get('https://www.walmart.com/ip/XB1-Xbox-Series-X/443574645')
order(driver,myFirstName,myLastName,myEmail,myAddress,myPhone,myCreditCardNum,myCreditExpireMonth,myCreditExpireYear,myCVV, supplier, myUsername, myPassword)
root.mainloop()
def XboxS(myFirstName,myLastName,myEmail,myAddress,myPhone,myCreditCardNum,myCreditExpireMonth,myCreditExpireYear,myCVV, supplier, myUsername, myPassword):
messagebox.showinfo('Message', 'Bot has been turned on. Press "Okay" to continue and the Xbox bot will run. This application may stop responding as it runs, but it will continue to run the scripts')
if supplier == "Walmart":
driver = webdriver.Chrome("C:/Users/Alex/Downloads/chromedriver_win32/chromedriver.exe")
driver.get('https://www.walmart.com/ip/XB1-Xbox-Series-S/606518560')
order(driver,myFirstName,myLastName,myEmail,myAddress,myPhone,myCreditCardNum,myCreditExpireMonth,myCreditExpireYear,myCVV, myUsername, myPassword)
root.mainloop()
def form(console,supplier):
root = tkinter.Tk()
root.title("Kocab's PlayStation Bot")
root.geometry("1000x600")
greeting = tkinter.Label(root, text="*This information isn't needed to run the code. Filling out this information will automate the whole purchase. Leave it blank and it will go to the end of the transcation where you can finish the rest manually*",wraplength=700)
greeting.grid(column = 0, row = 0)
#FORM
lableName = tkinter.Label(root, text="First Name: ")
lableName.grid(column = 0, row = 10, pady=10)
myFirstName = tkinter.StringVar()
nameEntered = tkinter.Entry(root, width=25, textvariable = myFirstName)
nameEntered.grid(column = 1, row = 10, pady=10)
lableLast = tkinter.Label(root, text="Last Name: ")
lableLast.grid(column = 0, row = 15 ,pady=10)
myLastName = tkinter.StringVar()
lastEntered = tkinter.Entry(root, width=25, textvariable = myLastName)
lastEntered.grid(column = 1, row = 15,padx=10, pady=10)
lableMail = tkinter.Label(root, text="Email Address: ")
lableMail.grid(column = 0, row = 20,padx=10, pady=10)
myEmail = tkinter.StringVar()
mailEntered = tkinter.Entry(root, width=25, textvariable = myEmail)
mailEntered.grid(column = 1, row = 20,padx=10, pady=10)
lableAddress = tkinter.Label(root, text="Address (ex: 123 Cherry Lane): ")
lableAddress.grid(column = 0, row = 25,padx=10, pady=10)
myAddress = tkinter.StringVar()
addressEntered = tkinter.Entry(root, width=25, textvariable = myAddress)
addressEntered.grid(column = 1, row = 25,padx=10, pady=10)
lablePhone = tkinter.Label(root, text="Phone Number: ")
lablePhone.grid(column = 0, row = 30,padx=10, pady=10)
myPhone = tkinter.StringVar()
PhoneEntered = tkinter.Entry(root, width=25, textvariable = myPhone)
PhoneEntered.grid(column = 1, row = 30,padx=10, pady=10)
lableCardNum = tkinter.Label(root, text="Credit/Debit card number: ")
lableCardNum.grid(column = 0, row = 35,padx=10, pady=10)
myCreditCardNum = tkinter.StringVar()
CardNumEntered = tkinter.Entry(root, width=25, textvariable = myCreditCardNum)
CardNumEntered.grid(column = 1, row = 35,padx=10, pady=10)
lableCreditExpireMonth = tkinter.Label(root, text="Experation Month (00): ")
lableCreditExpireMonth.grid(column = 0, row = 40,padx=10, pady=10)
myCreditExpireMonth = tkinter.StringVar()
CreditExpireMonthEntered = tkinter.Entry(root, width=5, textvariable = myCreditExpireMonth)
CreditExpireMonthEntered.grid(column = 1, row = 40,padx=10, pady=10)
lableCreditExpireYear = tkinter.Label(root, text="Experation Year (00): ")
lableCreditExpireYear.grid(column = 0, row = 45,padx=10, pady=10)
myCreditExpireYear = tkinter.StringVar()
CreditExpireYearEntered = tkinter.Entry(root, width=5, textvariable = myCreditExpireYear)
CreditExpireYearEntered.grid(column = 1, row = 45,padx=10, pady=10)
lableCVV = tkinter.Label(root, text="CVV: ")
lableCVV.grid(column = 0, row = 50,padx=10, pady=10)
myCVV = tkinter.StringVar()
CVVEntered = tkinter.Entry(root, width=5, textvariable = myCVV)
CVVEntered.grid(column = 1, row = 50,padx=10, pady=10)
lableUser = tkinter.Label(root, text="Account Username/Email: ")
lableUser.grid(column = 0, row = 55, pady=10)
myUsername = tkinter.StringVar()
userEntered = tkinter.Entry(root, width=25, textvariable = myUsername)
userEntered.grid(column = 1, row = 55, pady=10)
lablePassword = tkinter.Label(root, text="Password: ")
lablePassword.grid(column = 0, row = 60 ,pady=10)
myPassword = tkinter.StringVar()
passwordEntered = tkinter.Entry(root, width=25, textvariable = myPassword)
passwordEntered.grid(column = 1, row = 60,padx=10, pady=10)
if console == "PS":
if supplier == "Walmart":
ps5P = Button(root, text="Playstation Physical", command= partial(PlayStationPhysical ,myFirstName,myLastName,myEmail,myAddress,myPhone,myCreditCardNum,myCreditExpireMonth,myCreditExpireYear,myCVV, "Walmart", myUsername, myPassword))
ps5D = Button(root, text="Playstation Digital", command= partial(PlayStationDigital ,myFirstName,myLastName,myEmail,myAddress,myPhone,myCreditCardNum,myCreditExpireMonth,myCreditExpireYear,myCVV, "Walmart", myUsername, myPassword))
ps5P.grid(column = 0, row = 65)
ps5D.grid(column = 1, row = 65)
root.mainloop()
if console == "XB":
ps5P = Button(root, text="Xbox Series X", command= partial(XboxX ,myFirstName,myLastName,myEmail,myAddress,myPhone,myCreditCardNum,myCreditExpireMonth,myCreditExpireYear,myCVV, "Walmart", myUsername, myPassword))
ps5D = Button(root, text="Xbox Series S", command= partial(XboxS ,myFirstName,myLastName,myEmail,myAddress,myPhone,myCreditCardNum,myCreditExpireMonth,myCreditExpireYear,myCVV, "Walmart", myUsername, myPassword))
ps5P.grid(column = 0, row = 65)
ps5D.grid(column = 1, row = 65)
root.mainloop()
def PlayStation():
root = tkinter.Tk()
root.title("Kocab's PlayStation Bot")
root.geometry("500x500")
pickSupplier = tkinter.Label(root, text="Please chose a supplier")
pickSupplier.pack()
ps5Start = Button(root, text="Walmart", command= partial(form, "PS" ,"Walmart"))
ps5Start.pack()
root.mainloop()
def Xbox():
root = tkinter.Tk()
root.title("Kocab's PlayStation Bot")
root.geometry("500x500")
pickSupplier = tkinter.Label(root, text="Please chose a supplier")
pickSupplier.pack()
ps5Start = Button(root, text="Walmart", command= partial(form, "XB", "Walmart"))
ps5Start.pack()
root.mainloop()
if __name__ == "__main__":
root = tkinter.Tk()
root.title("Kocab's PlayStation Bot")
root.geometry("500x500")
greeting = tkinter.Label(root, text="Welcome to Kocab's PlayStation 5 Bot")
greeting.grid(column = 25, row = 0)
about1 = tkinter.Label(root, text="This program will run scripts and automates buying a PlayStation 5 or Xbox Series X/S. Please select the console you desire, and you'll be greeted with a form to fill out to automate shipping and payment" ,wraplength=450)
about1.grid(column = 25, row = 2,padx=20, pady=10)
ps5Start = Button(root, text="Playstation", command= partial(PlayStation))
xboxStart = Button(root, text="Xbox", command= partial(Xbox))
ps5Start.grid(column = 25, row = 6)
xboxStart.grid(column = 25, row = 8)
root.mainloop()